Introduction

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

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

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

Unlock now

If you’ve been doing the homework in this course, you’ve been building a maze app by printing emoji directly on the screen. This has worked to demonstrate various techniques with SwiftUI.

Unfortunately, this app is static. The maze is “hardcoded” into the app. You could create variables to store the map data, but a far better solution is to use arrays.

Arrays allow you to store lots of related data. You can think of them as a row in a spreadsheet. You can also have arrays inside of arrays allowing to create columns. By using arrays, you can dynamically update the screen as well as introduce entirely new mazes.

Unfortunately, regular loops in SwiftUI can cause issues. For this reason, SwiftUI provides it’s own special loop and in using it, you’ll write your own special SwiftUI functions.

By the end of the lesson, you will learn to:

  • Identify the differences between a regular array and a multidimensional array.
  • Describe how to use the ForEach loop in SwiftUI.
  • Detail the steps needed to create a SwiftUI function.
See forum comments
Download course materials from Github
Next: Working with Multidimensional Arrays