Closed olliekav closed 3 years ago
It seems weird
in the first code a failure in current
too soon will do not allow to instantiate the controller correctly
maybe first try to be kind with the compilator with typed value
let device: Device = Device.current
but I do not think it will change something because its runtime
so a mixed solution
class CustomViewController: UIViewController {
var device: Device!
override func viewDidLoad() {
super.viewDidLoad()
device = .current
}
}
@phimage many thanks, I'll try this out.
Seeing a really weird bug since upgrading to Xcode 12 (12.2) and trying to run our app on iOS12, it works fine on iOS13 +.
Carthage DeviceKit -v 4.2.1
Any class where I define
let device = Device.current
early, crashes on iOS12. It will only work if I declare it within a function. e.gThis crashes with
Unknown class _TtC11App21CustomViewController in Interface Builder file.
This works
I found this Stackoverflow comment that mentions why, but with no details how to fix it https://stackoverflow.com/a/64978875/1132441
Any ideas why this would be happening?