Swift Apprentice

Chapter 19, page 301 in the book (not PDF reference page number):

It says to import UUID? What exactly are you talking about? How do you go about doing this?

Also, you cannot move forward in the playground as there are errors before John and Jane can write a check? Would you please clarify this?

Please allow me to make several recommendations:

  1. Please have an “ERRATA” for all books in the future in 1 place on the site for updates with explanations where it is clearly labeled and easy to access. One should not have to scan all over the place in the forums to find answers for ERRATA’s.
  2. Consider using one author for a book instead of many with Swift Apprentice. For example: chapter 19 author must have assumed importing UUID was already written and explained in the book. Another example is the language each author uses. For example: you use properties and instances interchangeably without explaining this from the beginning. I had to read Apple’s book as well as watch Stanford’s iOS course where it was explained in one sentence. It wasn’t until late in the book that I could figure out what you meant by instance and property. Also, some do a better job than others in explaining content, yet good stuff :slight_smile:
  3. Consider making challenge questions related to the current chapter rather than having future material in the current challenge questions. When one doesn’t know the future material, it makes one search in the current chapter with much time spent looking for answers when they thought they had missed when it wasn’t covered at all. Also, provide more exercises to re-enforce the material at hand rather than create difficult questions right off the bat that can discourage a person’s learning. I found some of the reading of iOS apprentice clarify a lot of missing pieces in this book when I feel the topics should have be clarified in the Swift book. iOS book has one author and does a great job explaining the material whereas explanations of the fundamentals in the Swift book were left out. This goes back to having many authors rather than one author fully understanding what content was covered and how it was explained.

Anyhow, without writing a book, I thought I would provide my two sense for future students while getting my answers so I can finish the book “Swift Apprentice.”

Thank you!

You should import the Foundation framework in order to work with the UUID class like this:

import Foundation

You can find the book’s current version errata page over here:

We will definitely take your valuable feedback into account when and while we update the book for Swift 4, Xcode 9 and iOS 11 after all for sure and for good indeed. In the meantime, please post any other questions or issues regarding the book in its corresponding thread over here instead:

Thank you! :]

Thanks for getting back and quickly too.

Allow me to clarify this: Is this where it’s talking about source files on page 303 in the book? If so, notice on page 301 to try the code, but you can’t because there are errors? If so, you may want to put this before rather than after. Why? Kinda like putting the cart before the horse as I’m being asked to do something and its not working, but if I continue, the material will be clear. In the meantime, the code won’t be clear because there are errors and so I’m trying to figure out the error when there really isn’t an error as I have to jump to page 303, but the I’m back at page 301 trying to figure out where the error is? Does this make sense?

I thought I would have had to create a swift file and import it that way, but I would have never known that if I hadn’t been doing the iOS apprentice book. See my point? Should have been in book before page 301 in explanation so the code works and flows accordingly.

Thank you for the heads up and pointing this one out - much appreciated! :]

I’m trying to do the following code:

let johnChecking = CheckingAccount()
johnChecking.deposit(amount: 300.00)

write a check and do the janeChecking … but I get errors.

I have tried this code in the main file as well as the Account.swift and Checking.swift and all I get are errors. Please advise on where to enter this code.

Thank you so much!

You actually add everything to the playground’s main file after all. Please check out how it’s all done in the chapter’s corresponding final playground in the book’s project files folder and let me know if you still have any other and more questions or issues regarding the whole thing afterwards. Thank you! :]

oh duh! Yep, should have gone to the project files and looked there. Shame on me for the stupidity. I must have anal glaucoma, I just didn’t see my a*s looking that far into it.

Thanks for you help! You guys rock!! Have a great day!

Really glad you sorted everything out after all! :]

When I open the “final” playground for chapter 19 of the Swift_Apprentice_v2.0 in Xcode 8.3.3, MacOS 10.12.6 I get the Error “Encountered invalid state (5) upon execution”. If I switch the playground settings from “iOS” to “macOS” the problem goes away.

Is there a way of fixing this problem?

Also, on page 283 and in the “final playground” the code given is:

func withdraw(amount: Dollars) {
if amount > balance {
balance -= amount
} else {
balance = 0 }
}

In the func withdraw, if the amount is greater than the balance the amount gets subtracted from the balance sending the balance negative. Shouldn’t the “>” be “<”?

Thank you for the heads up - much appreciated! We will definitely fix the whole thing after all when we update the book for Swift 4 and Xcode 9.

This topic was automatically closed after 166 days. New replies are no longer allowed.