Lecture Demo

UIKit and Autolayout

No starter code for this lecture, but please download the image. We'll be going over how to configure your projects for programmatic AutoLayout. These are steps you'll have to do at the start of all of your projects.

Here's a cheat sheet going over these steps for future reference.

 func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
        // Use this method to optionally configure and attach the UIWindow `window` to the provided UIWindowScene `scene`.
        // If using a storyboard, the `window` property will automatically be initialized and attached to the scene.
        // This delegate does not imply the connecting scene or session are new (see `application:configurationForConnectingSceneSession` instead).

        if let windowScene = scene as? UIWindowScene {
            let window = UIWindow(windowScene: windowScene)
            let VC = ViewController()
            window.rootViewController = UINavigationController(rootViewController: VC)
            self.window = window

Last updated