# Swift Apprentice

**URL:** https://forums.kodeco.com/c/books/swift-apprentice/8.md?page=1

[Latest](https://forums.kodeco.com/latest.md) · [Categories](https://forums.kodeco.com/categories.md) · [Tags](https://forums.kodeco.com/tags.md)

**Page:** 2

---

## [Chapter 7-challenge 10: counts The characters](https://forums.kodeco.com/t/chapter-7-challenge-10-counts-the-characters/134861)

<div class="topic-metadata">

**Author:** [@anzo73](https://forums.kodeco.com/u/anzo73)\
**Replies:** 1\
**Last updated:** [March 12, 2021, 3:32pm UTC](https://forums.kodeco.com/t/chapter-7-challenge-10-counts-the-characters/134861 "2021-03-12T15:32:34Z")

</div>

I do not understand how the line if let count = occurrences\[character\] because count is an Int, and occurrences\[character\] is a Character how the fuction compares a single character of the string to each other?? Dec…

---

## [Errata for Swift Apprentice, 6th ed](https://forums.kodeco.com/t/errata-for-swift-apprentice-6th-ed/121559)

<div class="topic-metadata">

**Author:** [@mandafrederick](https://forums.kodeco.com/u/mandafrederick)\
**Replies:** 12\
**Last updated:** [March 1, 2021, 5:45pm UTC](https://forums.kodeco.com/t/errata-for-swift-apprentice-6th-ed/121559 "2021-03-01T17:45:14Z")

</div>

Creating this topic for bugs, typos, and other mistakes found is Swift Apprentice, 6.0.

---

## [Chapter 16: Protocols](https://forums.kodeco.com/t/chapter-16-protocols/129737)

<div class="topic-metadata">

**Author:** [@kampai32](https://forums.kodeco.com/u/kampai32)\
**Replies:** 1\
**Last updated:** [January 11, 2021, 2:11am UTC](https://forums.kodeco.com/t/chapter-16-protocols/129737 "2021-01-11T02:11:06Z")

</div>

There was another post on here about this section of chapter 16 but its been closed. I’m not super sure what’s going on here. I understand that the variable accountType is a type of Account, and that its set to Bitcoi…

---

## [Chapter 25: wrong Struct Name reference (RugyRecord)](https://forums.kodeco.com/t/chapter-25-wrong-struct-name-reference-rugyrecord/121699)

<div class="topic-metadata">

**Author:** [@hvonweg](https://forums.kodeco.com/u/hvonweg)\
**Replies:** 2\
**Last updated:** [December 31, 2020, 12:39pm UTC](https://forums.kodeco.com/t/chapter-25-wrong-struct-name-reference-rugyrecord/121699 "2020-12-31T12:39:26Z")

</div>

On page 467, where is a small error: struct RugbyRecord: TeamRecord, Tieable { var wins: Int var losses: Int var ties: Int } let rugbyRecord = RugyRecord(wins: 8, losses: 7, ties: 1) rugbyRecord.winningPercentage …

---

## [Chapter 13, Challenge 2](https://forums.kodeco.com/t/chapter-13-challenge-2/124903)

<div class="topic-metadata">

**Author:** [@sampep](https://forums.kodeco.com/u/sampep)\
**Replies:** 2\
**Last updated:** [November 14, 2020, 9:43am UTC](https://forums.kodeco.com/t/chapter-13-challenge-2/124903 "2020-11-14T09:43:18Z")

</div>

Hi, chapter 13 challenge 2 only has class and struct solution, it would be cool to get the full code of a working solucion as well. It’s the one with the T-Shift and shopping cart. Cheers, Sam

---

## [Book is not longer available?](https://forums.kodeco.com/t/book-is-not-longer-available/120404)

<div class="topic-metadata">

**Author:** [@fdorado985](https://forums.kodeco.com/u/fdorado985)\
**Replies:** 15\
**Last updated:** [September 24, 2020, 9:39pm UTC](https://forums.kodeco.com/t/book-is-not-longer-available/120404 "2020-09-24T21:39:29Z")

</div>

I couldn’t download Swift Apprentice book, I tried to look it from my purchases, but it seems the link doesn’t exist, I couldn’t find on the store neither.

---

## [Chapter 2 mini exercise help](https://forums.kodeco.com/t/chapter-2-mini-exercise-help/121974)

<div class="topic-metadata">

**Author:** [@shaogden](https://forums.kodeco.com/u/shaogden)\
**Replies:** 3\
**Last updated:** [October 19, 2020, 5:15pm UTC](https://forums.kodeco.com/t/chapter-2-mini-exercise-help/121974 "2020-10-19T17:15:53Z")

</div>

Hello, I am having problems with the 3 part of the question in the mini exercise. Declare a constant tuple that contains three Int values followed by a Double. Use this to represent a date (month, day, year) followed …

---

## [Chapter3 - challenge 3](https://forums.kodeco.com/t/chapter3-challenge-3/121084)

<div class="topic-metadata">

**Author:** [@riddhi\_ac](https://forums.kodeco.com/u/riddhi_ac)\
**Replies:** 1\
**Last updated:** [September 28, 2020, 4:59pm UTC](https://forums.kodeco.com/t/chapter3-challenge-3/121084 "2020-09-28T16:59:40Z")

</div>

Suppose the squares on a chessboard are numbered left to right, top to bottom, with 0 being the top-left square and 63 being the bottom-right square. Rows are numbered top to bottom, 0 to 7. Columns are numbered left t…

---

## [Problem with IOS Apprentice the free edition](https://forums.kodeco.com/t/problem-with-ios-apprentice-the-free-edition/118398)

<div class="topic-metadata">

**Author:** [@mahmoudmohamedaziz](https://forums.kodeco.com/u/mahmoudmohamedaziz)\
**Replies:** 2\
**Last updated:** [September 19, 2020, 2:27am UTC](https://forums.kodeco.com/t/problem-with-ios-apprentice-the-free-edition/118398 "2020-09-19T02:27:43Z")

</div>

Many lines are appearing like this screenshot, Do I have anything to do with this problem ? Or it’s from the website?

---

## [What does "some" exactly maen in SwiftUI?](https://forums.kodeco.com/t/what-does-some-exactly-maen-in-swiftui/103734)

<div class="topic-metadata">

**Author:** [@maomao](https://forums.kodeco.com/u/maomao)\
**Replies:** 2\
**Last updated:** [July 4, 2020, 1:16am UTC](https://forums.kodeco.com/t/what-does-some-exactly-maen-in-swiftui/103734 "2020-07-04T01:16:01Z")

</div>

I saw this keyword before but I am confused it

---

## [Errata for Swift Apprentice 5th Edition](https://forums.kodeco.com/t/errata-for-swift-apprentice-5th-edition/83647)

<div class="topic-metadata">

**Author:** [@chrisrazeware](https://forums.kodeco.com/u/chrisrazeware)\
**Replies:** 5\
**Last updated:** [January 13, 2020, 6:03am UTC](https://forums.kodeco.com/t/errata-for-swift-apprentice-5th-edition/83647 "2020-01-13T06:03:45Z")

</div>

Found an issue in Swift Apprentice, 5th edition? Post it here!

---

## ["An instance of a structure is an immutable value"?](https://forums.kodeco.com/t/an-instance-of-a-structure-is-an-immutable-value/110400)

<div class="topic-metadata">

**Author:** [@ertugrul](https://forums.kodeco.com/u/ertugrul)\
**Replies:** 1\
**Last updated:** [July 1, 2020, 3:58am UTC](https://forums.kodeco.com/t/an-instance-of-a-structure-is-an-immutable-value/110400 "2020-07-01T03:58:54Z")

</div>

First of all, thank you for the great book, Swift Apprentice. In Swift Apprentice 5th edition, I’ve read the following sentences: “In Swift, an instance of a structure is an immutable value whereas an instance of a cl…

---

## [Why do stack view labels disappear when i make height of one 0, please guide](https://forums.kodeco.com/t/why-do-stack-view-labels-disappear-when-i-make-height-of-one-0-please-guide/105751)

<div class="topic-metadata">

**Author:** [@amitsrivastava](https://forums.kodeco.com/u/amitsrivastava)\
**Replies:** 1\
**Last updated:** [July 1, 2020, 3:49am UTC](https://forums.kodeco.com/t/why-do-stack-view-labels-disappear-when-i-make-height-of-one-0-please-guide/105751 "2020-07-01T03:49:30Z")

</div>

Hi, I have been able to make an UI view appear or disappear depending on width regular or C value , but i came across a problem that i am unable to solve despite many efforts, i had 2 objects in horizontal stack, and i …

---

## [Resources not available](https://forums.kodeco.com/t/resources-not-available/105758)

<div class="topic-metadata">

**Author:** [@jubelbox](https://forums.kodeco.com/u/jubelbox)\
**Replies:** 1\
**Last updated:** [July 1, 2020, 3:46am UTC](https://forums.kodeco.com/t/resources-not-available/105758 "2020-07-01T03:46:11Z")

</div>

It is now a couple of days now, that I have subscribed the beginner lessons. I am following the video lessons of „Your First iOS and SwiftUI app“. Now I stall when learning. In the video Ray speaks about recources which…

---

## [Error in p. 339? (5th Edition)](https://forums.kodeco.com/t/error-in-p-339-5th-edition/110598)

<div class="topic-metadata">

**Author:** [@ertugrul](https://forums.kodeco.com/u/ertugrul)\
**Replies:** 1\
**Last updated:** [July 1, 2020, 3:43am UTC](https://forums.kodeco.com/t/error-in-p-339-5th-edition/110598 "2020-07-01T03:43:37Z")

</div>

“For example, you saw that the Student class can add additional properties and methods to handle a student’s grades. These properties and methods are available to any Person class instances but fully available to Studen…

---

## [Chapter 1 - errata?](https://forums.kodeco.com/t/chapter-1-errata/110485)

<div class="topic-metadata">

**Author:** [@phil](https://forums.kodeco.com/u/phil)\
**Replies:** 1\
**Last updated:** [July 1, 2020, 3:39am UTC](https://forums.kodeco.com/t/chapter-1-errata/110485 "2020-07-01T03:39:06Z")

</div>

Hello, I’m just starting the book, in the chap1 → mini exercises : « Create a constant called testNumber and initialize it with whatever integer you’d like. Next, create another constant called evenOdd and set it equal…

---

## [Confusion with Swift Apprentice 5th edition page 431](https://forums.kodeco.com/t/confusion-with-swift-apprentice-5th-edition-page-431/107489)

<div class="topic-metadata">

**Author:** [@surepic](https://forums.kodeco.com/u/surepic)\
**Replies:** 3\
**Last updated:** [May 28, 2020, 6:24am UTC](https://forums.kodeco.com/t/confusion-with-swift-apprentice-5th-edition-page-431/107489 "2020-05-28T06:24:12Z")

</div>

“In the previous section, you learned how to associate stored and computed properties with instances of a particular type. The properties on your instance of TV are separate from the properties on my instance of TV. How…

---

## [Chapter 16 Protocols](https://forums.kodeco.com/t/chapter-16-protocols/109264)

<div class="topic-metadata">

**Author:** [@noah8610](https://forums.kodeco.com/u/noah8610)\
**Replies:** 1\
**Last updated:** [May 17, 2020, 4:34pm UTC](https://forums.kodeco.com/t/chapter-16-protocols/109264 "2020-05-17T16:34:32Z")

</div>

Could somebody please explain the following line: var accountType: Account.Type = BitcoinAccount.self In the book it is not explained. Account.Type BitcoinAccount.self Thanks!

---

## [Chapter 12 Challenge 2](https://forums.kodeco.com/t/chapter-12-challenge-2/107728)

<div class="topic-metadata">

**Author:** [@surepic](https://forums.kodeco.com/u/surepic)\
**Replies:** 1\
**Last updated:** [May 8, 2020, 8:18pm UTC](https://forums.kodeco.com/t/chapter-12-challenge-2/107728 "2020-05-08T20:18:11Z")

</div>

Challenge 2: A more advanced advance() Here is a naïve way of writing advance() for the SimpleDate structure you saw earlier in the chapter: let months = \["January", "February", "March", "April", "May",…

---

## [Chapter 7 challenge 4](https://forums.kodeco.com/t/chapter-7-challenge-4/106738)

<div class="topic-metadata">

**Author:** [@surepic](https://forums.kodeco.com/u/surepic)\
**Replies:** 6\
**Last updated:** [May 1, 2020, 7:08pm UTC](https://forums.kodeco.com/t/chapter-7-challenge-4/106738 "2020-05-01T19:08:21Z")

</div>

Solution from the book uses insert method to reverse the array which is add at position 0 then shift all the elements to the right 1 time which is O(n). func reversed(\_ array: \[Int\]) -\> \[Int\] { var newArray: \[Int\]…

---

## [Chapter 10 Challenge 2](https://forums.kodeco.com/t/chapter-10-challenge-2/107383)

<div class="topic-metadata">

**Author:** [@surepic](https://forums.kodeco.com/u/surepic)\
**Replies:** 3\
**Last updated:** [May 1, 2020, 4:31pm UTC](https://forums.kodeco.com/t/chapter-10-challenge-2/107383 "2020-05-01T16:31:33Z")

</div>

Problem:Create a T-shirt structure that has size, color and material options. Provide methods to calculate the cost of a shirt based on its attributes. Very poor description of the problem … No rules provided for algor…

---

## [Problem with tuples](https://forums.kodeco.com/t/problem-with-tuples/26333)

<div class="topic-metadata">

**Author:** [@jaclawiciel](https://forums.kodeco.com/u/jaclawiciel)\
**Replies:** 3\
**Last updated:** [January 11, 2020, 3:47pm UTC](https://forums.kodeco.com/t/problem-with-tuples/26333 "2020-01-11T15:47:41Z")

</div>

I practice tuples mini-exercises in Chapter 3 about types and operations. I don’t think that it should behave like that but if I make a mistake somewhere please correct me. When I declare a tuple like so: let dateWit…

---

## [Issue chapter 15](https://forums.kodeco.com/t/issue-chapter-15/80647)

<div class="topic-metadata">

**Author:** [@lac\_ekim](https://forums.kodeco.com/u/lac_ekim)\
**Replies:** 5\
**Last updated:** [October 14, 2019, 7:43pm UTC](https://forums.kodeco.com/t/issue-chapter-15/80647 "2019-10-14T19:43:14Z")

</div>

“Open a new Finder window by clicking on the Desktop and typing ⌘+N (or, by clicking the Finder icon in your dock, if you have one.). Then press ⌘+Shift+G (or, select Go → Go to Folder… from the menu), copy the Documents…

---

## [Little issue with checklist](https://forums.kodeco.com/t/little-issue-with-checklist/80357)

<div class="topic-metadata">

**Author:** [@lac\_ekim](https://forums.kodeco.com/u/lac_ekim)\
**Replies:** 2\
**Last updated:** [August 30, 2019, 8:27pm UTC](https://forums.kodeco.com/t/little-issue-with-checklist/80357 "2019-08-30T20:27:35Z")

</div>

on checklist I’m running into a little issue. Basically I have everything working but it is making two instances rather then one when I hit done. I know its a bone headed move, sorry chapter 13 Checklist.zip (37.3 KB)

---

## [Practical question on merging playground](https://forums.kodeco.com/t/practical-question-on-merging-playground/61592)

<div class="topic-metadata">

**Author:** [@nidupb](https://forums.kodeco.com/u/nidupb)\
**Replies:** 0\
**Last updated:** [February 7, 2019, 1:12am UTC](https://forums.kodeco.com/t/practical-question-on-merging-playground/61592 "2019-02-07T01:12:58Z")

</div>

Hi, I’m practicing swift apprentice in the same playground, but at a certain stage of the book/video, it is becoming useful to use the existing start playground that comes with the video. I’d like to import it within my…

---

## [Feedback : Table of contents within the pdf books](https://forums.kodeco.com/t/feedback-table-of-contents-within-the-pdf-books/62262)

<div class="topic-metadata">

**Author:** [@nidupb](https://forums.kodeco.com/u/nidupb)\
**Replies:** 3\
**Last updated:** [August 21, 2019, 9:33pm UTC](https://forums.kodeco.com/t/feedback-table-of-contents-within-the-pdf-books/62262 "2019-08-21T21:33:13Z")

</div>

Hi, I don’t know if it’s the appropriate place to make a feedback regarding the books, if not, feel free to delete this post. I’m using preview with the pdf ebooks from Ray Wenderlich (it’s not specific to swift appren…

---

## [Error, chapter 5](https://forums.kodeco.com/t/error-chapter-5/78998)

<div class="topic-metadata">

**Author:** [@lac\_ekim](https://forums.kodeco.com/u/lac_ekim)\
**Replies:** 1\
**Last updated:** [August 14, 2019, 9:38pm UTC](https://forums.kodeco.com/t/error-chapter-5/78998 "2019-08-14T21:38:02Z")

</div>

having a issue with new var “difference” “let message = “The value of the slider is: (currentValue)” + “\\nThe target value is: (targetValue)” + "\\nThe difference is: (difference)” Excerpt From: By Fahim Farook. “iOS …

---

## [Chapter 8 closures](https://forums.kodeco.com/t/chapter-8-closures/67818)

<div class="topic-metadata">

**Author:** [@dmitrigrin](https://forums.kodeco.com/u/dmitrigrin)\
**Replies:** 2\
**Last updated:** [August 13, 2019, 3:54pm UTC](https://forums.kodeco.com/t/chapter-8-closures/67818 "2019-08-13T15:54:44Z")

</div>

Hi, While trying to get familiar with closures, I 'm facing other mismatches. No problems with closures functionality. Wonder why playground doesn’t let me run this code:

---

## [Errata for Swift Apprentice 4th Edition](https://forums.kodeco.com/t/errata-for-swift-apprentice-4th-edition/50469)

<div class="topic-metadata">

**Author:** [@rayfix](https://forums.kodeco.com/u/rayfix)\
**Replies:** 35\
**Last updated:** [July 27, 2019, 10:40pm UTC](https://forums.kodeco.com/t/errata-for-swift-apprentice-4th-edition/50469 "2019-07-27T22:40:41Z")

</div>

Creating this topic to catch any typos and bugs in the 4th Edition of Swift Apprentice.

---

## [Chapter 3 Challenges Question 8](https://forums.kodeco.com/t/chapter-3-challenges-question-8/71612)

<div class="topic-metadata">

**Author:** [@leon](https://forums.kodeco.com/u/leon)\
**Replies:** 1\
**Last updated:** [June 30, 2019, 2:09am UTC](https://forums.kodeco.com/t/chapter-3-challenges-question-8/71612 "2019-06-30T02:09:54Z")

</div>

Hi, how can we find the Fibonacci number without using user-defined function?

[Previous page](https://forums.kodeco.com/c/books/swift-apprentice/8.md)

[Next page](https://forums.kodeco.com/c/books/swift-apprentice/8.md?page=2)
