Post

Replies

Boosts

Views

Activity

Reply to how to change appInfo in SwiftUI?
@Environment(\.openWindow) var openWindow Window("About", id: "about") {     MyAboutView() } .commands {     CommandGroup(replacing: .appInfo) {         Button(action: {             openWindow(id: "about")         }, label: {             Text("About MyAPP")         })     } }
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Feb ’23
Reply to Custom File "New Document" to show template-picker in a document-based app
Answering my own question. I want to use Commands. See newItem. Here's an example: struct DocDemoApp: App {     @Environment(\.openWindow) var openWindow     @Environment(\.openDocument) private var openDocument     var body: some Scene {         DocumentGroup(newDocument: { DocDemoDocument() }) { config in             ContentView(document: config.document)         }         Window("Choose Template", id: "wizard") {             NewDocWizard()         }         .commands {             CommandGroup(replacing: .newItem) {                 Section {                     // Menu File >                     Button("New") { openWindow(id: "wizard") }.keyboardShortcut(KeyboardShortcut("N"))                     Button("Open") { open() }.keyboardShortcut(KeyboardShortcut("o"))                     Button("Open Recent...") { print("NYI") }                 }             }             CommandGroup(replacing: .singleWindowList) {                 // Menu Window > Choose Template, ... (list of single windows)                 // Hide and force user to use File > New for this window             }         }     }     private func open() {         let panel = NSOpenPanel()         panel.allowedContentTypes = [.exampleText]         panel.allowsMultipleSelection = true         panel.canChooseDirectories = false         panel.runModal()         if let url = panel.url {             Task {                 try! await openDocument(at: url)             }         }     } }
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Jan ’23
Reply to (Xcode 14.0 beta 5) ThreadSanitizer: CHECK failed: tsan_platform_posix.cpp:83 "((beg)) <= ((end))"
On my Intel MBP is get a different error when the thread sanitizer is on. "malloc: nano zone abandoned due to inability to preallocate reserved vm space." StackOverflow suggests this is relatively harmless, but paired with the error I get on my Mac Mini (Apple Silicon) There's something afoul. [https://stackoverflow.com/questions/64126942/malloc-nano-zone-abandoned-due-to-inability-to-preallocate-reserved-vm-space]
Aug ’22
Reply to Unexpected intents
Solved. I had stupid dead code.
Topic: App & System Services SubTopic: General Tags:
Replies
Boosts
Views
Activity
Oct ’23
Reply to NavigationSplitView detail view with safearea
Would safeAreaInset, applied to the button you want to be tappable, help? (I have not dealt a lot with safe areas so I am guessing.) How to inset the safe area with custom content: https://www.hackingwithswift.com/quick-start/swiftui/how-to-inset-the-safe-area-with-custom-content
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Oct ’23
Reply to TipKit: showing a popover tip on a SwiftUI toolbar button
Just don't use .automatic.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Oct ’23
Reply to Optionally use iCloud with SwiftData
My trouble was stale cache in the simulator or Mac. Restarting/rebooting a couple times helped.
Topic: App & System Services SubTopic: iCloud Tags:
Replies
Boosts
Views
Activity
Sep ’23
Reply to Enabling undo with multi-model schema
(Don't post while sleepy) Right in the docs... .modelContainer(for: [MyModel1.self, MyModel2.self], isUndoEnabled: true)
Topic: App & System Services SubTopic: iCloud Tags:
Replies
Boosts
Views
Activity
Aug ’23
Reply to how to change appInfo in SwiftUI?
@Environment(\.openWindow) var openWindow Window("About", id: "about") {     MyAboutView() } .commands {     CommandGroup(replacing: .appInfo) {         Button(action: {             openWindow(id: "about")         }, label: {             Text("About MyAPP")         })     } }
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Feb ’23
Reply to Custom File "New Document" to show template-picker in a document-based app
Answering my own question. I want to use Commands. See newItem. Here's an example: struct DocDemoApp: App {     @Environment(\.openWindow) var openWindow     @Environment(\.openDocument) private var openDocument     var body: some Scene {         DocumentGroup(newDocument: { DocDemoDocument() }) { config in             ContentView(document: config.document)         }         Window("Choose Template", id: "wizard") {             NewDocWizard()         }         .commands {             CommandGroup(replacing: .newItem) {                 Section {                     // Menu File >                     Button("New") { openWindow(id: "wizard") }.keyboardShortcut(KeyboardShortcut("N"))                     Button("Open") { open() }.keyboardShortcut(KeyboardShortcut("o"))                     Button("Open Recent...") { print("NYI") }                 }             }             CommandGroup(replacing: .singleWindowList) {                 // Menu Window > Choose Template, ... (list of single windows)                 // Hide and force user to use File > New for this window             }         }     }     private func open() {         let panel = NSOpenPanel()         panel.allowedContentTypes = [.exampleText]         panel.allowsMultipleSelection = true         panel.canChooseDirectories = false         panel.runModal()         if let url = panel.url {             Task {                 try! await openDocument(at: url)             }         }     } }
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Jan ’23
Reply to (Xcode 14.0 beta 5) ThreadSanitizer: CHECK failed: tsan_platform_posix.cpp:83 "((beg)) <= ((end))"
On my Intel MBP is get a different error when the thread sanitizer is on. "malloc: nano zone abandoned due to inability to preallocate reserved vm space." StackOverflow suggests this is relatively harmless, but paired with the error I get on my Mac Mini (Apple Silicon) There's something afoul. [https://stackoverflow.com/questions/64126942/malloc-nano-zone-abandoned-due-to-inability-to-preallocate-reserved-vm-space]
Replies
Boosts
Views
Activity
Aug ’22
Reply to (Xcode 14.0 beta 5) ThreadSanitizer: CHECK failed: tsan_platform_posix.cpp:83 "((beg)) <= ((end))"
I created a blank iOS app project in Xcode, enabled the thread sanitizer and it crashes exactly the same way on two simulators. I'm going to try a few more things to see how much might be me or Xcode.
Replies
Boosts
Views
Activity
Aug ’22
Reply to In SwiftUI, how do I stop a TextField from always beginning with initial caps?
I found that .autocapitalization(.none) doesn't work for me in iOS 15. I found .textInputAutocapitalization(.never) does work.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Jun ’22
Reply to An error occurred installing iOS 16 Developer Beta.
I have the iOS 16 profile installed but Software Update says I have 15.6 and I'm as up to date as I can be. I removed the profile and reinstalled it, yet it still refuses to install iOS 16.
Topic: App & System Services SubTopic: Core OS Tags:
Replies
Boosts
Views
Activity
Jun ’22
Reply to Xcode 13 suddenly using old frameworks
Solved. Some slip of the mouse, perhaps, but the running target had changed to my Mac.
Replies
Boosts
Views
Activity
Sep ’21