# UIKit + AutoLayout

### Lecture Slides

{% embed url="<https://docs.google.com/presentation/d/1jvdbsSrFnkFBZqZSFzv4ld356seBlpO_vXIo1OljdL0/edit?usp=sharing>" %}

### Lecture Video

{% embed url="<https://www.youtube.com/watch?v=_JB0exdCehk>" %}

### Lecture Demo

{% embed url="<https://github.com/intro-to-ios/lec2-uikit>" %}
If you prefer to download the ZIP, go to Code > Download ZIP.
{% endembed %}

#### Clone the Repository

<pre class="language-sh"><code class="lang-sh"><strong>git clone https://github.com/intro-to-ios/lec2-uikit
</strong><strong>OR git clone git@github.com:intro-to-ios/lec2-uikit.git
</strong></code></pre>

#### Checkout Branches

```sh
git checkout origin/1-uilabel
OR git checkout 1-uilabel

git checkout origin/2-uiimageview
OR git checkout 2-uiimageview
```

#### Classes Demo Code

```swift
class Student {
    // Properties
    var name: String
    var major: String
    var age: Int

    // Initializer
    init(name: String, major: String, age: Int) {
        self.name = name
        self.major = major
        self.age = age
    }
}

let vin = Student(name: "Vin", major: "Info Sci", age: 20)
vin.major // Prints "Info Sci"

class EngineeringStudent: Student {
    // Inherits properties from the superclass, but you can
    // define other properties specific to this class
    var doesShower: Bool

    // Initializer
    init(name: String, major: String, age: Int, doesShower: Bool) {
        self.doesShower = doesShower // Initialize properties specific to this class
        super.init(name: name, major: major, age: age) // Call superclass' initializer
    }
}

let archit = EngineeringStudent(name: "Archit", major: "CS", age: 20, doesShower: false)
archit.name // Good
archit.doesShower // Good
vin.doesShower // Does not work

```
