Skip to content

Instantly share code, notes, and snippets.

@jazzedge
Created December 14, 2017 05:06
Show Gist options
  • Save jazzedge/bb58289fccbc281e403b68d7399d8fef to your computer and use it in GitHub Desktop.
Save jazzedge/bb58289fccbc281e403b68d7399d8fef to your computer and use it in GitHub Desktop.
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
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment