Search code examples
swiftintuiinterfaceorientationswift2xcode7

Int is not convertible to UIInterfaceOrientationMak for supportedInterfaceOrientations()


I have another problem with Xcode 7. I have tried some research but cannot come up with a solution. The error is Int is not convertible to UIInterfaceOrientationMask. The code below:

override func supportedInterfaceOrientations() -> UIInterfaceOrientationMask {
    if visibleViewController is KINWebBrowserViewController { return Int(UIInterfaceOrientationMask.All.rawValue) }
    return Int(UIInterfaceOrientationMask.Portrait.rawValue)
}

Thanks


Solution

  • Swift 3.x

    override var supportedInterfaceOrientations: UIInterfaceOrientationMask {
        return visibleViewController is KINWebBrowserViewController ? .all : .portrait
    }