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

Your Second iOS and SwiftUI App

Nov 3 2020 · Video Course (2 hrs, 32 mins) · Beginner

Use the knowledge you've gained from creating a SwiftUI app and learning the basics of Swift to create a more complex app: one to track your book collection!

3.6/5 16 Ratings

Version

  • Swift 5.3, iOS 14, Xcode 12

List View Fundamentals

Introduction

2:27 Free

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

1

List Rows

4:18 Free

A List is a View for organizing data into a scrollable column of rows, and a row can be any View! Before you can have a list, you need a reusable row.

2

Collectively, the properties of a book will be our data model. A book's image will be computed based on it its stored model data.

3

With your Book model, and a simple Image View, set up, it is time to provide a book to the view you'll be using for each of your list rows.

4

Lists

2:45

With enough of your app built up for it to make sense to incorporate a List, it's nearly as simple as hitting "Embed in List"!

5

Navigation

3:39

Use NavigationLink and NavigationView to show a new detail view after tapping on a row in the list of books.

6

Create a reusable view which you can use for your rows, and their detail views. The "details" will be the entirety of longer titles, and larger images.

7

Conclusion

0:44

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

Data Flow

In this part, you'll complete your Book type and create more interactive views. Your app will look great in both light and dark mode, too!

9

Use a modal sheet in your detail view to present an image picker, and bind the result to your library. Soon, your books can have cover photos!

10

The accent color for an app will be applied to certain views, like button labels, to achieve a desired theme.

11

The reason the images you're adding to your library are not showing up is because Book Images currently only display symbols. Let's fix that!

12

Alerts

2:53

An Alert is a good solution for helping a user avoid an unintentional loss of data. Along with the "sheet", it's another type of modal View.

13

Challenge time! After setting a book's image, show the user a "delete" button, which will bring up your alert from the previous episode.

14

Convert a Book instance into "Model Object": a reference type that comes with the power of the Identifiable protocol.

15

Combine makes it easy to take an object, observe changes to its properties, and react to those changes, in SwiftUI.

16

To complete your detail view, make use of a TextField, binding it to a book's micro-review. Then display the review in your list!

17

Conclusion

0:23

You've given your app a bunch of new features in this part. You can interact with your library and books from multiple places, and your UI syncs right up!

18

Managing Rows

In this part, you'll be adding and removing books from your library, and sorting and reorganizing them.

19

ForEach

4:16

A List is not only for displaying a collection of similar views. That's the job of ForEach! Employ them both in order to have more complex columns.

20

Create a sheet that will bring the user to a new view, where they can fill out the information for a new book to be added to their library.

21

Environment

13:22

An environment is a storage container for potentially any information that multiple views need to function.

22

Sections

12:29

Lists offer customizable Sections, with headers and footers as needed. You'll use a section for each of the two "readMe" options for a book.

23

ObjectWillChangePublisher powers ObservedObject and EnvironmentObjects in SwiftUI. Use it to propagate ObservableObject changes to collections.

24

Using modifiers on a ForEach, move books in your library, or delete them. An Edit Button in the navigation bar can help with both.

25

Menus

4:32

Set up a Menu, in the same toolbar as your Edit button, that will allow for sorting by author, title, or manually.

26

It's time to get the menu from the previous episode working, and finish up this app, with automatic book sorting!

27

Conclusion

1:29

Let's review some of what you've accomplished along the journey of creating Your Second iOS and SwiftUI App. There are more learning paths in store for you next!

28

Who is this for?

This is the last course in 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 personal library-tracking app in this course, using SwiftUI. 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
  • View Navigation
  • Modal Sheets
  • Menus
  • Edit Mode
  • Dark Mode
  • SwiftUI Environment
  • SwiftUI Bindings
  • Combine: Published and Observable Objects
  • Swift Extensions
  • Access Control
  • Hashable and Identifiable Protocols
  • Custom Types
  • Nested Types

Contributors

Comments