Re: specifying UIInterfaceOrientationMask
No, because it complains that the bitwise or operator doesn't "...produce any result which is a UIInterfaceOrientationMask" or words to that effect. Which doesn't surprise me given Swift's strong typing. Unfortunately, it appears that that UIInterfaceOrientationMask (which is a struct, according to the docs) doesn't have an initializer that takes an Int. On Jul 12, 2016, at 1:43 PM, Steve Christensenwrote: > So, (UIInterfaceOrientationMask.Portrait | > UIInterfaceOrientationMask.LandscapeLeft) doesn't work? > > >> On Jul 12, 2016, at 11:25 AM, William Squires wrote: >> >> In iOS 8, I would (in a view controller): >> >> ... >> override func supportedInterfaceOrientations() -> Int >> { >> return Int(UIInterfaceOrientationMask.Portrait.rawValue) | >> Int(UIInterfaceOrientationMask.LandscapeLeft.rawValue) >> } >> ... >> >> but this no longer works in iOS 9, as the method signature is now: >> >> func supportedInterfaceOrientations() -> UIInterfaceOrientationMask >> >> instead. So how do I cast the Int result above to a >> UIInterfaceOrientationMask? I tried the obvious: >> >> return >> UIInterfaceOrientationMask(Int(UIInterfaceOrientationMask.Portrait.rawValue) >> | Int(UIInterfaceOrientationMask.LandscapeLeft.rawValue)) >> >> but Xcode complains that UIInterfaceOrientationMask doesn't have an >> initializer that takes "Int". >> >> so what dumb Swift feature am I overlooking now? > ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: specifying UIInterfaceOrientationMask
On Jul 12, 2016, at 11:25 , William Squireswrote: > > what dumb Swift feature am I overlooking now? It’s an OptionsSet now, so you specify compound values with an array literal form. In Swift 3, with API swiftification, it’ll be something like: return [.portrait, .landscapeLeft] In Swift 2.2, the names may be slightly different. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: specifying UIInterfaceOrientationMask
So, (UIInterfaceOrientationMask.Portrait | UIInterfaceOrientationMask.LandscapeLeft) doesn't work? > On Jul 12, 2016, at 11:25 AM, William Squireswrote: > > In iOS 8, I would (in a view controller): > > ... > override func supportedInterfaceOrientations() -> Int > { > return Int(UIInterfaceOrientationMask.Portrait.rawValue) | > Int(UIInterfaceOrientationMask.LandscapeLeft.rawValue) > } > ... > > but this no longer works in iOS 9, as the method signature is now: > > func supportedInterfaceOrientations() -> UIInterfaceOrientationMask > > instead. So how do I cast the Int result above to a > UIInterfaceOrientationMask? I tried the obvious: > > return > UIInterfaceOrientationMask(Int(UIInterfaceOrientationMask.Portrait.rawValue) > | Int(UIInterfaceOrientationMask.LandscapeLeft.rawValue)) > > but Xcode complains that UIInterfaceOrientationMask doesn't have an > initializer that takes "Int". > > so what dumb Swift feature am I overlooking now? ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
specifying UIInterfaceOrientationMask
In iOS 8, I would (in a view controller): ... override func supportedInterfaceOrientations() -> Int { return Int(UIInterfaceOrientationMask.Portrait.rawValue) | Int(UIInterfaceOrientationMask.LandscapeLeft.rawValue) } ... but this no longer works in iOS 9, as the method signature is now: func supportedInterfaceOrientations() -> UIInterfaceOrientationMask instead. So how do I cast the Int result above to a UIInterfaceOrientationMask? I tried the obvious: return UIInterfaceOrientationMask(Int(UIInterfaceOrientationMask.Portrait.rawValue) | Int(UIInterfaceOrientationMask.LandscapeLeft.rawValue)) but Xcode complains that UIInterfaceOrientationMask doesn't have an initializer that takes "Int". so what dumb Swift feature am I overlooking now? ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com