#Swift 6 Compatibility

9 messages · Page 1 of 1 (latest)

smoky yarrow
#

Just curious if anyone with an Appwrite & iOS/WatchOS project written with swift, has successfully upgraded to Swift 6. I am finding it a little difficult.

undone temple
#

i am doing it. did not find any problem there. can you share a little more details.

smoky yarrow
#

Hmm, maybe its not AppWrites incompatibility and I have structured my project incorrectly.

In swift 5, I was able to make all my DataStores singletons.

class Singleton: ObservableObject{ static let shared = Singleton() private init(){ } }

Now in Swift 6, global singletons are prone to cause data-races. I have stripped them of what makes them singletons and added them as environmentObjects.

If you have some time I would like to hop on a call or chat and discuss details further if you'd be willing?

undone temple
#

you are working with swiftUI?

smoky yarrow
undone temple
#

ok. singleton in itself does not cause race condition, depends on how you use it. just like even if you remove singleton it could still produce data-race.

#

it's a broad spectrum and purely depends on your use.

smoky yarrow
#

Yes, even after I remove singleton it still produces data races warning/error....
Any time I make an appwrite request there is data race warning/error. Maybe I have implemented my appwrite service incorrectly. Could you share the structure of your appwrite implementation>?

undone temple
#

i don't use swiftui much but if you share your code i can check for it.