# 📚 Official Books

**URL:** https://forums.kodeco.com/c/books/6.md?page=33

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

**Page:** 34

---

## [Error in chapter 2 on try anAsset.export(to: aURL)](https://forums.kodeco.com/t/error-in-chapter-2-on-try-anasset-export-to-aurl/161690)

<div class="topic-metadata">

**Author:** [@kuldip\_wagh](https://forums.kodeco.com/u/kuldip_wagh)\
**Replies:** 2\
**Last updated:** [January 10, 2022, 2:45pm UTC](https://forums.kodeco.com/t/error-in-chapter-2-on-try-anasset-export-to-aurl/161690 "2022-01-10T14:45:19Z")

</div>

Facing Error on line 49, not able to export the mesh (Please refer to the image). Could you please tell me, how to fix this?

---

## [Chapter 11: package is using Swift tools version 5.4.0 but the installed version is 5.2.0 docker](https://forums.kodeco.com/t/chapter-11-package-is-using-swift-tools-version-5-4-0-but-the-installed-version-is-5-2-0-docker/161526)

<div class="topic-metadata">

**Author:** [@mobven](https://forums.kodeco.com/u/mobven)\
**Replies:** 5\
**Last updated:** [January 8, 2022, 3:03pm UTC](https://forums.kodeco.com/t/chapter-11-package-is-using-swift-tools-version-5-4-0-but-the-installed-version-is-5-2-0-docker/161526 "2022-01-08T15:03:56Z")

</div>

Hi everyone, I’m trying to run this command in terminal; docker-compose -f docker-compose-testing.yml up --abort-on-container-exit. Everything looks fine but except I have an error package is using Swift tools version 5.…

---

## [How to change alignment in MemoryLayout](https://forums.kodeco.com/t/how-to-change-alignment-in-memorylayout/161564)

<div class="topic-metadata">

**Author:** [@richmond\_jam](https://forums.kodeco.com/u/richmond_jam)\
**Replies:** 0\
**Last updated:** [January 7, 2022, 9:10am UTC](https://forums.kodeco.com/t/how-to-change-alignment-in-memorylayout/161564 "2022-01-07T09:10:28Z")

</div>

Hello, in Swift We can get a default alignment value of Struct like this: MemoryLayout.alignment Now ,if I wanna change the value how to do it?

---

## [Chapter 11 - \_buildRecipeList uses different types of BuildContext](https://forums.kodeco.com/t/chapter-11-buildrecipelist-uses-different-types-of-buildcontext/161476)

<div class="topic-metadata">

**Author:** [@zwenn](https://forums.kodeco.com/u/zwenn)\
**Replies:** 4\
**Last updated:** [January 7, 2022, 6:20am UTC](https://forums.kodeco.com/t/chapter-11-buildrecipelist-uses-different-types-of-buildcontext/161476 "2022-01-07T06:20:46Z")

</div>

Hey there in chapter 11 at the end a method called \_buildRecipeList is introduced that takes a kind of custom BuildContext called ‘recipeListContext’. This context is used only at the end of that method when returning …

---

## [Chapter 3, 2nd Edition - Comment](https://forums.kodeco.com/t/chapter-3-2nd-edition-comment/161542)

<div class="topic-metadata">

**Author:** [@naplesdave](https://forums.kodeco.com/u/naplesdave)\
**Replies:** 1\
**Last updated:** [January 7, 2022, 4:19am UTC](https://forums.kodeco.com/t/chapter-3-2nd-edition-comment/161542 "2022-01-07T04:19:29Z")

</div>

I just wanted to say that I really enjoyed Chapter 3. I learned a bunch. I hope some of it sticks in my mind :blush:

---

## [Chapter 2, 2nd, ed question](https://forums.kodeco.com/t/chapter-2-2nd-ed-question/161448)

<div class="topic-metadata">

**Author:** [@naplesdave](https://forums.kodeco.com/u/naplesdave)\
**Replies:** 1\
**Last updated:** [January 6, 2022, 10:11pm UTC](https://forums.kodeco.com/t/chapter-2-2nd-ed-question/161448 "2022-01-06T22:11:56Z")

</div>

I am following along and in Chapter 2 it instructs me to replace some code in the BUILD section. I did that. But my App Bar Text is left aligned now, not centered as shown in the screen pic? What is wrong here? Here is m…

---

## [Chapter 11: Testing categories](https://forums.kodeco.com/t/chapter-11-testing-categories/157808)

<div class="topic-metadata">

**Author:** [@hvaftrudner](https://forums.kodeco.com/u/hvaftrudner)\
**Replies:** 7\
**Last updated:** [January 6, 2022, 4:55pm UTC](https://forums.kodeco.com/t/chapter-11-testing-categories/157808 "2022-01-06T16:55:16Z")

</div>

When i copied the categories tests and try to run them I get the error : failed - typeMismatch(Swift.String, Swift.DecodingError.Context(codingPath: \[ModelCodingKey(stringValue: “name”, intValue: nil)\], debugDescription…

---

## [What is the syntax to filter a dictionary item?](https://forums.kodeco.com/t/what-is-the-syntax-to-filter-a-dictionary-item/161421)

<div class="topic-metadata">

**Author:** [@randyf](https://forums.kodeco.com/u/randyf)\
**Replies:** 1\
**Last updated:** [January 6, 2022, 10:55am UTC](https://forums.kodeco.com/t/what-is-the-syntax-to-filter-a-dictionary-item/161421 "2022-01-06T10:55:14Z")

</div>

In my migration I have an “address” dictionary .field("address", .dictionary, .required) With the following dictionary items address1 address2 city state zip I tried a number of filter combinations tha…

---

## [Chapter 11 difficulty level was too high](https://forums.kodeco.com/t/chapter-11-difficulty-level-was-too-high/161508)

<div class="topic-metadata">

**Author:** [@hosami](https://forums.kodeco.com/u/hosami)\
**Replies:** 2\
**Last updated:** [January 5, 2022, 1:46pm UTC](https://forums.kodeco.com/t/chapter-11-difficulty-level-was-too-high/161508 "2022-01-05T13:46:11Z")

</div>

This chapter was extremely advanced. In my view, the author is explaining concepts or steps to someone who already knows what is going on or what all the various things are about. As a beginner, I would find this useless…

---

## [Chapter9 about the key "nonisolated"](https://forums.kodeco.com/t/chapter9-about-the-key-nonisolated/161511)

<div class="topic-metadata">

**Author:** [@anon58552229](https://forums.kodeco.com/u/anon58552229)\
**Replies:** 1\
**Last updated:** [January 5, 2022, 7:53am UTC](https://forums.kodeco.com/t/chapter9-about-the-key-nonisolated/161511 "2022-01-05T07:53:38Z")

</div>

About nonisolated key. Still not very clear. func store(image: UIImage, forKey key: String) async throws { guard let data = image.pngData() else { throw "Could not save image \\(key)" } let fileName = DiskStora…

---

## [Chapter 1 - Section 4 (Challenge part)](https://forums.kodeco.com/t/chapter-1-section-4-challenge-part/161482)

<div class="topic-metadata">

**Author:** [@hegazy](https://forums.kodeco.com/u/hegazy)\
**Replies:** 1\
**Last updated:** [January 4, 2022, 7:10pm UTC](https://forums.kodeco.com/t/chapter-1-section-4-challenge-part/161482 "2022-01-04T19:10:15Z")

</div>

SwiftUI doesn’t support putting a targetEnvironment() condition within the modifiers to a view. I think this is outdated right? now we can use targetEnvironment() condition within the modifiers to a view.

---

## [withThrowingTaskGroup](https://forums.kodeco.com/t/withthrowingtaskgroup/161478)

<div class="topic-metadata">

**Author:** [@anon58552229](https://forums.kodeco.com/u/anon58552229)\
**Replies:** 2\
**Last updated:** [January 4, 2022, 4:48am UTC](https://forums.kodeco.com/t/withthrowingtaskgroup/161478 "2022-01-04T04:48:05Z")

</div>

I want to confirm a question. basically in this method. it allows writing some “try” functions when we want to implement concurrent handling. but if one of the functions throws an error. all of remaining tasks will be …

---

## [Chap 29 \[Domain\] not in scope](https://forums.kodeco.com/t/chap-29-domain-not-in-scope/161483)

<div class="topic-metadata">

**Author:** [@marvmax](https://forums.kodeco.com/u/marvmax)\
**Replies:** 0\
**Last updated:** [January 3, 2022, 9:37pm UTC](https://forums.kodeco.com/t/chap-29-domain-not-in-scope/161483 "2022-01-03T21:37:24Z")

</div>

I imported SwiftUI like the book demo does when I type in func fetchDomains() async throws -\> \[Domain\] { \[\] // Fill in the implementation later } I get “Cannot find type ‘Domain’ in scope” with the D in the \[Domain\] …

---

## [2nd Ed, Chapter 3, Basic Widgets, Themes](https://forums.kodeco.com/t/2nd-ed-chapter-3-basic-widgets-themes/161467)

<div class="topic-metadata">

**Author:** [@naplesdave](https://forums.kodeco.com/u/naplesdave)\
**Replies:** 0\
**Last updated:** [January 3, 2022, 3:19am UTC](https://forums.kodeco.com/t/2nd-ed-chapter-3-basic-widgets-themes/161467 "2022-01-03T03:19:36Z")

</div>

I followed all the code to the end of the first part of establishing the theme and my AppBar Title text is left aligned. I added the centerTitle: true. to the AppBar Widget to fix this. see below. home: Scaffold( …

---

## [What is the difference dispose( ) & removelistener( )?](https://forums.kodeco.com/t/what-is-the-difference-dispose-removelistener/161047)

<div class="topic-metadata">

**Author:** [@belalgamal](https://forums.kodeco.com/u/belalgamal)\
**Replies:** 1\
**Last updated:** [January 2, 2022, 2:32pm UTC](https://forums.kodeco.com/t/what-is-the-difference-dispose-removelistener/161047 "2022-01-02T14:32:21Z")

</div>

i couldn’t understand the difference between dispose()and removelistener() and when to use them, any help please? what is the difference when i say controller.dispose(); and controller.removelistener(); ?

---

## [The black magic in 3.5 Protocol-oriented programming: Getting fancy with extensions](https://forums.kodeco.com/t/the-black-magic-in-3-5-protocol-oriented-programming-getting-fancy-with-extensions/141658)

<div class="topic-metadata">

**Author:** [@maczealot](https://forums.kodeco.com/u/maczealot)\
**Replies:** 1\
**Last updated:** [June 6, 2021, 8:12pm UTC](https://forums.kodeco.com/t/the-black-magic-in-3-5-protocol-oriented-programming-getting-fancy-with-extensions/141658 "2021-06-06T20:12:43Z")

</div>

I agree with the author, Marin Bencevic, that this is some Swift Extension black magic going on. Can some help me understand the magic that connects the Array extension: extension Array: URLSessionDecodable where Eleme…

---

## [Chapter 36: Small bug in the Adjacency list example](https://forums.kodeco.com/t/chapter-36-small-bug-in-the-adjacency-list-example/143521)

<div class="topic-metadata">

**Author:** [@remshams](https://forums.kodeco.com/u/remshams)\
**Replies:** 1\
**Last updated:** [December 31, 2021, 6:20am UTC](https://forums.kodeco.com/t/chapter-36-small-bug-in-the-adjacency-list-example/143521 "2021-12-31T06:20:25Z")

</div>

The example image/graph at the start of the Adjacency list section lists Singapore twice as destination for Hong Kong. Should be San Francisco if I am not mistaken. Just saw it when going through the chapter (maybe it i…

---

## [Where do I download the Sources Folder?](https://forums.kodeco.com/t/where-do-i-download-the-sources-folder/93009)

<div class="topic-metadata">

**Author:** [@chuisummer](https://forums.kodeco.com/u/chuisummer)\
**Replies:** 3\
**Last updated:** [December 31, 2021, 6:07am UTC](https://forums.kodeco.com/t/where-do-i-download-the-sources-folder/93009 "2021-12-31T06:07:33Z")

</div>

Hi, I have the this book in epub format but I don’t know where to download the Sources Folder from. Is there a download link?

---

## [Chapter 10: Trees](https://forums.kodeco.com/t/chapter-10-trees/159824)

<div class="topic-metadata">

**Author:** [@fonz101](https://forums.kodeco.com/u/fonz101)\
**Replies:** 1\
**Last updated:** [December 31, 2021, 5:59am UTC](https://forums.kodeco.com/t/chapter-10-trees/159824 "2021-12-31T05:59:47Z")

</div>

I looked through the book and the code repo, and I could not find the implementation for description property for TreeNode.

---

## [Challenges should be improved](https://forums.kodeco.com/t/challenges-should-be-improved/144474)

<div class="topic-metadata">

**Author:** [@bryanlid](https://forums.kodeco.com/u/bryanlid)\
**Replies:** 1\
**Last updated:** [December 31, 2021, 2:27am UTC](https://forums.kodeco.com/t/challenges-should-be-improved/144474 "2021-12-31T02:27:23Z")

</div>

Perhaps I have a misunderstanding on what the book’s intention. I am under the assumption from: A book that teaches you the fundamental tools of implementing key data structures in Kotlin, and how to use them to solve…

---

## [There is no guarantee as to which thread your task will execute against](https://forums.kodeco.com/t/there-is-no-guarantee-as-to-which-thread-your-task-will-execute-against/161400)

<div class="topic-metadata">

**Author:** [@brower](https://forums.kodeco.com/u/brower)\
**Replies:** 1\
**Last updated:** [December 29, 2021, 11:42pm UTC](https://forums.kodeco.com/t/there-is-no-guarantee-as-to-which-thread-your-task-will-execute-against/161400 "2021-12-29T23:42:59Z")

</div>

At 2.GCD vs. Operations, under Grand Central Dispatch, there is a box that says in it: “Note: There is no guarantee as to which thread your task will execute against.” On the other hand, on Apple’s Developer Documentat…

---

## [Docker / postgres + environment variables \> next book iteration?](https://forums.kodeco.com/t/docker-postgres-environment-variables-next-book-iteration/161413)

<div class="topic-metadata">

**Author:** [@mynona](https://forums.kodeco.com/u/mynona)\
**Replies:** 0\
**Last updated:** [December 29, 2021, 7:43pm UTC](https://forums.kodeco.com/t/docker-postgres-environment-variables-next-book-iteration/161413 "2021-12-29T19:43:29Z")

</div>

Please include in the next version of the book also help if there are issues with creating the docker container. It didn’t work for me and it took me a couple of hours to figure the problem out and this seems to be a com…

---

## [Definition of "thread"?](https://forums.kodeco.com/t/definition-of-thread/161402)

<div class="topic-metadata">

**Author:** [@brower](https://forums.kodeco.com/u/brower)\
**Replies:** 0\
**Last updated:** [December 29, 2021, 6:18pm UTC](https://forums.kodeco.com/t/definition-of-thread/161402 "2021-12-29T18:18:14Z")

</div>

How does this book define “thread”. I think there are different ways that word has been used and some confusion by the people that use that word.

---

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

<div class="topic-metadata">

**Author:** [@jellodiil](https://forums.kodeco.com/u/jellodiil)\
**Replies:** 3\
**Last updated:** [December 28, 2021, 12:34am UTC](https://forums.kodeco.com/t/errata-for-swift-apprentice-7th-edition/154966 "2021-12-28T00:34:21Z")

</div>

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

---

## [Await for loop in book chapter4](https://forums.kodeco.com/t/await-for-loop-in-book-chapter4/161054)

<div class="topic-metadata">

**Author:** [@anon58552229](https://forums.kodeco.com/u/anon58552229)\
**Replies:** 1\
**Last updated:** [December 27, 2021, 7:13am UTC](https://forums.kodeco.com/t/await-for-loop-in-book-chapter4/161054 "2021-12-27T07:13:38Z")

</div>

for await \_ in await NotificationCenter.default .notifications(for: UIApplication.willResignActiveNotification) { } why here. before NotificationCenter.default there is an “await” also ? for await \_ in {AsyncSteam} s…

---

## [Assign operator can cause a strong reference cycle](https://forums.kodeco.com/t/assign-operator-can-cause-a-strong-reference-cycle/155775)

<div class="topic-metadata">

**Author:** [@anon58552229](https://forums.kodeco.com/u/anon58552229)\
**Replies:** 2\
**Last updated:** [December 27, 2021, 2:27am UTC](https://forums.kodeco.com/t/assign-operator-can-cause-a-strong-reference-cycle/155775 "2021-12-27T02:27:26Z")

</div>

assign(to: \\.word, on: self) and storing the resulting AnyCancellable results in a strong reference cycle. Replacing assign(to:on:) with assign(to: &$word) prevents this problem not sure why

---

## [Challenge 2: It’s prime time](https://forums.kodeco.com/t/challenge-2-it-s-prime-time/153601)

<div class="topic-metadata">

**Author:** [@ahmednagy](https://forums.kodeco.com/u/ahmednagy)\
**Replies:** 1\
**Last updated:** [November 8, 2021, 1:22pm UTC](https://forums.kodeco.com/t/challenge-2-it-s-prime-time/153601 "2021-11-08T13:22:38Z")

</div>

Can someone explain how this function works please? func isPrime(\_ number: Int) -\> Bool { if number \< 0 { return false } /\* We handle these cases up front because we want to make sure the range 2...root …

---

## [Chapter: 42 Dijkstra Algo](https://forums.kodeco.com/t/chapter-42-dijkstra-algo/161034)

<div class="topic-metadata">

**Author:** [@ankurprakash](https://forums.kodeco.com/u/ankurprakash)\
**Replies:** 0\
**Last updated:** [December 25, 2021, 2:30pm UTC](https://forums.kodeco.com/t/chapter-42-dijkstra-algo/161034 "2021-12-25T14:30:34Z")

</div>

As in Book we have OR check in Dikstra Algo, while creating hash of preferred edges and we are not maintaining VISITED NODE, So i guess this will work even for negative weights also. Downside is that it will loop over al…

---

## [Completely red screen in Chapter 2 after changing to .point](https://forums.kodeco.com/t/completely-red-screen-in-chapter-2-after-changing-to-point/155549)

<div class="topic-metadata">

**Author:** [@makoren](https://forums.kodeco.com/u/makoren)\
**Replies:** 2\
**Last updated:** [December 23, 2021, 7:26pm UTC](https://forums.kodeco.com/t/completely-red-screen-in-chapter-2-after-changing-to-point/155549 "2021-12-23T19:26:49Z")

</div>

The starter code for chapter 2 works totally fine, but if I change .triangle to .point where instructed, I get some variation of this screen when I’m supposed to get a sphere that’s made of points: I also tried this w…

---

## [Chapter 8 - Instruments shows me nothing](https://forums.kodeco.com/t/chapter-8-instruments-shows-me-nothing/20990)

<div class="topic-metadata">

**Author:** [@bunschoten](https://forums.kodeco.com/u/bunschoten)\
**Replies:** 6\
**Last updated:** [May 30, 2017, 4:25pm UTC](https://forums.kodeco.com/t/chapter-8-instruments-shows-me-nothing/20990 "2017-05-30T16:25:28Z")

</div>

Hello World, I’m trying to profile the EmployeeDirectory app in the Simulator using the CoreData Instruments, as described on Page 207 in the Swift 3 release of the book. So my Simulator and the Profiler are already op…

[Previous page](https://forums.kodeco.com/c/books/6.md?page=32)

[Next page](https://forums.kodeco.com/c/books/6.md?page=34)
