You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Never extend the life-time of self from within deinit. Doing so will crash at runtime.
I had a code with an object which is created in a background thread (and is destroyed in the same thread because it is default iOS behavior). In the same time the app expects this object being deinited in the main thread.
I didn't have an influence on the thread in which the object inited so I had to delay its deiniting until the main thread. In the same time according to your comments I can't do that. How to resolve it in other way then?
The text was updated successfully, but these errors were encountered:
The Objective-C and Swift runtimes have never provided any guarantees about the scheduling of deinit. Some specific objects in some frameworks do, but nothing in the general case.
This might be something worth asking on forums.swift.org. Unless you think the guide is missing some more specific details?
But otherwise it might be good to call out the Task { self.stuff } being a bad idea™ since it's so tempting to use it.
Copying some resource to then close into the task is more safe and sometimes okey though.
https://www.swift.org/migration/documentation/swift-6-concurrency-migration-guide/commonproblems/
I had a code with an object which is created in a background thread (and is destroyed in the same thread because it is default iOS behavior). In the same time the app expects this object being deinited in the main thread.
I didn't have an influence on the thread in which the object inited so I had to delay its deiniting until the main thread. In the same time according to your comments I can't do that. How to resolve it in other way then?
The text was updated successfully, but these errors were encountered: