On Jun 19, 2014, at 5:39 PM, Roland King <r...@rols.org> wrote: > On 20 Jun, 2014, at 5:04 am, Greg Parker <gpar...@apple.com> wrote: >>> >>> override func supportedInterfaceOrientations() -> Int >>> { >>> } >>> >>> which makes some sense. I'm tripping over myself trying however to return >>> the correct Int without casting my casts to casts of casts. >> >> Please file a bug report. -supportedInterfaceOrientations should be declared >> to return UIInterfaceOrientationMask, not Int. This sort of loose typing >> works in C but not in Swift. > > OK I've filed (rdar://17387641) - although in this case I'm not sure it would > have made life much better as the constructor takes a UInt the best I would > have been able to do is > > return UIInterfaceOrientationMask( > UIInterfaceOrientationMask.Portrait.value + > UIInterfaceOrientationMask.PortraitUpsideDown.value ) > > which isn't much prettier. I do agree however that returning a > UIIntefaceOrientationMask would be semantically better and it's not hard to > define the '+' and '|' operators on them myself to do the right thing which > would lead to > > return UIInterfaceOrientationMask.Portrait + > UIInterfaceOrientationMask.PortraitUpsideDown > > which would be very nice (and i suggested in the radar)
The | operator should already work with UIInterfaceOrientationMask and anything else declared with NS_OPTIONS in Objective-C headers. It would look like this if -supportedInterfaceOrientations returned UIInterfaceOrientationMask: override func supportedInterfaceOrientations() -> UIInterfaceOrientationMask { return UIInterfaceOrientationMask.Portrait | UIInterfaceOrientationMask.PortraitUpsideDown } …which is perfectly fine. -- Greg Parker gpar...@apple.com Runtime Wrangler _______________________________________________ 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