Closed noppefoxwolf closed 3 months ago
I fixed platform version because deprecated. But it's not related my changes. So, I reverted code.
See also: https://developer.apple.com/documentation/packagedescription/supportedplatform/iosversion/v9
Actor isolation is introduced by Swift5.5. https://github.com/apple/swift-evolution/blob/main/proposals/0313-actor-isolation-control.md
The actor is clarify where function called what thread. In default, Delegator doesn't know actor. So, It should call with Task method even if delegate called from main thread.
protocol Delegate {
func onTap()
}
extension ViewController: Delegate {
func onTap() {
Task {
await self.updateBackgroundColor()
}
}
}
If all delegate method called from main thread, protocol is prefer to have @MainActor. Delegators no longer need to write Task or self.
@MainActor protocol Delegate {
func onTap()
}
extension ViewController: Delegate {
func onTap() {
updateBackgroundColor()
}
}
Ahhh I see! No problems then! I'll double check it still works with iOS 11 and merge it in.
Thanks so much for that!
Thanks for the PR @noppefoxwolf! Admittedly I'm still new to Swift concurrency; why is this required?
It would require bumping the minimum version of this library to iOS 12, and I'm still trying to aim to support iOS 11... 😅