# UIKit + AutoLayout

### Lecture Slides

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

### Lecture Video

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

### 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

```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://ios-course.cornellappdev.com/resources/archived-past-semesters/fa23/lectures/uikit-+-autolayout.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
