Programming in Swift: Fundamentals

Oct 19 2021 Swift 5.5, iOS 15, Xcode 13

Part 5: Functions & Named Types

39. Challenge: Structures

Lesson Complete

Play Next Lesson
Save for later
About this episode
See versions

See forum comments
Cinema mode Mark as Complete Download course materials
Previous episode: 38. Structures Next episode: 40. Classes

Update Notes: The student materials have been reviewed and are updated as of October 2021.

Heads up... You've reached locked video content where the transcript will be shown as obfuscated text.

You can unlock the rest of this video course, and our entire catalogue of books and videos, with a Professional subscription.

It’s time for some practice with structures. You can find the challenge in the “06 - Challenge - Structures” page of the playground you’ve been using, or you can download a new one from the resources for this video. Open it up, and try solving the challenge questions on your own, then keep watching to compare your work to mine. Good luck!

struct Student {

struct Student {
  let firstName: String
  let lastName: String
  let grade: Int
struct Classroom {

struct Classroom {
  let subject: String
  let students: [Student]
func getHighestGrade() {
func getHighestGrade() -> Int? {
var grades: [Int] = []
for student in students {
return grades.max()
53 let classroom = Classroom(
  className: "Usable Clock Design",
  students: [
    Student(firstName: "Chris", lastName: "Belanger", grade: 75),
    Student(firstName: "Catie", lastName: "Catterwaul", grade: 95),
    Student(firstName: "Salvador", lastName: "Dalí", grade: 2)