Post

Replies

Boosts

Views

Activity

Reply to DispatchSemaphore freeze
The alignmentGuide modifier is @preconcurrency nonisolated. In Swift 6, I had to call a nonisolated function to calculate alignment, in which a certain @MainActor property was needed. That's why I tried to use a semaphore. I have switched back to Swift 5, since AVFoundation is not ready for Swift 6. The problem here is solved by removing nonisolated and semaphore. We may handle it after switching to Swift 6 in the future. Thanks.
3w
Reply to Sending '$0' risks causing data races
In class SystemPreferredCameraObserver of sample code AVCam: Building a camera app, the following let newDevice = change?[.newKey] as? AVCaptureDevice continuation?.yield(newDevice) causes error in Xcode 16.1 RC: Sending 'newDevice' risks causing data races Task-isolated 'newDevice' is passed as a 'sending' parameter; Uses in callee may race with later task-isolated uses What might be a workaround here?
4w
Reply to SwiftData does not work on a background Task even inside a custom ModelActor.
I try to save data off the main actor with the following actor @ModelActor final actor DataActor { init(container: ModelContainer) { let context = ModelContext(container) context.autosaveEnabled = true modelContainer = container modelExecutor = DefaultSerialModelExecutor(modelContext: context) } } and fetch data with the main context, but no data are fetched. Data might not be saved by the above actor. After switching to data saving with the main context, it works.
Aug ’23
Reply to NSUnknownKeyException: not key value coding-compliant for the key "(null)"
Xcode 15 beta 6 reports a new error for the array property: CoreData: fault: One or more models in this application are using transformable properties with transformer names that are either unset, or set to NSKeyedUnarchiveFromDataTransformerName. Please switch to using "NSSecureUnarchiveFromData" or a subclass of NSSecureUnarchiveFromDataTransformer instead. At some point, Core Data will default to using "NSSecureUnarchiveFromData" when nil is specified, and transformable properties containing classes that do not support NSSecureCoding will become unreadable. CoreData: warning: Property 'dataSets' on Entity 'Station' is using nil or an insecure NSValueTransformer. Please switch to using "NSSecureUnarchiveFromData" or a subclass of NSSecureUnarchiveFromDataTransformer instead.
Aug ’23
Reply to Context outside of SwiftUI Views
The documentation for ModelContext says it's Sendable, but when I use the context of the ModelActor above in another actor, I get a warning in Xcode 15 beta 4: Non-sendable type 'ModelContext' in implicitly asynchronous access to actor-isolated property 'context' cannot cross actor boundary Calling the run method causes a similar warning. What's happening?
Jul ’23
Reply to Explain Map() position
It seems the behavior of fallback automatic. After initial display, setting position programmatically has no effect -- I wrote a feedback on this bug. In my app, tapping the user location button has no effect either, but I couldn't create a simple app to reproduce it.
Jun ’23