Post

Replies

Boosts

Views

Activity

Reply to SwiftUI Picker not trigger `onChange` first time when inside Menu in MacOS
if I move onChange to Menu, the problem disappeared Menu("menu") { Picker("value \(value)", selection: $value) { Text("A").tag("a") Text("B").tag("b") Text("C").tag("c") } .pickerStyle(.inline) } .onChange(of: value) { oldValue, newValue in print("onChange", newValue) } but my goal is to encapsulate Picker into a controlled component similar to React, so I have to put state inside menu import SwiftUI struct TBSelect: View { let title: String; let value: String; let options: Array<TBSelectOption>; let tip: String; let onChange: (_ value: String) -> Void; @State private var innerValue: String; struct TBSelectOption { let title: String; let value: String; let systemImage: String?; } init(title: String, value: String, options: Array<TBSelectOption>, tip: String = "", onChange: @escaping (_ value: String) -> Void) { _innerValue = State(initialValue: value); self.title = title self.value = value self.options = options self.tip = tip self.onChange = onChange; } var body: some View { Picker(title, selection: $innerValue) { ForEach(options, id: \.value) { option in if let systemImage = option.systemImage { Label(option.title, systemImage: systemImage) .tag(option.value) } else { Text(option.title) .tag(option.value) } } } .help(tip) .onChange(of: innerValue) { oldValue, newValue in onChange(newValue) } } }
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Sep ’24
Reply to swiftUI apps with SwiftData and CloudKit crashes on iOS but works on MacOS
@FPST I tried with catch do { self.modelContainer = try ModelContainer(for: Document.self, CheckPoint.self, configurations: self.modelConfiguration) } catch let error { print(error); fatalError() } I can't find any clues with the error message CoreData: debug: CoreData+CloudKit: -[NSCloudKitMirroringDelegate managedObjectContextSaved:](3113): <NSCloudKitMirroringDelegate: 0x600002aec2d0>: Observed context save: <NSPersistentStoreCoordinator: 0x600003beab80> - <NSManagedObjectContext: 0x600002eea150> CoreData: debug: CoreData+CloudKit: -[NSCloudKitMirroringDelegate remoteStoreDidChange:](3156): <NSCloudKitMirroringDelegate: 0x600002aec2d0>: Observed remote store notification: <NSPersistentStoreCoordinator: 0x600003beab80> - BBB83AF9-4C01-4B3C-83E2-995E86857622 - (null) - file:///Users/xx/Library/Containers/com.test.swiftDataCloudTest/Data/Library/Application%20Support/default.store CoreData: debug: CoreData+CloudKit: -[NSCloudKitMirroringDelegate remoteStoreDidChange:]_block_invoke(3206): <NSCloudKitMirroringDelegate: 0x600002aec2d0> - Ignoring remote change notification because it didn't change any entities tracked by persistent history: <NSSQLCore: 0x11f60e6d0> (URL: file:///Users/xx/Library/Containers/com.test.swiftDataCloudTest/Data/Library/Application%20Support/default.store) SwiftDataError(_error: SwiftData.SwiftDataError._Error.loadIssueModelContainer)
Jun ’24
Reply to swiftUI apps with SwiftData and CloudKit crashes on iOS but works on MacOS
on MacOS 14.5, the app on Mac also crash with the same error Unresolved error loading container Error Domain=NSCocoaErrorDomain Code=134060 "A Core Data error occurred." UserInfo={NSLocalizedFailureReason=Unable to find a configuration named 'default' in the specified managed object model.} I think there is something todo with MacOS 14.5 and iOS 17.5.....
Jun ’24
Reply to Mac Catalyst WKWebView keyDown never trigger (no more keyboard events)
same problem, more and more bug on apple mac platform and safari. I think apple developer is more and more like IE6 developer, which is a shame!!!
Topic: Safari & Web SubTopic: General Tags:
Replies
Boosts
Views
Activity
Oct ’24
Reply to "Failed to set up CloudKit integration" in TestFlight build
Thanks a lot for this answer. Been troubleshooting this bug for almost a day now, can't believe it's 2024 and Apple hasn't fixed this bug or mentioned this configuration in the developer documentation.
Replies
Boosts
Views
Activity
Sep ’24
Reply to SwiftUI Picker not trigger `onChange` first time when inside Menu in MacOS
A week has passed and I haven't received any feedback from Apple. https://feedbackassistant.apple.com/feedback/15061288
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Sep ’24
Reply to SwiftUI Picker not trigger `onChange` first time when inside Menu in MacOS
I think there is something wrong with Menu in MacOS, toogle insdie Menu has the same problem struct swiftuiTestApp: App { @State private var val = false; var body: some Scene { WindowGroup { Menu("menu") { Toggle(isOn: $val) { Text("open") }.onChange(of: val) { oldValue, newValue in print("onChange", newValue) } } } } }
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Sep ’24
Reply to SwiftUI Picker not trigger `onChange` first time when inside Menu in MacOS
if I move onChange to Menu, the problem disappeared Menu("menu") { Picker("value \(value)", selection: $value) { Text("A").tag("a") Text("B").tag("b") Text("C").tag("c") } .pickerStyle(.inline) } .onChange(of: value) { oldValue, newValue in print("onChange", newValue) } but my goal is to encapsulate Picker into a controlled component similar to React, so I have to put state inside menu import SwiftUI struct TBSelect: View { let title: String; let value: String; let options: Array<TBSelectOption>; let tip: String; let onChange: (_ value: String) -> Void; @State private var innerValue: String; struct TBSelectOption { let title: String; let value: String; let systemImage: String?; } init(title: String, value: String, options: Array<TBSelectOption>, tip: String = "", onChange: @escaping (_ value: String) -> Void) { _innerValue = State(initialValue: value); self.title = title self.value = value self.options = options self.tip = tip self.onChange = onChange; } var body: some View { Picker(title, selection: $innerValue) { ForEach(options, id: \.value) { option in if let systemImage = option.systemImage { Label(option.title, systemImage: systemImage) .tag(option.value) } else { Text(option.title) .tag(option.value) } } } .help(tip) .onChange(of: innerValue) { oldValue, newValue in onChange(newValue) } } }
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Sep ’24
Reply to SwiftUI Picker not trigger `onChange` first time when inside Menu in MacOS
I displayed the value on Picker title, it turns out that first time select another option , the value did changed, but the onChange is not trigger Picker("value \(value)", selection: $value) { //... }
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Sep ’24
Reply to SwiftUI view not updated after SwiftData change through CloudKit
Having the same problem on iOS 17.4
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Aug ’24
Reply to swiftUI apps with SwiftData and CloudKit crashes on iOS but works on MacOS
with iOS 18 public beta and macOS 14.4.1, it works again. with no code change......
Replies
Boosts
Views
Activity
Jul ’24
Reply to swiftUI apps with SwiftData and CloudKit crashes on iOS but works on MacOS
@FPST I tried with catch do { self.modelContainer = try ModelContainer(for: Document.self, CheckPoint.self, configurations: self.modelConfiguration) } catch let error { print(error); fatalError() } I can't find any clues with the error message CoreData: debug: CoreData+CloudKit: -[NSCloudKitMirroringDelegate managedObjectContextSaved:](3113): <NSCloudKitMirroringDelegate: 0x600002aec2d0>: Observed context save: <NSPersistentStoreCoordinator: 0x600003beab80> - <NSManagedObjectContext: 0x600002eea150> CoreData: debug: CoreData+CloudKit: -[NSCloudKitMirroringDelegate remoteStoreDidChange:](3156): <NSCloudKitMirroringDelegate: 0x600002aec2d0>: Observed remote store notification: <NSPersistentStoreCoordinator: 0x600003beab80> - BBB83AF9-4C01-4B3C-83E2-995E86857622 - (null) - file:///Users/xx/Library/Containers/com.test.swiftDataCloudTest/Data/Library/Application%20Support/default.store CoreData: debug: CoreData+CloudKit: -[NSCloudKitMirroringDelegate remoteStoreDidChange:]_block_invoke(3206): <NSCloudKitMirroringDelegate: 0x600002aec2d0> - Ignoring remote change notification because it didn't change any entities tracked by persistent history: <NSSQLCore: 0x11f60e6d0> (URL: file:///Users/xx/Library/Containers/com.test.swiftDataCloudTest/Data/Library/Application%20Support/default.store) SwiftDataError(_error: SwiftData.SwiftDataError._Error.loadIssueModelContainer)
Replies
Boosts
Views
Activity
Jun ’24
Reply to swiftUI apps with SwiftData and CloudKit crashes on iOS but works on MacOS
on MacOS 14.5, the app on Mac also crash with the same error Unresolved error loading container Error Domain=NSCocoaErrorDomain Code=134060 "A Core Data error occurred." UserInfo={NSLocalizedFailureReason=Unable to find a configuration named 'default' in the specified managed object model.} I think there is something todo with MacOS 14.5 and iOS 17.5.....
Replies
Boosts
Views
Activity
Jun ’24
Reply to swiftUI apps with SwiftData and CloudKit crashes on iOS but works on MacOS
the crash is on last line when create ModelContainer
Replies
Boosts
Views
Activity
Jun ’24