let mySizeClass: UIUserInterfaceSizeClass = self.traitCollection.horizontalSizeClass
and the return value will be an enum .Compact or .Regular (or .Unspecified).
When I try it in code compiler shows me a warning: Value of type 'NSObject -> () -> MyViewController' has no member 'traitCollection'
.
Please tell me what is wrong. I`m studying Standford's course on iTunesU and I have this example from there.
That's because you are putting the code in the wrong place, namely at the top level of the view controller declaration. Your code needs to go inside a method.