This is part of the "iOS and Swift for Beginners" learning path. View Path

Your Second iOS and SwiftUI App

Oct 8 2019 · Video Course (1 hr, 37 mins) · Beginner

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!

3.4/5 18 Ratings

Version

  • Swift 5.1, iOS 13, Xcode 11

SwiftUI Lists

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.

1

Models

4:53

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.

2

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

3

List Views

2:28

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.

4

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

5

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

6

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

7

Conclusion

0:41

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.

8

Adding and Deleting Tasks

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

9

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

10

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

11

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

12

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

13

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

14

Edit Mode

3:05

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!

15

Conclusion

0:25

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

16

Editing Tasks

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.

17

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

18

Extensions

6:03

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.

19

Binding

4:01

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

20

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

21

Conclusion

0:50

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.

22

Priority Sections

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.

23

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

24

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

25

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

26

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

27

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

28

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

29

Conclusion

1:27

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

30

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

Contributors

Comments