jazzedge
12/14/2017 - 5:06 AM

Swift - Device Orientation

See: https://stackoverflow.com/questions/26943808/ios-how-to-run-a-function-after-device-has-rotated-swift

override func viewWillTransition(to size: CGSize, with coordinator: UIViewControllerTransitionCoordinator) {
        super.viewWillTransition(to: size, with: coordinator)
        if UIDevice.current.orientation.isLandscape {
            print("Landscape")
        } else {
            print("Portrait")
        }
        //Code
    }