iOS 8 introduce new screen types that are usable in Storyboards and in Xibs, can I detect these types in code? If yes, how?
Here you can find more about it https://developer.apple.com/library/content/releasenotes/General/WhatsNewIniOS/Articles/iOS8.html
You can also detect kind of device and its orientation using below extension:
Yes you can, UIViewControllers now have a
traitCollection
property which has information from the device idiom, to the current size classes and more ... Furthermore you can implement the methodfunc traitCollectionDidChange(previousTraitCollection: UITraitCollection)
to get notifications when the size class (or any trait) has changed (as when the user rotates the device on an iphone). The properties of UITraitCollection that you are looking for arehorizontalSizeClass
andverticalSizeClass
..Here is a referenceHope that helps
From the page you linked (emphasis added):
As noted in the references linked from there, you can implement the
traitCollectionDidChange
method in your view or view controller to find out when the size class changes.