Reputation: 821
When I used swift 3 to run some old code, and convert them to newest swift 3. I found the method compile error
override func willTransitionToTraitCollection( newCollection: UITraitCollection,
withTransitionCoordinator coordinator: UIViewControllerTransitionCoordinator) {
}
And compiler told me "Method does not override any method from its superclass"
should I import some modules?
Upvotes: 0
Views: 350
Reputation: 47896
In the Swift editor of my Xcode 8 beta 3:
class MyViewController: UIViewController {
//Wait hear ↓
willTransition
}
I have got this suggestion:
class ViewController: UIViewController {
//Wait hear ↓
override func willTransition(to newCollection: UITraitCollection, with coordinator: UIViewControllerTransitionCoordinator) {
<#code#>
}
}
(You need to remove all other syntax errors to get better suggestions.)
Anyway, you should not do everything by yourself. Make Swift do it.
New documentation for willTransitionToTraitCollection:withTransitionCoordinator:
is here:
willTransitionToTraitCollection:withTransitionCoordinator:
Upvotes: 1