Post

Replies

Boosts

Views

Created

iOS 26 @FocusState Doesn't Work If TextField Is In Toolbar
When I add a TextField with @FocusState to a toolbar, I noticed that setting focus = false doesn't cause the form to lose focus If I move the TextField out of the toolbar setting focus = false works fine. How can I unfocus the text field when the cancel button is tapped? Minimal example tested on Xcode Version 26.0 beta 6 (17A5305f): import SwiftUI struct ContentView: View { @State private var text: String = "" @FocusState private var focus: Bool var body: some View { NavigationStack { List { Text("Test List") } .toolbar { ToolbarItem(placement: .bottomBar) { TextField("Test", text: $text) .padding(.horizontal) .focused($focus) } ToolbarItem(placement: .bottomBar) { Button(role: .cancel) { focus = false // THIS DOESN'T WORK! } } } } } } #Preview { ContentView() }```
1
2
262
Aug ’25
NSPersistentCloudKitContainer: Exclude Relationship From Share
I am trying to add CloudKit sharing to my app using the new iOS 15 share method  https://developer.apple.com/documentation/coredata/nspersistentcloudkitcontainer/3746834-sharemanagedobjects In the app there are 3 core data entities (Folder, Item, Comment) with the following relationships: A Folder contains many Items An Item has many Comments I want to use CloudKit to share just the Item entity, not any of its relationships. Is this possible to do with the share(_:to:completion:) method? Currently, when I pass an Item to the share method it also includes the Folder and Comments in the CKShare. How do I prevent this? A similar question was posted here with no response: https://developer.apple.com/forums/thread/697630
1
0
896
Jun ’22
NSPersistentCloudKitContainer exclude relationship from share
I am trying to add CloudKit sharing to my app using the new iOS 15 share method https://developer.apple.com/documentation/coredata/nspersistentcloudkitcontainer/3746834-share In the app there are 3 core data entities (Folder, Item, Comment) with the following relationships: A Folder contains many Items An Item has many Comments I want to use CloudKit to share just the Item entity, not any of its relationships. Is this possible to do with the share(_:to:completion:) method? Currently, when I pass an Item to the share method it also includes the Folder and Comments in the CKShare. How do I prevent this?
1
0
974
Feb ’22