Your Second iOS and SwiftUI App

3 versions

Use the knowledge you've gained from creating a SwiftUI app, and learning the fundamentals of Swift, to create a more complex app: a task list! By Jessy Catterwaul.

2.8 (112) ·

Save for later
Share

Who is this for?

This course is part of our iOS and Swift for Beginners learning path. You're ready for this course if you're working through that learning path in order, or you're someone who has just a little bit of iOS and Swift experience.

You'll build an entire task list app in this course, using SwiftUI.

Starting off, you'll design a data model that supports a SwiftUI List. Then, you'll build up the visual components of the List, learning how to use Swift Arrays to power your UI.

Because the app will have multiple screens, you'll apply new techniques for sharing data throughout a SwiftUI app. Along the way, you'll get experience organizing your code using a variety of tools available to you in Swift and Xcode.

This course isn’t suited for intermediate or advanced developers. If that’s you, check out our intermediate or advanced video courses for more ways to level-up your developer skills!

Covered concepts

  • List Views
  • Data Models
  • Modal Sheets
  • Identifiable Protocol
  • SwiftUI Environment
  • SwiftUI Bindings
  • SwiftUI Edit Mode
  • Combine: Published and Observable Objects
  • Dependency Injection
  • Swift Extensions
  • Enumerations
  • Custom Types
  • Nested Types
  • Multiline Editing
  • Initialization using map
  • CaseIterable Protocol

Part 1: SwiftUI Lists

1
Toggle description

Learn what's in store for you as you build Your Second iOS and SwiftUI App. This course builds on the Your First iOS and SwiftUI App and Programming in Swift: Fundamentals courses.

Models 4:53
Toggle description

Set up a new Xcode project, and populate it with two Swift files: one to model a task, and another to store a collection of tasks.

Toggle description

Create a collection of tasks that you'd like to complete. And maybe pick up an Xcode and Swift trick!

List Views 2:28
Toggle description

Explore SwiftUI's List view, which displays data in a column, with a row for each entry. You'll use a range of integers for row indices.

Toggle description

Use the array indices supplied by List to access the correct task names, and display them in your rows.

Toggle description

Your Task type is ready to become Identifiable, relying on a UUID to become unique in the eyes of your List.

Toggle description

Prepare for using multiple screens in the upcoming parts by supplying your ContentView with a TaskStore, externally – a process known as dependency injection.

Conclusion 0:41
Toggle description

Review what you're able to do with lists already, and get a couple of ideas for what you can start thinking about in order to apply SwiftUI Lists in the future.

Part 2: Adding and Deleting Tasks

Toggle description

Have a look at the modal sheet (complete with Form styling), and Edit Mode, that you'll be adding to the app.

Toggle description

Create the SwiftUI view that you'll be using to create new tasks. The key components are a TextField, and some String-State.

Toggle description

Present your New Task View using a modal sheet. Launch it using a Button that resides in the Navigation Bar.

Toggle description

Using Form styling, more dependency injection, and SwiftUI's Environment, you'll add a Task to your model.

Toggle description

Solve the problem of your UI not updating to reflect your model with the power of Published and Observable Object from the Combine framework.

Toggle description

In order to delete tasks from your store, you will need to Encapsulate a ForEach inside of your List.

Edit Mode 3:05
Toggle description

Incorporate an Edit Button to get into Edit Mode: where you'll have access to an alternative way of deleting tasks, and a way to move them too!

Conclusion 0:25
Toggle description

Review the interactivity that you've given your app using your NewTaskView and Edit Mode, powered by SwiftUI and Combine.

Part 3: Editing Tasks

Toggle description

This part of the course is all about editing your tasks. By the end of it, you'll be able to change tasks' names, and mark them as completed.

Toggle description

Make use of Xcode's Extract Subview capability to prepare for the UI complexity that's coming in this part.

Extensions 6:03
Toggle description

Bindings are about to make things a little more complicated. But you can abstract away some complexity using the power of custom types and extensions.

Binding 4:01
Toggle description

Use SwiftUI Bindings to complete a flow of Tasks all the way to a new view, where you can edit them.

Toggle description

Make changes to the completion status of your tasks, and have those changes made visible with a checkmark and strikethrough text.

Conclusion 0:50
Toggle description

Review not only your app, but the fact that the developer community is eager to help each other out with exciting new technology like SwiftUI.

Part 4: Priority Sections

Toggle description

Some tasks are more important to get done than others, and your UI should reflect that. In this final part of the the course, you'll incorporate task priority.

Toggle description

To assign priority values to your tasks, you'll use two nested types: one an Identifiable structure, and the other, an enumeration.

Toggle description

Use the new model types from the last episode to help you organize your tasks using priority levels.

Toggle description

In one final SwiftUI View file for your TaskList app, group your tasks into sections, using the priorities you've set up.

Toggle description

Add headers to your sections, using SwiftUI's Section structure. That way, you'll finally be able to visualize priority!

Toggle description

Fix the bug preventing you from adding prioritized tasks. You can do that by adding more State to NewTaskView and a method to TaskStore.

Toggle description

Add a Picker control, so you can choose what priority a new task receives. Then style it with segmentation.

Conclusion 1:27
Toggle description

Let's review some of what you've accomplished along the journey of creating Your Second iOS and SwiftUI App.