I'm also having problems with NSObjects in 16b5.
With complete concurrency checking enabled but Swift 5 language mode, the following generates 1 warning and 1 error:
import Foundation
import UIKit
@MainActor class TestObject: NSObject {
let testView = UIView(frame: .zero)
private func doSomething() {
}
override init() {
// [ERROR] Property 'self.testView' not initialised at super.init call
super.init()
// [WARNING] Call to main actor-isolated instance method 'doSomething()' in a synchronous nonisolated context; this is an error in the Swift 6 language mode
doSomething()
}
}
So, (1) what's up with the let call not instantiating before the init() is called?
and
(2) how come the override method is now reverting back to the solution of the function being overridden rather than the stated actor/isolation of the object it's being defined in?
I really hope Quin's about to put me straight.
Post
Replies
Boosts
Views
Activity
And another similar warning with overriden functions (nos NS-based this time:
import Foundation
import UIKit
class TestListCell: UICollectionViewCell {
private func doSomething() {
}
override func awakeFromNib() {
// [WARNING] Call to main actor-isolated instance method 'doSomething()' in a synchronous nonisolated context; this is an error in the Swift 6 language mode
doSomething()
}
}```