Created
February 3, 2025 00:01
-
-
Save T1T4N/a14e2220422d9ab363fed8454c3eb094 to your computer and use it in GitHub Desktop.
Fix for "Sending 'self' risks causing data races" in Swift 6
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 1. Decorate the class itself with e.g. @MainActor | |
// 2. If that isn't possible, here is an example workaround: | |
deinit { | |
nonisolated(unsafe) let obj = self | |
MainActor.assumeIsolated { | |
obj.dismiss(animated: false) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment