Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Events
Videos
Audiobooks
Packt Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds
SwiftUI Projects
SwiftUI Projects

SwiftUI Projects: Build six real-world, cross-platform mobile applications using Swift, Xcode 12, and SwiftUI

Arrow left icon
Profile Icon Craig Clayton
Arrow right icon
$40.99
Full star icon Full star icon Full star icon Empty star icon Empty star icon 3 (11 Ratings)
Paperback Dec 2020 410 pages 1st Edition
eBook
$25.19 $27.99
Paperback
$40.99
Arrow left icon
Profile Icon Craig Clayton
Arrow right icon
$40.99
Full star icon Full star icon Full star icon Empty star icon Empty star icon 3 (11 Ratings)
Paperback Dec 2020 410 pages 1st Edition
eBook
$25.19 $27.99
Paperback
$40.99
eBook
$25.19 $27.99
Paperback
$40.99

What do you get with Print?

Product feature icon Instant access to your digital copy whilst your Print order is Shipped
Product feature icon Paperback book shipped to your preferred address
Product feature icon Redeem a companion digital copy on all Print orders
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
Product feature icon AI Assistant (beta) to help accelerate your learning
Modal Close icon
Payment Processing...
tick Completed

Shipping Address

Billing Address

Shipping Methods
Table of content icon View table of contents Preview book icon Preview Book

SwiftUI Projects

Chapter 2: SwiftUI Watch Tour

We've looked at things SwiftUI can do; now, we will examine how they look on each device. In this chapter and the next, we will work exclusively with watchOS and SwiftUI. Even if you are not doing watchOS development, everything can be applied to the iPhone, iPad, and macOS. There are some subtle differences, but overall everything is the same.

Since there is no specific design for this chapter, we'll look at the default behaviors that we get out of the box. WatchOS has many default looks that are harder to customize than on the other devices. We'll use this chapter to focus on execution, and in the next chapter, we'll work with a specific design. Let's get started working with SwiftUI.

In this chapter, we'll cover the following:

  • Creating a SwiftUI PageView in watchOS
  • Creating a Bar Chart, Wedge Chart, and Activity Ring
  • Creating a list in watchOS

This chapter has a starter file called SwiftUIWatchTour inside the Chapter 2 folder.

Technical requirements

Getting started

We are going to build a small app that will just get your feet wet. We will create a List which we will use to navigate us through our small app. Charts will link to charts and Colors will link to another colors list. One will show you Charts, and the other will show you a List from an Array. You will create three charts in this chapter – Bar, Activity Ring, and Wedge. We will build out a PageView, which will allow us to swipe from left to right to see each one. For the List, you will create a list and display it using an array. Here are what the screens will look like when we are finished:

 Figure 2.1

Figure 2.1

Building out our navigation

SwiftUI is now fully supported in watchOS 7, which means we do not have to work with some of the older controllers pre watchOS 6. We will first create our entire navigation, and then we will go back and build out each view. Let's get started by opening ContentView first.

Creating a static list

Our List, in this view, is going to be a static list with just two links. One will present a modal, and the other will do the standard push to detail view. Add the following after the struct declaration:

@State private var isPresented = false

In the last chapter, we skipped @State because it was not in scope, and I will do it again as I cover this in greater detail in Сhapter 5, Car Order Form – Data. But I will, for now, just say we are creating a Boolean that keeps track of the modal presentation. Next, inside the body variable, replace Text ('Content View') with the following:

List {
    Button('Charts') { // Step 1
        self.isPresented.toggle() // Step 2
    }
    .fullScreenCover(isPresented: $isPresented, content:       ChartsView.init) // Step 3
	// Add next step here
}

We just added a few lines of code; let's break down each step:

  1. As we covered in the last chapter, we have a button with its label set to Charts. In watchOS, buttons have a default look to them, so as long as you give it a label and an action, you will get all of the stylings. You might also notice we created our button slightly differently. There are a couple of different ways to create buttons, and this is just another implementation of it.
  2. We call the toggle() method on the isPresented boolean.
  3. In this step, we are using the fullScreenCover modifier and passing it the isPresented variable and the destination view, which in this case is ChartsView.

Now let's add our last bit of code by replacing // Add next step here with the following:

NavigationLink(destination: ColorsView()) { // Step 1
    Text('Colors') // Step 2
}.navigationTitle('Home') // Step 3

Let's discuss the code we just added:

  1. We are using a NavigationLink and this requires a destination view and also a label.
  2. The label is a view, and, in this case, we are using a text view.
  3. We set the title of the page here by using .navigationTitle set to Home.

We are done with our static List, so build and run the project, and you will be able to hit each item and see the following:

Figure 2.2

Figure 2.2

You now have the main navigation done but let's look at how we can create a page view navigation in the next section.

Creating a chart Page-View navigation

Next, we are going to create a Page View navigation controller. Just as you would expect on a phone, you will be able to swipe from the right to left and see different content on each page. You will also see some dots at the bottom of the page, which shows which page is being displayed currently.

Open ChartsView and let's get started. Inside the body variable, replace Text('Charts View') with the following:

TabView { // Step 1
    BarChartView() // Step 2
    WedgeChartView() 
    RingView() 
}.tabViewStyle(PageTabViewStyle(indexDisplayMode: .automatic))     // Step 3

We just added all of the code for ChartsView, so let's look at what we did:

  1. We wrap all of our views inside a TabView.
  2. Next, we set up each page by just listing them inside the TabView.
  3. We set the .tabViewStyle() modifier to PageTabViewStyle(indexDisplayMode: .automatic), which sets TabView to a page control.

If you build and run now, and then select Charts from the List, you will see the following:

Figure 2.3

Figure 2.3

We are done with getting all of our navigation set up. Next, we will create the first List using an array in the next section.

Creating a SwiftUI watch list

We are going to display a SwiftUI List view. Our List is going to display a list of colors. First, we need to create a color model.

Open the ColorModel file inside the Model folder and add the following:

struct ColorModel: Identifiable {
    var id = UUID()
   	var name: String
}

This struct has two properties: id and name. We have also set our model so that it conforms to Identifiable. When using a List in SwiftUI, our List is required to be unique, and there are two ways to handle this. We can either pass data, for example, the name as our unique ID, or we can use UUID and use this as our ID. The more you work with SwiftUI, the more ways you will encounter to handle Identifiable. If your data was coming from a feed, then you could use id if it were unique.

Open ColorsView.swift and add the following code inside the ColorsView struct, before the body:

@State var colors: [ColorModel] = [ ColorModel(name: 'Red'),
                                	ColorModel(name: 'White'),
                                	ColorModel(name: 'Blue'),
                                	ColorModel(name: 'Black'),
                                	ColorModel(name: 'Pink'),
                                	ColorModel(name: 'Yellow')
]

Inside the body variable, replace Text('Hello World') with the following code:

List {
    ForEach(colors) { color in // Step 1
        NavigationLink(destination: EmptyView()) { // Step 2
            Text(color.name) // Step 3
        }
    }
}

We just added another list; let's break down the rest of the code:

  1. We have a ForEach loop inside our List, and as it loops through the array, it gives us a color.
  2. Our ForEach loop creates a NavigationLink every time it loops through. NavigationLink is used to link to another page, but you might be wondering why you don't see EmptyView() in the folders. EmptyView() is an empty view that we get with SwiftUI and is excellent for prototyping. Using this allows us to deploy a simple placeholder that we can use until we create our actual detail view. For this example, we won't change it, but in later chapters, we will.
  3. Text(color.name) is our button label.

We are finished setting up our Colors View. Hit Command + R and you should now see a list of colors where, when you tap on an item, it goes to a blank screen with a back button:

Figure 2.4

Figure 2.4

Instead of displaying an empty view, we can use a Text view to display our detail view. Update NavigationLink(destination: EmptyView()) to NavigationLink(destination: Text(color.name)). Now, if you build and run, you can tap on the color and will see it in the detail view.

Using Swift previews

We covered this in the last chapter, but before we write any SwiftUI code, we will look at a SwiftUI file. Open BarChartView and you'll see our struct view, which we looked at in the previous chapter. If you scroll to the bottom, you will see static var previews. Previews are used to preview our design without having to launch the simulator. You should see a blank space to the right of your code, and at the top of this, you will see a button named Resume:

Figure 2.5

Figure 2.5

Click Resume, and you will see the preview appear:

Figure 2.6

Figure 2.6

Let's move on to building some charts.

Charts

Building charts is pretty fun in SwiftUI because it requires very little code. Here is an example of the three screens that we are looking to create in this section:

Figure 2.7

Figure 2.7

We will start on the Bar Chart first using the Capsule shape.

Bar charts

Bar charts are a great way to display information to users. In this example, we will create a static Bar Chart that you can use to display data on the watch. We can also take all of these examples and show them on the larger screens of other devices. Whenever we work in SwiftUI, we will use Swift Previews to review our work, making our workflow go much faster than having to wait for the simulator to launch and display. Please note that to use Swift Previews, you must be on macOS Catalina. If you are not, then just run the simulator.

Creating a header

First, we will start by creating our header for our view. This view is just two text views stacked horizontally next to each other. Open BarChartView, and we will start by first replacing Text ('Bar Chart') with the following code:

HStack(spacing: 0) {
    Text('BAR')
        .fontWeight(.heavy)
    Text('CHART')
        .fontWeight(.thin)
}
.foregroundColor(Color.red)
// Add next step here

In this code, we have an HStack with two Text views, which also has a spacing of 0. We apply a foregroundColor of red to the HStack; this gives a red color to both Text views.

You should see the following in the Preview:

Figure 2.8

Figure 2.8

Next, we need to create the container that our bar chart will go in. Replace // Add the next step here with the following:

VStack(spacing: 0) { // Step 1
    // Header
    HStack(spacing: 0) { // Step 2
        Text('BAR')
            .fontWeight(.heavy)
        Text('CHART')
            .fontWeight(.thin)
    }
    .foregroundColor(Color.red) // Step 3
    
    // Add next step here
}

We are adding our Header first; let's break down the code:

  1. We use a VStack as our main container with 0 spacing.
  2. Inside the VStack, we have an HStack that we are using for a header.
  3. We set the foreground to red for the entire HStack. Both BAR and CHART will now be red.

You should now see the following in the Swift Preview:

Figure 2.9

Figure 2.9

Now that we have our header, let's add our capsule. Replace // Add next step here with the following code:

HStack(alignment: .bottom, spacing: 2) { // Step 1
    VStack { // Step 2
        VStack(spacing: 2) { // Step 3
            Text('99')
                .font(.system(size: 11))
                .foregroundColor(Color(.gray))
            Capsule()
                .frame(width: 10, height: 100)
                .foregroundColor(Color(.red))
        }
        Text('M') // Step 4
            .font(.system(size: 12))
            .fontWeight(.black)
            .padding(.top, 0)
    }
}
.padding(.top, 10) // Step 5

We have a lot going on inside this HStack so let's go through each step together:

  1. We are using an HStack for alignment purposes only. The alignment is set to bottom with the spacing set to 2. I am putting the alignment to the bottom because I want my graph to start bottom-up. If I weren't trying to get everything aligned to the bottom, I wouldn't use the HStack.
  2. Next, we have a VStack that is our actual main container.
  3. Inside the main container, we have another VStack that holds the Capsule shape and the Text view for the value.
  4. Here, we use a Text view to display the day of the week.
  5. We add a 10-pixel padding to the top to create a bit of space between the Capsule and the title.

When you are done, you will see the following in the Preview:

Figure 2.10

Figure 2.10

We need to make this a bit more dynamic because we want to create more than one instance of our Capsule shape. Let's refactor this code so that we can reuse this.

Cleaning up our code

Creating child views is a great way to clean up our code, and we can clean up two things in this view. First, our Header code will be used for multiple views, so we can move the headers into a child view. Lastly, the Capsule code we just added can also be made into a view to be dynamic. Let's check out our code and see what I mean:

Figure 2.11

Figure 2.11

We want to take the HStack that holds our header contents and move it to HeaderView. We also want to take the other HStack and move it to CapsuleView.

Creating a reusable header view

First, highlight and cut the first HStack that we have inside our VStack. Then, open the HeaderView class, and paste it into the body variable in place of Text('Header View'). Save the file and you should see the following inside HeaderView:

struct HeaderView: View {
    var body: some View {
        HStack(spacing: 0) {
            Text('BAR')
                .fontWeight(.heavy)
            Text('CHART')
                .fontWeight(.thin)
        }
        .foregroundColor(Color.red)
    }
}

Next, go back to BarChartView and type HeaderView() on the line where we just removed the code. Then hit Resume in Swift Previews, and you should still see the bar chart just as you did before. Let's do the same with our Capsule code.

Creating a reusable bar view

Find the remaining HStack that is inside the VStack, then select and cut the code. Open CapsuleView, which is inside the Views folder, and inside the body variable, paste the Capsule code in place of Text ('Capsule View'). Save the file, go back to BarChartView, and under HeaderView(), add CapsuleView().

When you are done, your BarChartView code will now look like the following:

struct BarChartView: View {
    var body: some View {
        VStack(spacing: 0) {
            HeaderView()
            CapsuleView()
        }
    }
}

Your code is now refactored, but we need to allow each view to take data. First, let's update our HeaderView so that it can take a title and subtitle.

HeaderView with dynamic text

Open the HeaderView file again and above the body variable but below the struct declaration, add the following variables:

let title: String
let subtitle: String

Then, under Swift Previews, update the preview variable by replacing HeaderView() with the following: HeaderView(title: 'BAR', subtitle: 'CHART').

That now gets rid of our errors, so let's update the two Text views to use both the title and subtitle variables. Update BAR inside our body variable with title.uppercased().

Then, update CHART inside our body variable with subtitle.uppercased(). Lastly, back in BarChartView, update HeaderView() with HeaderView(title: 'BAR', subtitle: 'CHART').

We should still see what we saw before, but now we can reuse this view in our next two examples. Lastly, we want to make it so that we display seven capsules (covering the week from Sunday to Saturday). Let's do this now.

Capsule with dynamic data

For our Capsule, we need to pass two values, one for day and another for value that we use at the top of the bar, which we also use for the height. Setting this up is similar to what we did with HeaderView. Open the Capsule view and file and, above the body variable but below the struct declaration, add the following variables:

let value: Int
let day: String

Then under SwiftPreviews, update the preview variable by replacing HeaderView() with the following:

CapsuleView(value: 75, day: 'S')

Next, let's update our Text('99') view with Text('\(value)'). Then, update the Capsule height with CGFloat(value).

Finally, update the Text('M') view with Text(day.uppercased()), then back in BarChartView, update CapsuleView() with CapsuleView(value: 75, day: 'S').

Now, we want to display seven of these CapsuleViews, so press Command + click on the CapsuleView text and select Embed in HStack. Sometimes, holding Command and clicking doesn't work, so you might have to restart Xcode or do it manually.

Now, copy and paste seven CapsuleViews into the HStack, as follows:

HStack {
    CapsuleView(value: 75, day: 'S')
    CapsuleView(value: 100, day: 'M')
    CapsuleView(value: 50, day: 'T')
    CapsuleView(value: 25, day: 'W')
    CapsuleView(value: 40, day: 'T')
    CapsuleView(value: 25, day: 'F')
    CapsuleView(value: 40, day: 'S')
}

Mix up the data however you'd like. When you've finished, notice that our data is not lining up correctly in the Preview:

Figure 2.12

Figure 2.12

The HStack container we are using needs the alignment set. Add HStack(alignment: .bottom). You should now see that all of the capsules, no matter their heights, line up along the bottom of our view:

Figure 2.13

Figure 2.13

We are done with Bar Charts, so we can now move on to Activity Rings next.

Activity Ring

In this section, we want to create an Activity Ring. First, we need to create our container and HeaderView. Open the RingView file and find the following line inside the body variable:

Text('Ring View ')

Once found, replace it with the following code:

VStack {
    HeaderView(title: 'ACTIVITY', subtitle: 'RING')
    
	// Ring goes here
}

We now just need to add the code for our Activity Ring. Find the following comment:

// Ring goes here

Replace this with the following code:

ZStack { // Step 1
    Circle() // Step 2
        .stroke(lineWidth: 20)
        .fill(Color(.darkGray))
    Circle() // Step 3
        .trim(from: 0.5, to: 1)
        .stroke(Color(.red), style: StrokeStyle(lineWidth: 12,            lineCap: .round, lineJoin: .round))
        .rotationEffect(.degrees(180))
        .rotation3DEffect(.degrees(180), axis: (x: 1, y: 0, z: 0))
}
.frame(width: 130, height: 130) // Step 4
.rotationEffect(.degrees(90), anchor: .center)
.padding(.top, 10)

We now have an activity ring, but let's discuss what we just added:

  1. We are using a ZStack as our container. Since the ZStack lets us stack views on top of each other, it's a no-brainer what to use here.
  2. We have two Circles in a ZStack (which allows us to overlap the Circles). The first circle in our ZStack has a stroke line width of 20 and a fill color of Dark Gray.
  3. In the other Circle, we have trim set to 0.5, which specifies how much of the ring is filled. In this case, 0.5 equals 50% of the ring. We added a StrokeStyle, which lets us add a round lineCap and lineJoin with a lineWidth of 12. We have two rotation effects applied to this circle. We use this to flip the inner ring, filling it from the top and rotating clockwise. If you remove one of the rotation effects, it flips and makes the ring go counterclockwise.
  4. Our ZStack also has a rotation of 90 degrees, which means that it starts from the center and top of the circle at the 12 o'clock position.

In the Preview, you should see the following:

Figure 2.14

Figure 2.14

We have completed our Activity Ring, and we can now move on to our last chart, the Wedge.

Creating our wedge

In our final view, we are going to make a wedge shape. To simplify this next shape, I have already created the Wedge shape for you. Open WedgeView in Views. Now, just like we did for the Bar Chart and Activity Ring, let's add our HeaderView inside a VStack. Add the following code inside the body variable, replacing Text ('Wedge Chart'):

VStack {
	HeaderView(title: 'WEDGE', subtitle: 'CHART')
	
	// Last step
}

Good, now we have our title displaying before we create our wedge. We need to create an array of wedges. Above the body variable, add the following array:

let wedges = [
    Wedge(startAngle: -43, endAngle: 43, color: Color.blue),
    Wedge(startAngle: 43, endAngle: 150, color: Color.green),
    Wedge(startAngle: 150, endAngle: -43, color: Color.red)
]

Our array creates three wedges we can use to make our WedgeShape. You can mess with the start and end angles and change the color of each wedge. Finally, replace the comment 'Last step' with the following code:

ZStack {
    ForEach(0 ..< wedges.count) {
        WedgeShape(
            startAngle: Angle(degrees: self.wedges[$0]. 
        startAngle),
            endAngle: Angle(degrees: self.wedges[$0].endAngle),
            lineWidth: 24
        )
        .foregroundColor(self.wedges[$0].color)
    }
}.frame(width: 140)

In the preceding code, we use a ZStack to hold all of the wedges. We then use a ForEach loop and loop through our wedges array. Each time we loop through, we create a new Wedge shape, taking the start and end angle along with the color from our array.

Summary

In this chapter, we got to work on some basic SwiftUI views. This chapter was a primer to help you get a bit more comfortable using SwiftUI. From here on out, our UIs will become more complex. In the next chapter, we will build an NBA Draft app for the Apple Watch. We will work with animations as well as loading data from a plist. I hope you're excited as I am because this is the kind of stuff that made me want to write this book.

Left arrow icon Right arrow icon
Download code icon Download Code

Key benefits

  • Learn SwiftUI with the help of practical cross-platform development projects
  • Understand the design considerations for building apps for different devices such as Apple Watch, iPhone, and iPad using SwiftUI’s latest features
  • Work with advanced SwiftUI layout features, including SF Symbols, SwiftUI grids, and forms in SwiftUI

Description

Released by Apple during WWDC 2019, SwiftUI provides an innovative and exceptionally simple way to build user interfaces for all Apple platforms with the power of Swift. This practical guide involves six real-world projects built from scratch, with two projects each for iPhone, iPad, and watchOS, built using Swift programming and Xcode. Starting with the basics of SwiftUI, you’ll gradually delve into building these projects. You’ll learn the fundamental concepts of SwiftUI by working with views, layouts, and dynamic types. This SwiftUI book will also help you get hands-on with declarative programming for building apps that can run on multiple platforms. Throughout the book, you’ll work on a chart app (watchOS), NBA draft app (watchOS), financial app (iPhone), Tesla form app (iPhone), sports news app (iPad), and shoe point-of-sale system (iPad), which will enable you to understand the core elements of a SwiftUI project. By the end of the book, you’ll have built fully functional projects for multiple platforms and gained the knowledge required to become a professional SwiftUI developer.

Who is this book for?

SwiftUI Projects is intended for anyone who is already comfortable with Swift. We do not cover Swift topics in detail, so you need to be familiar with these already. All of the SwiftUI topics are taught as if this is the first time you've learned them and will gradually get more difficult.

What you will learn

  • Understand the basics of SwiftUI by building an app with watchOS
  • Work with UI elements such as text, lists, and buttons
  • Create a video player in UIKit and import it into SwiftUI
  • Discover how to leverage an API and parse JSON in your app using Combine
  • Structure your app to use Combine and state-driven features
  • Create flexible layouts on iPad
Estimated delivery fee Deliver to United States

Economy delivery 10 - 13 business days

Free $6.95

Premium delivery 6 - 9 business days

$21.95
(Includes tracking information)

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date : Dec 11, 2020
Length: 410 pages
Edition : 1st
Language : English
ISBN-13 : 9781839214660
Category :
Languages :
Tools :

What do you get with Print?

Product feature icon Instant access to your digital copy whilst your Print order is Shipped
Product feature icon Paperback book shipped to your preferred address
Product feature icon Redeem a companion digital copy on all Print orders
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
Product feature icon AI Assistant (beta) to help accelerate your learning
Modal Close icon
Payment Processing...
tick Completed

Shipping Address

Billing Address

Shipping Methods
Estimated delivery fee Deliver to United States

Economy delivery 10 - 13 business days

Free $6.95

Premium delivery 6 - 9 business days

$21.95
(Includes tracking information)

Product Details

Publication date : Dec 11, 2020
Length: 410 pages
Edition : 1st
Language : English
ISBN-13 : 9781839214660
Category :
Languages :
Tools :

Packt Subscriptions

See our plans and pricing
Modal Close icon
$19.99 billed monthly
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Simple pricing, no contract
$199.99 billed annually
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just $5 each
Feature tick icon Exclusive print discounts
$279.99 billed in 18 months
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just $5 each
Feature tick icon Exclusive print discounts

Frequently bought together


Stars icon
Total $ 139.97
SwiftUI Cookbook
$57.99
Mastering Swift 5.3
$40.99
SwiftUI Projects
$40.99
Total $ 139.97 Stars icon

Table of Contents

12 Chapters
Chapter 1: SwiftUI Basics Chevron down icon Chevron up icon
Chapter 2: SwiftUI Watch Tour Chevron down icon Chevron up icon
Chapter 3: NBA Draft – Watch App Chevron down icon Chevron up icon
Chapter 4: Car Order Form – Design Chevron down icon Chevron up icon
Chapter 5: Car Order Form – Data Chevron down icon Chevron up icon
Chapter 6: Financial App – Design Chevron down icon Chevron up icon
Chapter 7: Financial App – Core Data Chevron down icon Chevron up icon
Chapter 8: Shoe Point of Sale System – Design Chevron down icon Chevron up icon
Chapter 9: Shoe Point of Sale System – CloudKit Chevron down icon Chevron up icon
Chapter 10: Sports News App – Design Chevron down icon Chevron up icon
Chapter 11: Sports News App – Data Chevron down icon Chevron up icon
Other Books You May Enjoy Chevron down icon Chevron up icon

Customer reviews

Top Reviews
Rating distribution
Full star icon Full star icon Full star icon Empty star icon Empty star icon 3
(11 Ratings)
5 star 36.4%
4 star 9.1%
3 star 9.1%
2 star 9.1%
1 star 36.4%
Filter icon Filter
Top Reviews

Filter reviews by




Nicholas Jan 23, 2021
Full star icon Full star icon Full star icon Full star icon Full star icon 5
Okay so this is the second book on SwiftUI that I've read through from packt. I have enjoyed their materials so far and Ill go into detail below if you'd like to read why.This is a book with follow along projects, BUT they open with a quick review of the basics (which I needed) and it helps get your feet wet before you dive into a full project.The watch project was a great follow along as I have never built anything for the apple watch before so that was really fun.The second build was a little dry for me but I have to admit it showcased some great features, such as blurring backgrounds when you click certain buttons, and overall good UI/UX info that Ill likely use in my own future app.The financial app was really neat, I liked a lot of the logic that went into it, and man if you expand on the groundwork they lay for you here and tweak some things around I think this would make an impressive demo for your portfolio. This is beyond your classic bootcamp demo app you build, this looks pretty polished imho. Plus it discusses core data which you will want to be familiar with because it has a lot of strengths when you need to sort and filter large collections. Its tough to grasp but I would say the author did a pretty good job at laying it out in chapter 7.One thing missing that I really wish was included was a sample widget app. The new widgets are almost exclusively built on swiftUI and I would have loved to see a widget built out with the same level of polish as these other apps. Overall through really great book and I would recommend this to anyone getting into SwiftUI.
Amazon Verified review Amazon
Anonymous Dec 21, 2020
Full star icon Full star icon Full star icon Full star icon Full star icon 5
If you want to learn SwiftUI, be it Obj-C master, Swift regular or total noob, this book will get you on the right track to create a bunch of different iOS apps with SwiftUI. Once you master the basics and the concepts through this book you'll be writing your own book. Love the chapters on Core Data and Combine. If you're building apps on your own those two chapters will be incredibly important. They're well written and the code is easily understood and explained.
Amazon Verified review Amazon
Juan Catalan Dec 22, 2020
Full star icon Full star icon Full star icon Full star icon Full star icon 5
This book is written for intermediate iOS developers who are proficient with Xcode and Swift 5 and want to learn SwiftUI from scratch. SwiftUI is one of the must have skills to be successful in iOS development. If you do not have iOS development experience, you will not be able to follow the book and should learn Swift first.What I like the most about this book is the novel approach of teaching the SwiftUI framework by building six beautifully designed apps. Most technical books focus on teaching the technology thru sample code or very simple apps. However, in this book, Craig Clayton creates very complex apps from scratch, with very detailed user interfaces. If you code the apps in the book, you will learn SwiftUI and how to integrate this technology with other iOS frameworks to create App Store ready apps.The book follows a gradual approach and, as you progress thru the chapters, the apps and the code get more complex. The code in the book is very accurate and functional. I have spent a few days reading the book and I have downloaded the code from the companion GitHub repository. All the code listed in the book is in the repository. For each chapter in the book, the repository includes design files, a starter project, a completed project and the solutions to the code challenges. I have verified that the completed projects for each chapter build in Xcode without issues.SwiftUI is the core framework taught in this book, but I’d like to give a special mention to the chapter about CloudKit. The author provides step-by-step instructions on how to configure Cloudkit using the CloudKit Dashboard. In the app, there is code to populate the CloudKit database and if you follow all the steps correctly the app will pull the information from iCloud and display it in the app. Very impressive.In summary, this is an excellent book to learn SwiftUI by building real apps. The apps have a very detailed user interface, and the code is very well organized. The book provides detailed explanations of the code and step-by-step guides to configure any extra tools used.I am a professional iOS developer with more than 10 years of development experience. I have contributed to more than 30 published apps in the App Store, some of them with millions of users.Disclaimer: I was contacted by PackT to publish a review of this book, but I did not receive any compensation for it. The opinions are my own.
Amazon Verified review Amazon
Giovanni Noa Dec 13, 2020
Full star icon Full star icon Full star icon Full star icon Full star icon 5
I've really enjoyed SwiftUI Projects so far. I have been looking for a resource to understand how to use Core Data in my apps (have struggled with it for a while now) and I learned a lot from this book's chapters that build with it. You also get to build apps using Combine. Along with building for iPad and WatchOS, I think this is a solid book for any iOS developer looking to ship some apps, build various layouts in SwiftUI, or learn the new Apple frameworks.
Amazon Verified review Amazon
Paul A Dec 29, 2020
Full star icon Full star icon Full star icon Full star icon Empty star icon 4
The approach of the book is to walk you through building apps with SwiftUI. It's accessible, and the end result is good. The explanations are clear - you never feel overwhelmed.There are issues with some references in the book - the worst being 3 pages about a view that has been removed from the source code, and from the rest of the book. They're not huge issues, but they're pretty common.The formatting does make it difficult to follow the code at times, but that's pretty common for e-books on a tablet?I like that design isn't an afterthought and the book walks you through from having the assets from a designer and turning it into code.I'd definitely recommend this book, and would love to see another!
Amazon Verified review Amazon
Get free access to Packt library with over 7500+ books and video courses for 7 days!
Start Free Trial

FAQs

What is the digital copy I get with my Print order? Chevron down icon Chevron up icon

When you buy any Print edition of our Books, you can redeem (for free) the eBook edition of the Print Book you’ve purchased. This gives you instant access to your book when you make an order via PDF, EPUB or our online Reader experience.

What is the delivery time and cost of print book? Chevron down icon Chevron up icon

Shipping Details

USA:

'

Economy: Delivery to most addresses in the US within 10-15 business days

Premium: Trackable Delivery to most addresses in the US within 3-8 business days

UK:

Economy: Delivery to most addresses in the U.K. within 7-9 business days.
Shipments are not trackable

Premium: Trackable delivery to most addresses in the U.K. within 3-4 business days!
Add one extra business day for deliveries to Northern Ireland and Scottish Highlands and islands

EU:

Premium: Trackable delivery to most EU destinations within 4-9 business days.

Australia:

Economy: Can deliver to P. O. Boxes and private residences.
Trackable service with delivery to addresses in Australia only.
Delivery time ranges from 7-9 business days for VIC and 8-10 business days for Interstate metro
Delivery time is up to 15 business days for remote areas of WA, NT & QLD.

Premium: Delivery to addresses in Australia only
Trackable delivery to most P. O. Boxes and private residences in Australia within 4-5 days based on the distance to a destination following dispatch.

India:

Premium: Delivery to most Indian addresses within 5-6 business days

Rest of the World:

Premium: Countries in the American continent: Trackable delivery to most countries within 4-7 business days

Asia:

Premium: Delivery to most Asian addresses within 5-9 business days

Disclaimer:
All orders received before 5 PM U.K time would start printing from the next business day. So the estimated delivery times start from the next day as well. Orders received after 5 PM U.K time (in our internal systems) on a business day or anytime on the weekend will begin printing the second to next business day. For example, an order placed at 11 AM today will begin printing tomorrow, whereas an order placed at 9 PM tonight will begin printing the day after tomorrow.


Unfortunately, due to several restrictions, we are unable to ship to the following countries:

  1. Afghanistan
  2. American Samoa
  3. Belarus
  4. Brunei Darussalam
  5. Central African Republic
  6. The Democratic Republic of Congo
  7. Eritrea
  8. Guinea-bissau
  9. Iran
  10. Lebanon
  11. Libiya Arab Jamahriya
  12. Somalia
  13. Sudan
  14. Russian Federation
  15. Syrian Arab Republic
  16. Ukraine
  17. Venezuela
What is custom duty/charge? Chevron down icon Chevron up icon

Customs duty are charges levied on goods when they cross international borders. It is a tax that is imposed on imported goods. These duties are charged by special authorities and bodies created by local governments and are meant to protect local industries, economies, and businesses.

Do I have to pay customs charges for the print book order? Chevron down icon Chevron up icon

The orders shipped to the countries that are listed under EU27 will not bear custom charges. They are paid by Packt as part of the order.

List of EU27 countries: www.gov.uk/eu-eea:

A custom duty or localized taxes may be applicable on the shipment and would be charged by the recipient country outside of the EU27 which should be paid by the customer and these duties are not included in the shipping charges been charged on the order.

How do I know my custom duty charges? Chevron down icon Chevron up icon

The amount of duty payable varies greatly depending on the imported goods, the country of origin and several other factors like the total invoice amount or dimensions like weight, and other such criteria applicable in your country.

For example:

  • If you live in Mexico, and the declared value of your ordered items is over $ 50, for you to receive a package, you will have to pay additional import tax of 19% which will be $ 9.50 to the courier service.
  • Whereas if you live in Turkey, and the declared value of your ordered items is over € 22, for you to receive a package, you will have to pay additional import tax of 18% which will be € 3.96 to the courier service.
How can I cancel my order? Chevron down icon Chevron up icon

Cancellation Policy for Published Printed Books:

You can cancel any order within 1 hour of placing the order. Simply contact customercare@packt.com with your order details or payment transaction id. If your order has already started the shipment process, we will do our best to stop it. However, if it is already on the way to you then when you receive it, you can contact us at customercare@packt.com using the returns and refund process.

Please understand that Packt Publishing cannot provide refunds or cancel any order except for the cases described in our Return Policy (i.e. Packt Publishing agrees to replace your printed book because it arrives damaged or material defect in book), Packt Publishing will not accept returns.

What is your returns and refunds policy? Chevron down icon Chevron up icon

Return Policy:

We want you to be happy with your purchase from Packtpub.com. We will not hassle you with returning print books to us. If the print book you receive from us is incorrect, damaged, doesn't work or is unacceptably late, please contact Customer Relations Team on customercare@packt.com with the order number and issue details as explained below:

  1. If you ordered (eBook, Video or Print Book) incorrectly or accidentally, please contact Customer Relations Team on customercare@packt.com within one hour of placing the order and we will replace/refund you the item cost.
  2. Sadly, if your eBook or Video file is faulty or a fault occurs during the eBook or Video being made available to you, i.e. during download then you should contact Customer Relations Team within 14 days of purchase on customercare@packt.com who will be able to resolve this issue for you.
  3. You will have a choice of replacement or refund of the problem items.(damaged, defective or incorrect)
  4. Once Customer Care Team confirms that you will be refunded, you should receive the refund within 10 to 12 working days.
  5. If you are only requesting a refund of one book from a multiple order, then we will refund you the appropriate single item.
  6. Where the items were shipped under a free shipping offer, there will be no shipping costs to refund.

On the off chance your printed book arrives damaged, with book material defect, contact our Customer Relation Team on customercare@packt.com within 14 days of receipt of the book with appropriate evidence of damage and we will work with you to secure a replacement copy, if necessary. Please note that each printed book you order from us is individually made by Packt's professional book-printing partner which is on a print-on-demand basis.

What tax is charged? Chevron down icon Chevron up icon

Currently, no tax is charged on the purchase of any print book (subject to change based on the laws and regulations). A localized VAT fee is charged only to our European and UK customers on eBooks, Video and subscriptions that they buy. GST is charged to Indian customers for eBooks and video purchases.

What payment methods can I use? Chevron down icon Chevron up icon

You can pay with the following card types:

  1. Visa Debit
  2. Visa Credit
  3. MasterCard
  4. PayPal
What is the delivery time and cost of print books? Chevron down icon Chevron up icon

Shipping Details

USA:

'

Economy: Delivery to most addresses in the US within 10-15 business days

Premium: Trackable Delivery to most addresses in the US within 3-8 business days

UK:

Economy: Delivery to most addresses in the U.K. within 7-9 business days.
Shipments are not trackable

Premium: Trackable delivery to most addresses in the U.K. within 3-4 business days!
Add one extra business day for deliveries to Northern Ireland and Scottish Highlands and islands

EU:

Premium: Trackable delivery to most EU destinations within 4-9 business days.

Australia:

Economy: Can deliver to P. O. Boxes and private residences.
Trackable service with delivery to addresses in Australia only.
Delivery time ranges from 7-9 business days for VIC and 8-10 business days for Interstate metro
Delivery time is up to 15 business days for remote areas of WA, NT & QLD.

Premium: Delivery to addresses in Australia only
Trackable delivery to most P. O. Boxes and private residences in Australia within 4-5 days based on the distance to a destination following dispatch.

India:

Premium: Delivery to most Indian addresses within 5-6 business days

Rest of the World:

Premium: Countries in the American continent: Trackable delivery to most countries within 4-7 business days

Asia:

Premium: Delivery to most Asian addresses within 5-9 business days

Disclaimer:
All orders received before 5 PM U.K time would start printing from the next business day. So the estimated delivery times start from the next day as well. Orders received after 5 PM U.K time (in our internal systems) on a business day or anytime on the weekend will begin printing the second to next business day. For example, an order placed at 11 AM today will begin printing tomorrow, whereas an order placed at 9 PM tonight will begin printing the day after tomorrow.


Unfortunately, due to several restrictions, we are unable to ship to the following countries:

  1. Afghanistan
  2. American Samoa
  3. Belarus
  4. Brunei Darussalam
  5. Central African Republic
  6. The Democratic Republic of Congo
  7. Eritrea
  8. Guinea-bissau
  9. Iran
  10. Lebanon
  11. Libiya Arab Jamahriya
  12. Somalia
  13. Sudan
  14. Russian Federation
  15. Syrian Arab Republic
  16. Ukraine
  17. Venezuela
Modal Close icon
Modal Close icon