5-Day Swift Coding Challenge: Day 5

Apr 25 2025 · Swift 6.0, iOS 18, Swift Playground 4.6

Lesson 01: Day 5: Making an App

Demo: Looping in SwiftUI

Episode complete

Play next episode

Next

Heads up... You’re accessing parts of this content for free, with some sections shown as obfuscated text.

Heads up... You’re accessing parts of this content for free, with some sections shown as obfuscated text.

Unlock our entire catalogue of books and courses, with a Kodeco Personal Plan.

Unlock now

To get started, open the project in progress. This should be the state of the maze app after the last homework. At this point, we want to add all the emoji’s into an array. That way, we can store our data, update it on the fly, and even add new mazes. Update it to the following:

  var data = [
  ["🟩","🟩","🟩","🟩","🟩","🟩","🟩","🐰","🟩","🟩","🟩","🟩","🟩","🟩","🟩","🟩"],
  ["🟩","🟧","🟧","🟧","🟧","🟧","🟧","🟧","🟩","🟧","🟧","🟧","🟧","🟧","🟧","🟩"],
  ["🟩","🟩","🟩","🟩","🟩","🟩","🟩","🟧","🟩","🟩","🟩","🟩","🟩","🟩","🟧","🟩"],
  ["🟩","🟧","🟧","🟧","🟧","🟧","🟩","🟧","🟧","🟧","🟧","🟧","🟧","🟧","🟧","🟩"],
  ["🟩","🟧","🟩","🟩","🟩","🟧","🟩","🟩","🟩","🟩","🟩","🟩","🟩","🟩","🟧","🟩"],
  ["🟩","🟩","🟩","🟩","🟩","🟧","🟧","🟧","🟧","🟧","🟧","🟧","🟧","🟧","🟧","🟩"],
  ["🟩","🟧","🟧","🟧","🟧","🟧","🟩","🟩","🟩","🟩","🟧","🟩","🟧","🟩","🟧","🟩"],
  ["🟩","🟧","🟩","🟩","🟩","🟧","🟩","🟧","🟧","🟧","🟧","🟩","🟧","🟩","🟧","🟩"],
  ["🟩","🟧","🟧","🟧","🟩","🟧","🟩","🟩","🟩","🟩","🟩","🟩","🟩","🟩","🟧","🟩"],
  ["🟩","🟩","🟩","🟧","🟩","🟩","🟩","🟩","🟩","🟩","🟩","🟧","🟧","🟧","🟧","🟩"],
  ["🟩","🟩","🟩","🥕","🟩","🟩","🟩","🟩","🟩","🟩","🟩","🟩","🟩","🟩","🟩","🟩"],
]
ForEach(0..<data.count, id: \.self) { rowIndex in
    HStack {

    }
}
Text(data[rowIndex].joined(separator: ""))
See forum comments
Cinema mode Download course materials from Github
Previous: Working with Multidimensional Arrays Next: Understanding Functions