#SwiftUI @FocusState seems broken on iOS 18.2 Simulator in Xcode 16.2
https://developer.apple.com/forums/thread/774528
Setting a @FocusState var that has a corresponding `.focused` TextField and .defaultFocus for initial focus both are not working.
| Blog | http://www.malcolmhall.com |
#SwiftUI @FocusState seems broken on iOS 18.2 Simulator in Xcode 16.2
https://developer.apple.com/forums/thread/774528
Setting a @FocusState var that has a corresponding `.focused` TextField and .defaultFocus for initial focus both are not working.
Here's a good one from the sample: Making your app’s functionality available to Siri. onAppear, Task.detached, then MainActor.run, crazy!
Album's async fetchAssets is also weird.
Found the missing #SwiftData context did change notification!
extension ModelContext {
public static let didChange = NSNotification.Name(rawValue: "_SwiftDataModelsChangedInContextNotificationPrivate")
}
For those interested here is the other side of the 2 relationships.
This obvious mistake shouldn't even compile. In Code Data's model editor the UI would not even allow you to do this.
Nice work Apple! #SwiftUI #SwiftData and can't even submit an issue 😭
@Relationship(inverse: \Plant.backyard)
public var leadingPlants: [Plant] = []
@Relationship(inverse: \Plant.backyard)
public var trailingPlants: [Plant] = []
SwiftData/Schema.swift:457: Fatal error: Inverse already set to another relationship - leadingPlants - cannot assign to - trailingPlants
#SwiftUI wonder if this is normal? "Duplicate bar buttons appear when .toolbar is applied to a Group View" https://developer.apple.com/forums/thread/762965
Group {
Text("1")
Text("2")
Text("3")
}
.toolbar {
Button("Hi") {
}
}
Found an annoying bug in #Shortcuts on Mac. The Get File in Folder Action fails with the Documents folder if iCloud Desktop & Documents folder is turned on.
FB14481167 Permissions error with the "Get File from Folder" action with the Documents folder when iCloud Drive's Desktop & Documents folder feature is enabled despite allowing in Privacy alert
Btw this results in the "Open Favorite Trails" Shortcuts action switching to the Favourites tab in all windows, e.g. in the below screenshot.
The thing I was wondering, should multi-scene be disabled, or should the Shortcut action work on all scenes, or select one scene based on some heuristic like activate the scene already on favourites, if none then use most recently activated?
In the #AppIntents sample, which is designed to show you how to modify navigation from an external Shortcuts action, if you make another window, the navigation is mirrored in both windows because the navigation object is shared between the whole app.
This is a really frustrating issue because it leaves the question, should AppIntents only be used in apps that are not multi-scene and the Apple developer just forgot to disable it in the plist? Or...
https://developer.apple.com/documentation/appintents/acceleratingappinteractionswithappintents