Post

Replies

Boosts

Views

Activity

Reply to Swift 6, SwiftData modelContext.save() Crashes, Does not AutoSave
I've discovered where the crash is occurring. I have an @objc function called updateView() that is fired when the view controller detects NSPersistenStoreRemoteChange. As soon as I save an object in another view, the update fires and the app crashes. NotificationCenter.default.addObserver(self, selector: #selector(updateView(_ :)), name: .NSPersistentStoreRemoteChange, object: nil) The crash does not occur using Swift 5.
Aug ’24
Reply to Main actor-isolated instance method 'locationManagerDidChangeAuthorization' cannot be used to satisfy nonisolated protocol requirement
@DTS Engineer, here's an example of what I did. nonisolated func locationManager(_ manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) { Task { await changeMyLocation(locations) } } func changeMyLocation(_ locations: [CLLocation]) { myLocation = locations.last } I created a function to change the location and called it via a task.
Topic: Programming Languages SubTopic: Swift Tags:
Jul ’24
Reply to What to do with a visionOS (designed for iPad) app in App Store Connect?
You can add a visionOS Platform in App Store Connect. But then if you want to submit for that platform, you'd have to submit a visionOS binary, not one for 'visionOS (designed for iPad)'. To do that, go to your build settings and under Architectures, set Base SDK to 'visionOS'. Then you will see the Destination 'Any visionOS Device (arm64)' in Xcode. If you keep the Base SDK as 'iOS' and submit a binary, it will be sent to your iOS app Platform. It won't be seen by a visionOS Platform.
Jan ’24
Reply to Swift 6, SwiftData modelContext.save() Crashes, Does not AutoSave
I have two screenshots of the threads, one under Swift 5 and one under Swift 6. I set a breakpoint in the updateView method. The Swift 5 run gets to the breakpoint. The Swift 6 run does not and crashes. Swift 5 Swift 6 Any help would be most appreciated. Or maybe this is ripe for a bug report?
Replies
Boosts
Views
Activity
Aug ’24
Reply to Swift 6, SwiftData modelContext.save() Crashes, Does not AutoSave
I've discovered where the crash is occurring. I have an @objc function called updateView() that is fired when the view controller detects NSPersistenStoreRemoteChange. As soon as I save an object in another view, the update fires and the app crashes. NotificationCenter.default.addObserver(self, selector: #selector(updateView(_ :)), name: .NSPersistentStoreRemoteChange, object: nil) The crash does not occur using Swift 5.
Replies
Boosts
Views
Activity
Aug ’24
Reply to Swift 6, SwiftData modelContext.save() Crashes, Does not AutoSave
I now understand the the warnings go away under Swift 6 as 'InferSendableFromCaptures' has been enabled. I still have the crash. Guess I better dig in.
Replies
Boosts
Views
Activity
Aug ’24
Reply to SwiftData Tables disappearing while test my app!
I don't see where you used the @Model macro to change your classes into SwiftData. Did I miss something?
Replies
Boosts
Views
Activity
Aug ’24
Reply to Main actor-isolated instance method 'locationManagerDidChangeAuthorization' cannot be used to satisfy nonisolated protocol requirement
I've changed to using @precurrency given your write up.
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Jul ’24
Reply to Main actor-isolated instance method 'locationManagerDidChangeAuthorization' cannot be used to satisfy nonisolated protocol requirement
@DTS Engineer, here's an example of what I did. nonisolated func locationManager(_ manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) { Task { await changeMyLocation(locations) } } func changeMyLocation(_ locations: [CLLocation]) { myLocation = locations.last } I created a function to change the location and called it via a task.
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Jul ’24
Reply to SwiftData @Model does not conform to the 'Sendable' protocol; thi
I've fixed this by creating a struct for the data returned by SwiftData. I stuff the struct with the SwiftData and use the struct in my UICollectionViewDiffableDataSource. I am using SwiftData with UIKit.
Replies
Boosts
Views
Activity
Jul ’24
Reply to SwiftData @Model does not conform to the 'Sendable' protocol; thi
I use the @Model class in my UICollectionViewDiffableDataSource as the ItemIdentifierType, which I now see is required to be Sendable. I have a ton of errors relating to this. This is a big deal. Do I need to create Sendable structs which reads the @Model parameters? I will look into ModelActor to see if that can get me what I need.
Replies
Boosts
Views
Activity
Jul ’24
Reply to Main actor-isolated instance method 'locationManagerDidChangeAuthorization' cannot be used to satisfy nonisolated protocol requirement
I've fixed this by setting the delegate methods to nonisolated and calling functions within a Task to set the values that need to be set.
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Jul ’24
Reply to SwiftUI @Entry isn't working
This works in Xcode Version 16.0 beta 4 (16A5211f)
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Jul ’24
Reply to SwiftData, Core Data, and initializing CloudKit development Schema
Silly question. Did you add 'import SwiftData' to the file?
Replies
Boosts
Views
Activity
Apr ’24
Reply to Apple Vision Pro Development Without the $299 Dongle?
Apple is selling the dongle to developers to help them when they have an application with enhance graphics. It’s not being offered except through the developers website.
Replies
Boosts
Views
Activity
Feb ’24
Reply to What to do with a visionOS (designed for iPad) app in App Store Connect?
Right. You don't provide screenshots.
Replies
Boosts
Views
Activity
Jan ’24
Reply to What to do with a visionOS (designed for iPad) app in App Store Connect?
You can add a visionOS Platform in App Store Connect. But then if you want to submit for that platform, you'd have to submit a visionOS binary, not one for 'visionOS (designed for iPad)'. To do that, go to your build settings and under Architectures, set Base SDK to 'visionOS'. Then you will see the Destination 'Any visionOS Device (arm64)' in Xcode. If you keep the Base SDK as 'iOS' and submit a binary, it will be sent to your iOS app Platform. It won't be seen by a visionOS Platform.
Replies
Boosts
Views
Activity
Jan ’24
Reply to visionOS Build Issues
Thank you rmahnud28.
Replies
Boosts
Views
Activity
Jan ’24