# 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:** 1

<div class="post-metadata">

**Author:** ![rwenderlich](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/rwenderlich/32/108604_2.png) [@rwenderlich](https://forums.kodeco.com/u/rwenderlich)\
**Post date:** [August 21, 2019, 4:09pm UTC](https://forums.kodeco.com/t/errata-for-swiftui-by-tutorials-1st-edition/79655/1 "2019-08-21T16:09:37Z")

</div>

Creating this topic to catch any typos and bugs in the 1st Edition of SwiftUI by Tutorials.

---

<div class="post-metadata">

**Author:** ![rwenderlich](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/rwenderlich/32/108604_2.png) [@rwenderlich](https://forums.kodeco.com/u/rwenderlich)\
**Post date:** [August 21, 2019, 4:11pm UTC](https://forums.kodeco.com/t/errata-for-swiftui-by-tutorials-1st-edition/79655/2 "2019-08-21T16:11:33Z")

</div>



---

<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:** [August 23, 2019, 7:33pm UTC](https://forums.kodeco.com/t/errata-for-swiftui-by-tutorials-1st-edition/79655/3 "2019-08-23T19:33:23Z")

</div>

Chapter 1: do the naming conventions for the guessing and target colors need to be abbreviated? Its good practice to not do this for clarity and for the sake of an extra few letters may as well be written in full in my opinion.

---

<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:** [August 23, 2019, 7:48pm UTC](https://forums.kodeco.com/t/errata-for-swiftui-by-tutorials-1st-edition/79655/4 "2019-08-23T19:48:59Z")

</div>

Chapter 1: isn’t the body of the View protocol a property? A few times in chapter 1 it is referred to as a closure.

---

<div class="post-metadata">

**Author:** ![ruptapas](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/ruptapas/32/81494_2.png) [@ruptapas](https://forums.kodeco.com/u/ruptapas)\
**Post date:** [August 27, 2019, 9:57pm UTC](https://forums.kodeco.com/t/errata-for-swiftui-by-tutorials-1st-edition/79655/5 "2019-08-27T21:57:23Z")

</div>

Hi Ray,

Is there plans for some chapters devoted to Apple Watch & Apple TV. Because as per the keynote SwiftUI helps in easily developing apps for those platforms as well.

Thank you & Regards  
Ruptapas

---

<div class="post-metadata">

**Author:** ![rwenderlich](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/rwenderlich/32/108604_2.png) [@rwenderlich](https://forums.kodeco.com/u/rwenderlich)\
**Post date:** [August 28, 2019, 4:36pm UTC](https://forums.kodeco.com/t/errata-for-swiftui-by-tutorials-1st-edition/79655/6 "2019-08-28T16:36:11Z")

</div>

@ruptapas We don’t have any plans to include chapters on Apple Watch & Apple TV in this edition of the book - but we can consider this for future editions. You can see the full list of chapters planned for the book here: [https://store.raywenderlich.com/products/swiftui-by-tutorials](https://store.raywenderlich.com/products/swiftui-by-tutorials)

---

<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:** [August 29, 2019, 1:13pm UTC](https://forums.kodeco.com/t/errata-for-swiftui-by-tutorials-1st-edition/79655/7 "2019-08-29T13:13:26Z")

</div>

hi Piers: the letters r, g, b refer to the RGB color space, as does the app name RGBullsEye.

---

<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:** [September 4, 2019, 6:15am UTC](https://forums.kodeco.com/t/errata-for-swiftui-by-tutorials-1st-edition/79655/8 "2019-09-04T06:15:35Z")

</div>

fair enough! fixed in Early Access 2 — thanks!

---

<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:** [September 4, 2019, 6:55am UTC](https://forums.kodeco.com/t/errata-for-swiftui-by-tutorials-1st-edition/79655/9 "2019-09-04T06:55:20Z")

</div>

Awesome! Btw I did really enjoy chapter 1 so I hope I didn’t come across too negative. Really excited to get the completed book. Keep up the great work.  
Thanks

---

<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:** [September 5, 2019, 12:05am UTC](https://forums.kodeco.com/t/errata-for-swiftui-by-tutorials-1st-edition/79655/10 "2019-09-05T00:05:32Z")

</div>

thanks! keep up the great questions 😀

---

<div class="post-metadata">

**Author:** ![sbcooney](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/sbcooney/32/102075_2.png) [@sbcooney](https://forums.kodeco.com/u/sbcooney)\
**Post date:** [September 10, 2019, 2:00pm UTC](https://forums.kodeco.com/t/errata-for-swiftui-by-tutorials-1st-edition/79655/12 "2019-09-10T14:00:09Z")

</div>

This is far from an error or something that is necessary, but in Chapter 2, I think it would help to briefly state _why_ showAlert will revert back to false after the alert is dismissed. It seems small, but when you’re new to declarative programming, these small differences are pretty big!

---

<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:** [September 11, 2019, 3:43am UTC](https://forums.kodeco.com/t/errata-for-swiftui-by-tutorials-1st-edition/79655/13 "2019-09-11T03:43:49Z")

</div>

thanks @sbcooney!

Just before you add the `showAlert` variable, I say the value resets to `false` when the user dismisses the alert, but I’m not sure what you mean by “why” … it’s so the alert stops being shown — do you think I should make that clearer?

---

<div class="post-metadata">

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

</div>

I think it was really just the use of the word “reset” instead of set- as if it would be set somehow to its initial state when the window was dismissed instead of just being set to false by alert(ispresented:… .

---

<div class="post-metadata">

**Author:** ![sbcooney](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/sbcooney/32/102075_2.png) [@sbcooney](https://forums.kodeco.com/u/sbcooney)\
**Post date:** [September 11, 2019, 5:37pm UTC](https://forums.kodeco.com/t/errata-for-swiftui-by-tutorials-1st-edition/79655/15 "2019-09-11T17:37:20Z")

</div>

In Chapter 13, page 114 in the current version, the top code snippet shouldn’t have “if showDetails {” in it as that condition is replaced by ".offset(x: showDetails ? 0 : -UIScreen.main.bounds.width).

---

<div class="post-metadata">

**Author:** ![macdevtll](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/macdevtll/32/102075_2.png) [@macdevtll](https://forums.kodeco.com/u/macdevtll)\
**Post date:** [September 15, 2019, 11:47am UTC](https://forums.kodeco.com/t/errata-for-swiftui-by-tutorials-1st-edition/79655/16 "2019-09-15T11:47:21Z")

</div>

“When the details should not hidden, then the view shifts UIScreen.main.bounds.width — the width of the current screen — to the left, ensuring it is not visible.”

I believe it should start with “When details should **be** hidden, …”

---

<div class="post-metadata">

**Author:** ![macdevtll](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/macdevtll/32/102075_2.png) [@macdevtll](https://forums.kodeco.com/u/macdevtll)\
**Post date:** [September 15, 2019, 11:52am UTC](https://forums.kodeco.com/t/errata-for-swiftui-by-tutorials-1st-edition/79655/17 "2019-09-15T11:52:02Z")

</div>

Removing and combining animations:  
Adding `.animation(nil)` between scale and rotation changes nothing - both effects still animated. Have you actually tried it? I just did (XCode 11 GM Seed).

---

<div class="post-metadata">

**Author:** ![bmorefield](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/bmorefield/32/111506_2.png) [@bmorefield](https://forums.kodeco.com/u/bmorefield)\
**Post date:** [September 15, 2019, 4:03pm UTC](https://forums.kodeco.com/t/errata-for-swiftui-by-tutorials-1st-edition/79655/18 "2019-09-15T16:03:03Z")

</div>

Thanks. I’ll work to get that updated for the next release.

---

<div class="post-metadata">

**Author:** ![bmorefield](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/bmorefield/32/111506_2.png) [@bmorefield](https://forums.kodeco.com/u/bmorefield)\
**Post date:** [September 15, 2019, 4:20pm UTC](https://forums.kodeco.com/t/errata-for-swiftui-by-tutorials-1st-edition/79655/19 "2019-09-15T16:20:13Z")

</div>

Thanks! I’ll get that fixed.

The animation issue is a change in how the views interact from the beta where this was originally written. It causes the later animation to always be applied. I’ll rework this section for the next update. For now change the code so it looks more like this:

```
HStack {
  Text(showDetails ? "Hide Details" : "Show Details")
  Spacer()
  Button(action: {
    self.showDetails.toggle()
  }) {
    Image(systemName: "chevron.up.square")
      .scaleEffect(showDetails ? 2 : 1)
      .animation(nil)
      .rotationEffect(.degrees(showDetails ? 0 : 180))
      .animation(.easeInOut)
  }
}
```

---

<div class="post-metadata">

**Author:** ![macdevtll](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/macdevtll/32/102075_2.png) [@macdevtll](https://forums.kodeco.com/u/macdevtll)\
**Post date:** [September 15, 2019, 6:51pm UTC](https://forums.kodeco.com/t/errata-for-swiftui-by-tutorials-1st-edition/79655/20 "2019-09-15T18:51:47Z")

</div>

BTW, it might be my own opinion but code snippets in the books (I’m reading SwiftUI and Catalyst) are just… awful, sorry. Style is almost unreadable – you copy/paste first it to xcode, then prettify, and only then it start having sense.

---

<div class="post-metadata">

**Author:** ![gilroykilroy](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/gilroykilroy/32/100770_2.png) [@gilroykilroy](https://forums.kodeco.com/u/gilroykilroy)\
**Post date:** [September 16, 2019, 9:09pm UTC](https://forums.kodeco.com/t/errata-for-swiftui-by-tutorials-1st-edition/79655/21 "2019-09-16T21:09:59Z")

</div>

FlightBoardInformation.swift fails to render in Preview (Xcode GM Seed 2). The crash says:

Application Specific Information:  
Fatal error: Accessing State outside View.body: file /BuildRoot/Library/Caches/com.apple.xbs/Sources/Monoceros\_Sim/Monoceros-24.4/Core/State.swift, line 44

CoreSimulator 681.5.1 - Device: iPhone 11 Pro Max (1062039B-020C-4D62-B2D0-BD3BBD51A0B8) - Runtime: iOS 13.0 (17A577a) - DeviceType: iPhone 11 Pro Max

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread  
0 libswiftCore.dylib 0x00007fff50a9c7ed specialized _assertionFailure(_:_:file:line:flags:) + 509  
1 libswiftCore.dylib 0x00007fff50894a09 assertionFailure(:_:file:line:flags:) + 25  
2 com.apple.SwiftUI 0x00007fff2bfefca6 State.location.getter + 230  
3 com.apple.SwiftUI 0x00007fff2bfef6d7 State.getValue(forReading:) + 103  
4 com.apple.SwiftUI 0x00007fff2bff02aa State.projectedValue.getter + 58  
5 com.raywenderlich.MountainAirport 0x000000010c633d18 static FlightBoardDetail\_Previews.$isPresented.getter + 168  
6 FlightBoardInformation.2.preview-thunk.dylib 0x0000000114fcb038 static FlightBoardDetail\_Previews.\_\_preview\_\_previews.getter + 232  
7 com.raywenderlich.MountainAirport 0x000000010c633f08 static FlightBoardDetail\_Previews.previews.getter + 56 (FlightBoardInformation.swift:77)  
8 com.raywenderlich.MountainAirport 0x000000010c6340c9 protocol witness for static PreviewProvider.previews.getter in conformance FlightBoardDetail\_Previews + 9  
9 com.apple.SwiftUI 0x00007fff2c13d335 static PreviewProvider.\_previews.getter + 69  
10 com.raywenderlich.MountainAirport 0x000000010c634126 protocol witness for static \_PreviewProvider.\_previews.getter in conformance FlightBoardDetail\_Previews + 54  
11 com.apple.SwiftUI 0x00007fff2c13d609 static \_PreviewProvider.\_allPreviews.getter + 25

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