Homework Assignment One

In this assignment, you’ll build a SwiftUI app with a ContentView that links to three additional views. Each view demonstrates a different concept: text styling, SF Symbols, and image display. Read through all the requirements before you start.

Get Started

  1. Create a new Xcode project. Name it HomeworkOne or something similar.
  2. Add three new SwiftUI view files to your project — you’ll link to each from ContentView.

View 1: Text Styling

In one of your three views, include each of the following:

  1. A text field using a custom font with a fixed font size.
  2. A second text field with a large amount of text and a line limit of 2. It should contain more text than it actually shows on screen.
  3. Padding applied to at least one text field.
  4. A font color applied to one text field.
  5. A third text field with a background color. Hint: .background(Color.yellow) is a good starting point.

View 2: SF Symbols

In a second view:

  1. Display an airplane SF Symbol. Set the font size to around 300 so it nearly fills the screen.
  2. Apply a rotation effect so the airplane points straight up. (See Chapter 2 on text modifiers.)
Example: airplane symbol rotated to point straight up

View 3: Image

In your third view:

  1. Display a large image of your choosing.
  2. Make the image resizable and apply .scaledToFit() so it scales proportionally. It may not fill both dimensions — that’s expected.
  3. Add an overlay to the image. Set the color to black and the opacity to a value that darkens the image while still keeping it visible. (See Chapter 3: Applying an Overlay to an Image.)