Creating this topic to catch any typos and bugs in the 1st Edition of SwiftUI Apprentice!
In Swift Tip box in 1. Checking Your Tools, it should read:
Swift Tip: Swift convention is to name types (like struct
) with PascalCase and properties and methods with camelCase.
(right now, those are both identified as camelCase)
thanks Susannah! I figured not everyone would know that term so I just capitalized camelCase and CamelCase suitably. I’ve updated that note to use lowerCamelCase and UpperCamelCase, which are also valid terms.
Easier to understand than my suggestion too :] Thanks for a fast fix, am loving this book so far!
Chapter 20 UIX Page 526.
The text, as is, will cause a compile error on
.resizableView( transform: bindingTransform(for: element), viewScale: calculateScale(size))
as viewScale is not recognised.
The solution is to add viewScale to the ViewExtensions, as below, and this should be added to page 526.
extension View {
func resizableView(
transform: Binding,
viewScale: CGFloat = 1
) → some View {
modifier(
ResizableView(
transform: transform,
viewScale: viewScale))
}
}
Hi @mazen_kilani! Did you use the starter project as the starter project does already have that code in ViewExtensions.swift?
However, I do see that this change is missed in the description of what’s changed in the starter app at the beginning of the chapter. Thank you for pointing it out.