Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

shouldAutorotate() function in Xcode 8 beta 4

Tags:

ios

swift

xcode8

I updated Xcode 8 beta 3 to Xcode 8 beta 4 and I am actually correcting some bugs due to swift changement.

Function :

    override func shouldAutorotate() -> Bool {
    return false
}

Print an error and Xcode told me that this function is not override. It's mean that the function does not exist anymore.

override var shouldAutorotate

This var has just get properties so I can't change the value by this way.

So how can I work with autorotate now ?

Thanks !

like image 606
Logan Gallois Avatar asked Aug 02 '16 13:08

Logan Gallois


2 Answers

This is the right way

override var shouldAutorotate: Bool {
    return false
}
like image 84
user3508658 Avatar answered Sep 22 '22 09:09

user3508658


Swift 3 Syntax

open override var shouldAutorotate: Bool {
    get {
        return false
    }
}
like image 42
Jan Avatar answered Sep 25 '22 09:09

Jan