In previous betas of Xcode 13 a purple runtime warning would appear when using the alert/confirmationDialog APIs incorrectly. For example, this:
struct ContentView: View {
var body: some View {
Text("Hi")
.alert(
"Alert",| // See this Swift bug for more info: https://bugs.swift.org/browse/SR-9323 | |
| import Benchmark | |
| struct User { | |
| var name = "Blob" | |
| var age = 42 | |
| } | |
| @dynamicMemberLookup |
| received action: | |
| AppAction.currentGame( | |
| GameFeatureAction.game( | |
| GameAction.tap( | |
| UIGestureRecognizer.State.ended, | |
| 1.1.0@top, | |
| ) | |
| ) | |
| ) | |
| AppState( |
| import Combine | |
| class VM: ObservableObject { | |
| @Published var int = 0 | |
| } | |
| let vm = VM() | |
| _ = vm.$int.sink { value in | |
| print("Current value", value) |
| protocol SomeProtocol { | |
| func foo() -> Int? | |
| } | |
| struct Live: SomeProtocol { | |
| func foo() -> Int? { | |
| // do some work to return an integer | |
| } | |
| } |
| import Combine | |
| import ComposableArchitecture | |
| import UserNotifications | |
| public struct UserNotificationClient { | |
| public var add: (UNNotificationRequest) -> Effect<Void, Error> | |
| public var delegate: Effect<DelegateEvent, Never> | |
| public var getNotificationSettings: Effect<Notification.Settings, Never> | |
| public var removeDeliveredNotificationsWithIdentifiers: ([String]) -> Effect<Never, Never> | |
| public var removePendingNotificationRequestsWithIdentifiers: ([String]) -> Effect<Never, Never> |
| struct StoreManagerClient { | |
| var load: (String) -> AnyPublisher<(Data, URLResponse), URLError> | |
| func load<Output: Decodable>(objectID: String) -> AnyPublisher<Output, Error> { | |
| self.load(objectId) | |
| .decode(type: Output.self, decoder: JSONDecoder()) | |
| .eraseToAnyPublisher() | |
| } | |
| } |
It can be useful to assert again LocalizedStringKey in unit tests. Sometimes there is significant logic that goes into constructing a localized string and so it’s good to be able to write tests against that.
However, as soon as you apply some formatting to a string it seems to break equatability:
LocalizedStringKey("\(1)") == LocalizedStringKey("\(1)") // falseI have found an erroneous invocation of onDisappear in a particular view hierarchy. If you have a NavigationView wrapping a Form, which has a NavigationLink that drills down to a Form, then the inner most Form will have its onDisappear invoked when the view appears.
Here is a code sample that reproduces it:
struct ContentView: View {
var body: some View {
NavigationView {