Selective rotation lock in iOS apps with Swift

A guide on how to implement selective rotation lock on iOS apps Start by enabling Portrait, Landscape left and right oriention in your app settings. In your AppDelagate.swift add: var enableAllOrientation = false func application(_ application: UIApplication, supportedInterfaceOrientationsFor window: UIWindow?) -> UIInterfaceOrientationMask { if (enableAllOrientation == true){ return UIInterfaceOrientationMask.allButUpsideDown } return UIInterfaceOrientationMask.portrait } This sets…