# Errata for SwiftUI by Tutorials 1st Edition

**URL:** <https://forums.kodeco.com/t/errata-for-swiftui-by-tutorials-1st-edition/79655>\
**Category:** SwiftUI by Tutorials\
**Created:** [August 21, 2019, 4:09pm UTC](https://forums.kodeco.com/t/errata-for-swiftui-by-tutorials-1st-edition/79655 "2019-08-21T16:09:37Z")\
**Posts on this page:** 20\
**Page:** 3

<div class="post-metadata">

**Author:** ![tnewton42](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/tnewton42/32/85812_2.png) [@tnewton42](https://forums.kodeco.com/u/tnewton42)\
**Post date:** [October 17, 2019, 1:16am UTC](https://forums.kodeco.com/t/errata-for-swiftui-by-tutorials-1st-edition/79655/44 "2019-10-17T01:16:16Z")

</div>

Note, this is now “Chapter 14” page 420 (iBooks).

> if showDetails {  
> FlightDetails(flight: flight)  
> .offset(x: showDetails ? 0 : -UIScreen.main.bounds.width)  
> }

becomes

> FlightDetails(flight: flight)  
> .offset(x: showDetails ? 0 : -UIScreen.main.bounds.width)

---

<div class="post-metadata">

**Author:** ![mwbeatty](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/mwbeatty/32/110937_2.png) [@mwbeatty](https://forums.kodeco.com/u/mwbeatty)\
**Post date:** [October 19, 2019, 1:19am UTC](https://forums.kodeco.com/t/errata-for-swiftui-by-tutorials-1st-edition/79655/46 "2019-10-19T01:19:24Z")

</div>

I came here for this exact reason. Once I hit the State & Data Flow chapter, I got very confused because it was referencing a completed project and there was no tutorial. I too hope this all to important topic can be expanded to include tutorials.

---

<div class="post-metadata">

**Author:** ![briansipple](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/briansipple/32/105896_2.png) [@briansipple](https://forums.kodeco.com/u/briansipple)\
**Post date:** [October 19, 2019, 8:32am UTC](https://forums.kodeco.com/t/errata-for-swiftui-by-tutorials-1st-edition/79655/47 "2019-10-19T08:32:57Z")

</div>

Also came here to echo this sentiment. I hit Chapter 7 and immediately felt confused about how I should be following along. I’m concerned that anyone new to SwitUI might get lost completely here.

---

<div class="post-metadata">

**Author:** ![swiftlearnerforlife](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/swiftlearnerforlife/32/110937_2.png) [@swiftlearnerforlife](https://forums.kodeco.com/u/swiftlearnerforlife)\
**Post date:** [October 19, 2019, 5:51pm UTC](https://forums.kodeco.com/t/errata-for-swiftui-by-tutorials-1st-edition/79655/48 "2019-10-19T17:51:24Z")

</div>

Hi All - enjoyed going through the book. Found a fair few errors / things that IMO should have been updated for the v1 release to maintain RW standard. Feels like this release was slightly rushed and amazed so many issues got passed the editors.

Page 20  
_SwiftUI surely follow the same path_  
_SwiftUI **will** surely follow the same path_

Page 25

```auto
#if DEBUG
struct ContentView_Previews : PreviewProvider {
  static var previews: some View {
    ContentView()
  }
} #endif 

struct ContentView_Previews : PreviewProvider {
  static var previews: some View {
    ContentView()
  }
}

```

Page 27  
Xcode 11 beta  
Xcode 11

Page 27  
Picture needs to be updated to not have #if DEBUG statement

Page 34  
Scroll down to the DEBUG block - DEBUG is no longer needed

Page 39  
Top Picture has #if DEBUG

Page 40 - Note - Xcode 11 is no longer beta

P 62  
_@Binding var is a reference to the data, so it doesn’t need initialization_  
_@Binding var is a reference to the data, so it doesn’t need a default value_

Part of me thinks this should say default value instead. It still needs to be initialised in the struct init

P77  
_Below the import SwiftUI statement, import UIKit_  
No need to import UIKit as SwiftUI imports it

p80  
`view.value = Float(self.value) `  
`uiView.value = Float(self.value)`

`self.value.value = Double(sender.value)`  
`self.value.wrappedValue = Double(sender.value)`

P81  
_so value.value_  
_so value.wrappedValue_

P117 - p118  
The same image is used twice. Should only be shown once.

P126  
_but you’ll go into scaling more in- depth in in the next chapter as well as in Chapter 16, “Expanding the UI”_  
There is no chapter 16 or a chapter called Expanding the UI

P127  
The text for .border image  
`.border(Color.gray, width: 1, cornerRadius: size / 2)`  
`.border(Color.gray, width: 1)`

P137  
_This is a huge help to people who eyesight issues or visual impairments._  
_This is a huge help to people **with** eyesight issues or visual impairments._

_You’ll learn more about fonts and accessibility in Chapter 16, “Expanding the UI”_  
There is no chapter 16 or a chapter called Expanding the UI

P142  
_ **If you need a fresh project to continue** , locate the starter project for this chapter and open it up._  
_Locate the starter project for this chapter and open it up._

In chapter 6 - there is no registerView and so a user will need to use the starter project

P154  
You’ll begin with your _SceneDelegate_ .swift\*  
You’ll begin with your _SceneDelegate_ .swift

P155  
After changing the practiceStore PropertyWrapper in ChallengeView from an @EnvironmentObject to an @ObservedObject the init for ChallengeView in PractiveView and in ChallengeView\_Previews needs to be updated. Probably worth mentioning to reader.

P161  
_This is a pattern that’s used frequently and often recommended Apple **,**._  
_This is a pattern that’s used frequently and often recommended **by** Apple_

P164

```auto
VStack(content: {
    WelcomeMessageView()
})

VStack {
    WelcomeMessageView()
}

```

p166  
`@State var name: String = “”`  
`@State private var name: String = “”`

P189  
`Text("\(slider)")`  
`Text("\(amount)")`

P191  
_Refactoring and reusing views are two important aspects that should never be neglected **nr** forgotten_  
_Refactoring and reusing views are two important aspects that should never be neglected **or** forgotten_

P200  
_The differences between this and the **the** case of views with a single child that you’ve seen in the previous section are highlighted in bold text_  
_The differences between this and the case of views with a single child that you’ve seen in the previous section are highlighted in bold text_

P219  
`@State var showAnswers = false`  
`@State private var showAnswers = false`

P219  
_For this to work, you also need a custom initializer to pass in the challenge test and assign it to the property._  
This initializer is provided by default from the ChallengeView struct

P220  
`self.showAnswers = !self.showAnswers`  
`self.showAnswers.toggle()`

P224  
Why are `FlightHistory` and `FlightInformation` subclasses of NSObject ??

```auto
class FlightInformation: NSObject {}		
class FlightHistory: NSObject {}
		
final class FlightInformation { }
final class FlightHistory { }

```

P235

```auto
ScrollView {
  VStack {
    Text("\(fl.airline) \(fl.number)") 
    Text("\(fl.flightStatus) at \(fl.currentTimeString)") 
    Text("At gate \(fl.gate)")
  } 
}

ScrollView {
  ForEach(flightData) { flight in
    VStack {
      Text("\(flight.airline) \(flight.number)")
      Text("\(flight.flightStatus) at \(flight.currentTimeString)")
      Text("At gate \(flight.gate)")
    }
  }
}

```

P238  
_You now need to set the title for this view in the view stack._  
_You now need to set the title for this view in the view stack and delete the Text View at the top of the VStack._

P242

```auto
.navigationBarItems(trailing: 
  Toggle(isOn: $hideCancelled, label: { 
    Text("Hide Canceled")
  })
)

.navigationBarItems(trailing: 
  Toggle(isOn: $hideCancelled, label: { 
    Text("Hide Cancelled")
  })
)

```

P251  
Image at bottom is missing the destructive reschedule now option in the action sheet

P259  
_They should be near line 125_  
_They should be near line **118** _

P267  
_You’ll learn more about accessibility in Chapter 15, “Expanding the UI.”_  
Chapter 15 is not called Expanding the UI

P273  
_Chapter 16, " **Expanding the UI**"_  
There is no chapter 16 or a chapter called Expanding the UI

P278  
No mention about opening the new starter project

P281  
`var id = UUID()`  
`let id = UUID()`

P282  
_You created a deck previously for the Practice feature of the app as a simple array of cards, but the Learn feature has different needs so you’re going to be more explicit with the how the deck **words** this time._

_You created a deck previously for the Practice feature of the app as a simple array of cards, but the Learn feature has different needs so you’re going to be more explicit with the how the deck **works** this time._

I do not remember ever creating a deck as a practice feature earlier on.

P291  
`self.revealed = !self.revealed`  
`self.revealed.toggle()`

P294  
_ **Essentiallym** this means the component would move right and up on the screen to match the motion of the users finger_

_ **Essentially** this means the component would move right and up on the screen to match the motion of the users finger_

p296  
`@GestureState var isLongPressed = false`  
`@GestureState private var isLongPressed = false`

P313  
_Open **AirportAwards.swift** and add the following code below the first award and above the spacer_

There has been no Spacer added to AirportAwards

---

<div class="post-metadata">

**Author:** ![audrey](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/audrey/32/111607_2.png) [@audrey](https://forums.kodeco.com/u/audrey)\
**Post date:** [October 22, 2019, 12:04am UTC](https://forums.kodeco.com/t/errata-for-swiftui-by-tutorials-1st-edition/79655/49 "2019-10-22T00:04:07Z")

</div>

Thanks Piers, well spotted! I’ve fixed my chapters for the next update 👍

---

<div class="post-metadata">

**Author:** ![harshalbhatt](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/harshalbhatt/32/93582_2.png) [@harshalbhatt](https://forums.kodeco.com/u/harshalbhatt)\
**Post date:** [October 22, 2019, 8:16am UTC](https://forums.kodeco.com/t/errata-for-swiftui-by-tutorials-1st-edition/79655/50 "2019-10-22T08:16:26Z")

</div>

Fully agreed. My sentiments are very much similar. Feeling confused while reading the chapter 7. The chapter 8 starts with chapter 6 “Finished” . The book needs some thorough review work or udpates in near future .

---

<div class="post-metadata">

**Author:** ![leeweisern](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/leeweisern/32/81494_2.png) [@leeweisern](https://forums.kodeco.com/u/leeweisern)\
**Post date:** [October 22, 2019, 8:26am UTC](https://forums.kodeco.com/t/errata-for-swiftui-by-tutorials-1st-edition/79655/51 "2019-10-22T08:26:23Z")

</div>

Hi,

I am going through Chapter 8. It seems the SwiftUI has some changes? I double check by running the final project. Here you can see the ‘remember me’. Even though it is `.trailing` the UI shows `.leading`

```
    Toggle(isOn: $userManager.settings.rememberUser) {
      Text("Remember me")
        .font(.subheadline)
        .multilineTextAlignment(.trailing)
        .foregroundColor(.gray)
    }
  }

```

![55](https://files.chunter.kodeco.com/original/3X/0/c/0c5901e91babe771ee0e30fbfb0233329acd0ade.jpeg)

---

<div class="post-metadata">

**Author:** ![swiftlearnerforlife](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/swiftlearnerforlife/32/110937_2.png) [@swiftlearnerforlife](https://forums.kodeco.com/u/swiftlearnerforlife)\
**Post date:** [October 22, 2019, 10:07am UTC](https://forums.kodeco.com/t/errata-for-swiftui-by-tutorials-1st-edition/79655/52 "2019-10-22T10:07:11Z")

</div>

Nice! As mentioned previously really appreciate RW and the authors of this book. Just want to help maintain RW standard as its the best place to learn iOS IMO and wished I had just known about and used RW and not gone to an expensive coding bootcamp to initially learn iOS.

Look forward to the updated edition.

---

<div class="post-metadata">

**Author:** ![jnjsjmiller](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/jnjsjmiller/32/105896_2.png) [@jnjsjmiller](https://forums.kodeco.com/u/jnjsjmiller)\
**Post date:** [October 22, 2019, 11:49am UTC](https://forums.kodeco.com/t/errata-for-swiftui-by-tutorials-1st-edition/79655/53 "2019-10-22T11:49:56Z")

</div>

Chapter 3 - iBooks page 48 - embedding the top-level VStack in a NavigationView resulted in the view no longer being displayed in landscape view on an iPhone. For this to work properly, it seems that we need to set the NavigationViewStyle.

var body: some View {  
NavigationView {  
VStack { … }  
}.navigationViewStyle(StackNavigationViewStyle())  
}

---

<div class="post-metadata">

**Author:** ![audrey](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/audrey/32/111607_2.png) [@audrey](https://forums.kodeco.com/u/audrey)\
**Post date:** [October 22, 2019, 12:07pm UTC](https://forums.kodeco.com/t/errata-for-swiftui-by-tutorials-1st-edition/79655/54 "2019-10-22T12:07:20Z")

</div>

thanks! I noticed this today and I’ll fix it for the next update.

I think the change happened in a later beta…

I actually get better results with:

```
NavigationView {
  VStack {
     ...
  }
   .navigationBarTitle("", displayMode: .inline)
   .navigationBarHidden( true )
}

```

It doesn’t seem like you’d need both of these, but it doesn’t work if you comment out one or the other. And the navigation bar doesn’t really go away ☹.

---

<div class="post-metadata">

**Author:** ![kbgrilling](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/kbgrilling/32/81494_2.png) [@kbgrilling](https://forums.kodeco.com/u/kbgrilling)\
**Post date:** [October 22, 2019, 1:51pm UTC](https://forums.kodeco.com/t/errata-for-swiftui-by-tutorials-1st-edition/79655/55 "2019-10-22T13:51:57Z")

</div>

Chapter 3 page 72 "“Then remove the padding from the HStack in ColorSlider.swift, so the view looks like this:” Should ColorSlider.swift be listed as ContentView.swift?

---

<div class="post-metadata">

**Author:** ![audrey](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/audrey/32/111607_2.png) [@audrey](https://forums.kodeco.com/u/audrey)\
**Post date:** [October 22, 2019, 11:40pm UTC](https://forums.kodeco.com/t/errata-for-swiftui-by-tutorials-1st-edition/79655/56 "2019-10-22T23:40:18Z")

</div>

hi Kenny! thanks for noticing this — it should be “the `ColorSlider` view”. I’m not sure how that **.swift** got in there 😕

the correction will be in the next update.

---

<div class="post-metadata">

**Author:** ![jeden](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/jeden/32/110971_2.png) [@jeden](https://forums.kodeco.com/u/jeden)\
**Post date:** [October 27, 2019, 12:13am UTC](https://forums.kodeco.com/t/errata-for-swiftui-by-tutorials-1st-edition/79655/57 "2019-10-27T00:13:02Z")

</div>

> [@swiftlearnerforlife](#):
>
> Found a fair few errors / things

Thanks a lot for reporting all these errors. I’ve updated my chapters

---

<div class="post-metadata">

**Author:** ![jeden](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/jeden/32/110971_2.png) [@jeden](https://forums.kodeco.com/u/jeden)\
**Post date:** [October 27, 2019, 12:29am UTC](https://forums.kodeco.com/t/errata-for-swiftui-by-tutorials-1st-edition/79655/58 "2019-10-27T00:29:03Z")

</div>

Thanks for reporting this. The text alignment is actually superfluous here, because the Text is sized to fit its content, so there’s no alignment at all, at least as long as the text is on a single line. I’ve removed that line from both the project and the code snippet in the book.

What changed instead is the behavior of the `Spacer()` that precedes the `Toggle()`: it should “push” the toggle, and the text label it contains, to the right, as shown in the corresponding screenshot included in the book - It looks like the spacer behavior has changed with the latest Xcode release (either 11.0 or 11.1), now the spacer has a small fixed width instead.

---

<div class="post-metadata">

**Author:** ![swiftlearnerforlife](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/swiftlearnerforlife/32/110937_2.png) [@swiftlearnerforlife](https://forums.kodeco.com/u/swiftlearnerforlife)\
**Post date:** [October 30, 2019, 11:48am UTC](https://forums.kodeco.com/t/errata-for-swiftui-by-tutorials-1st-edition/79655/59 "2019-10-30T11:48:35Z")

</div>

Thanks for your hard work. Learn’t a lot from your chapters.

---

<div class="post-metadata">

**Author:** ![darrellr](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/darrellr/32/102075_2.png) [@darrellr](https://forums.kodeco.com/u/darrellr)\
**Post date:** [November 2, 2019, 11:57pm UTC](https://forums.kodeco.com/t/errata-for-swiftui-by-tutorials-1st-edition/79655/60 "2019-11-02T23:57:53Z")

</div>

Minor typo but the title page for the “complex interfaces” chapter says chapter 14, when it should say chapter 15. That also means I’m almost done 😉

---

<div class="post-metadata">

**Author:** ![audrey](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/audrey/32/111607_2.png) [@audrey](https://forums.kodeco.com/u/audrey)\
**Post date:** [November 3, 2019, 6:39am UTC](https://forums.kodeco.com/t/errata-for-swiftui-by-tutorials-1st-edition/79655/61 "2019-11-03T06:39:11Z")

</div>

congratulations Darrell!

the chapter title is correct in version 1.0.1

---

<div class="post-metadata">

**Author:** ![rpitman](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/rpitman/32/109024_2.png) [@rpitman](https://forums.kodeco.com/u/rpitman)\
**Post date:** [November 20, 2019, 7:27pm UTC](https://forums.kodeco.com/t/errata-for-swiftui-by-tutorials-1st-edition/79655/62 "2019-11-20T19:27:41Z")

</div>

Chapter 2, page 24. Create a new project screenshot: “Use SwiftUI” is no longer a checkbox.

---

<div class="post-metadata">

**Author:** ![audrey](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/audrey/32/111607_2.png) [@audrey](https://forums.kodeco.com/u/audrey)\
**Post date:** [November 20, 2019, 10:49pm UTC](https://forums.kodeco.com/t/errata-for-swiftui-by-tutorials-1st-edition/79655/63 "2019-11-20T22:49:23Z")

</div>

thanks! I’ll fix it for the next update.

---

<div class="post-metadata">

**Author:** ![tanderza](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/tanderza/32/102075_2.png) [@tanderza](https://forums.kodeco.com/u/tanderza)\
**Post date:** [November 23, 2019, 1:50pm UTC](https://forums.kodeco.com/t/errata-for-swiftui-by-tutorials-1st-edition/79655/64 "2019-11-23T13:50:23Z")

</div>

Do you know more or less when the next update will be available?

[Previous page](https://forums.kodeco.com/t/errata-for-swiftui-by-tutorials-1st-edition/79655.md?page=2)

[Next page](https://forums.kodeco.com/t/errata-for-swiftui-by-tutorials-1st-edition/79655.md?page=4)
