Errata
The following mistakes have made their way into the final print edition. Some of these were spotted by readers, my sincerest thanks to them.
Chapter 3: Checking Out The Power Of Xcode
p72: At the end of the page, after the numbered list, the following paragraph and code snippet are missing:
We can now check for the presence of the environment variable in our code.
Update the calculateFullPrice method as follows:
func calculateFullPrice()
{
var currencyString = "$"
let envVars = ProcessInfo.processInfo.environment
if let envVar = envVars["Currency Symbol"]
{
currencyString = envVar
print("Currency Symbol = \(envVar)")
}
let rate = rateTextField.doubleValue / 100.0 + 1.0
let fullPrice = preTaxTextField.doubleValue * rate
resultLabel.stringValue = currencyString
+ String(format: "%.2f", fullPrice)
}
Chapter 5: Advanced Swift
p132: The code snippet is incorrect and should read as follows:
extension GridMovement
{
static func == (lhs: GridMovement, rhs: GridMovement) -> Bool
{
return lhs.rows == rhs.rows && lhs.cols == rhs.cols
}
}