# Combine: Asynchronous Programming with Swift

**URL:** https://forums.kodeco.com/c/books/combine-asynchronous-programming-with-swift/57.md?page=2

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

**Page:** 3

---

## [Chapter 18: Custom Publishers & Backpressure](https://forums.kodeco.com/t/chapter-18-custom-publishers-backpressure/102581)

<div class="topic-metadata">

**Author:** [@elichigo](https://forums.kodeco.com/u/elichigo)\
**Replies:** 3\
**Last updated:** [November 26, 2020, 5:19pm UTC](https://forums.kodeco.com/t/chapter-18-custom-publishers-backpressure/102581 "2020-11-26T17:19:29Z")

</div>

I couldn’t figure out this, in the ShareReplay Publisher(Transformer to be more precise) when I finished I’ve got this output: shareReplay: receive subscription: (PassthroughSubject) shareReplay: request unlimited s…

---

## [Is it good way to use combine to do Post data request?](https://forums.kodeco.com/t/is-it-good-way-to-use-combine-to-do-post-data-request/125180)

<div class="topic-metadata">

**Author:** [@yangwulong1978](https://forums.kodeco.com/u/yangwulong1978)\
**Replies:** 0\
**Last updated:** [November 18, 2020, 4:11am UTC](https://forums.kodeco.com/t/is-it-good-way-to-use-combine-to-do-post-data-request/125180 "2020-11-18T04:11:16Z")

</div>

I know combine can do get request data. which mentioned in the book. so I am wondering ,whether it is good to use combine to do post or ,still using traditional way to post data. I searched google , combine can b…

---

## [Chapter 2: Custom Subscriber](https://forums.kodeco.com/t/chapter-2-custom-subscriber/123792)

<div class="topic-metadata">

**Author:** [@novinfard](https://forums.kodeco.com/u/novinfard)\
**Replies:** 0\
**Last updated:** [October 30, 2020, 10:32am UTC](https://forums.kodeco.com/t/chapter-2-custom-subscriber/123792 "2020-10-30T10:32:31Z")

</div>

I don’t understand why the output of the following code: example(of: "Custom Subscriber") { let publisher = (1...10).publisher final class IntSubscriber: Subscriber { typealias Input = Int typea…

---

## [Pdf version for version 2.0](https://forums.kodeco.com/t/pdf-version-for-version-2-0/122937)

<div class="topic-metadata">

**Author:** [@caribouj](https://forums.kodeco.com/u/caribouj)\
**Replies:** 3\
**Last updated:** [October 26, 2020, 3:43pm UTC](https://forums.kodeco.com/t/pdf-version-for-version-2-0/122937 "2020-10-26T15:43:36Z")

</div>

Hello! Where can I find the .pdf version that you were previously distributing also with the .epub version? Thanks for your reply

---

## [Difficult to Read?](https://forums.kodeco.com/t/difficult-to-read/112592)

<div class="topic-metadata">

**Author:** [@king9671152](https://forums.kodeco.com/u/king9671152)\
**Replies:** 3\
**Last updated:** [October 1, 2020, 5:40am UTC](https://forums.kodeco.com/t/difficult-to-read/112592 "2020-10-01T05:40:44Z")

</div>

Honestly, I don’t enjoy reading this book. It’s the same reason why I didn’t enjoy reading “RxSwift Reactive Programming with Swift.” In fact, this book is just the Combine conversion of the RxSwift book. This book ev…

---

## [Page 109 wrong message](https://forums.kodeco.com/t/page-109-wrong-message/120736)

<div class="topic-metadata">

**Author:** [@yangwulong1978](https://forums.kodeco.com/u/yangwulong1978)\
**Replies:** 0\
**Last updated:** [September 23, 2020, 1:51am UTC](https://forums.kodeco.com/t/page-109-wrong-message/120736 "2020-09-23T01:51:54Z")

</div>

“Charlotte wrote: Hi, I’m Charlotte! James wrote: Hi, I’m James!” should be Hi, I’m Charlotte! Hi, I’m James! if following your code.

---

## [Ch 15: alert(item:) takes a Binding, not a Publisher](https://forums.kodeco.com/t/ch-15-alert-item-takes-a-binding-not-a-publisher/110486)

<div class="topic-metadata">

**Author:** [@rnikander](https://forums.kodeco.com/u/rnikander)\
**Replies:** 2\
**Last updated:** [September 4, 2020, 8:16am UTC](https://forums.kodeco.com/t/ch-15-alert-item-takes-a-binding-not-a-publisher/110486 "2020-09-04T08:16:10Z")

</div>

In chapter 15 the book says: The alert(item:) modifier controls an alert presentation on-screen. It takes a publisher with an optional output called the item. Whenever that publisher emits a non-nil value, it presents …

---

## [DataTaskPublisher to Future or AnyPublisher for API Client method](https://forums.kodeco.com/t/datataskpublisher-to-future-or-anypublisher-for-api-client-method/115829)

<div class="topic-metadata">

**Author:** [@weenzeel](https://forums.kodeco.com/u/weenzeel)\
**Replies:** 2\
**Last updated:** [September 4, 2020, 6:06am UTC](https://forums.kodeco.com/t/datataskpublisher-to-future-or-anypublisher-for-api-client-method/115829 "2020-09-04T06:06:19Z")

</div>

I’ve just finished reading Combine: Asynchronous Programming with Swift. I really enjoyed it. Great disposition, pedagogic and clear, high-quality sample code. Well done! I Really learned a lot! I’m implementing (for th…

---

## [Chapter 15 - moveKeywords trips Fatal error:Index out of range](https://forums.kodeco.com/t/chapter-15-movekeywords-trips-fatal-error-index-out-of-range/107687)

<div class="topic-metadata">

**Author:** [@afrank](https://forums.kodeco.com/u/afrank)\
**Replies:** 1\
**Last updated:** [July 6, 2020, 12:34am UTC](https://forums.kodeco.com/t/chapter-15-movekeywords-trips-fatal-error-index-out-of-range/107687 "2020-07-06T00:34:54Z")

</div>

Calling the ‘moveKeyword’ method in SettingsView causes Xcode to crash while trying to move a List entry by accident when its’ the one and only entry. See Code sample on page 513 where ‘destination’ will be -1. “settin…

---

## [Chaining event handlers, sinks](https://forums.kodeco.com/t/chaining-event-handlers-sinks/107554)

<div class="topic-metadata">

**Author:** [@evs718](https://forums.kodeco.com/u/evs718)\
**Replies:** 1\
**Last updated:** [July 6, 2020, 12:31am UTC](https://forums.kodeco.com/t/chaining-event-handlers-sinks/107554 "2020-07-06T00:31:18Z")

</div>

This is not an issue with the book per se, except in the fact that I wish the book addressed this problem, even if it can not be done. If an event that creates new data occurs in the app, I want that event to be handled …

---

## [Chapter 15; @ObservedObject var model: ReaderViewModel](https://forums.kodeco.com/t/chapter-15-observedobject-var-model-readerviewmodel/107319)

<div class="topic-metadata">

**Author:** [@evs718](https://forums.kodeco.com/u/evs718)\
**Replies:** 2\
**Last updated:** [July 5, 2020, 7:46am UTC](https://forums.kodeco.com/t/chapter-15-observedobject-var-model-readerviewmodel/107319 "2020-07-05T07:46:12Z")

</div>

In the book (version 1.0.3) the author writes on page 280 of the PDF: @ObservedObject var model: ReaderViewModel You don’t inject the model when initializing the view anymore. Instead, you bind the model so that, any t…

---

## [Chapter 15: Challenge 2 - Persisting the filter between app launches](https://forums.kodeco.com/t/chapter-15-challenge-2-persisting-the-filter-between-app-launches/104973)

<div class="topic-metadata">

**Author:** [@taufi](https://forums.kodeco.com/u/taufi)\
**Replies:** 5\
**Last updated:** [July 4, 2020, 3:18am UTC](https://forums.kodeco.com/t/chapter-15-challenge-2-persisting-the-filter-between-app-launches/104973 "2020-07-04T03:18:29Z")

</div>

Persisting doesn’t work because didSet in Settings.keyworks is never called. Does anyone has an idea what goes wrong?

---

## [Chapter 15: SwiftUI with Combine. Hacker News need another View Model](https://forums.kodeco.com/t/chapter-15-swiftui-with-combine-hacker-news-need-another-view-model/99954)

<div class="topic-metadata">

**Author:** [@tatianakornilova](https://forums.kodeco.com/u/tatianakornilova)\
**Replies:** 5\
**Last updated:** [July 3, 2020, 12:02am UTC](https://forums.kodeco.com/t/chapter-15-swiftui-with-combine-hacker-news-need-another-view-model/99954 "2020-07-03T00:02:48Z")

</div>

Usually subscription is not done in SceneDelegate, but in View Model. Also, if you move currentDate from ReaderView as @State to ReaderViewModel as @Published, you can watch the change of stories in Live View. You don…

---

## [Chapter 18: Backpressure and not related to Combine](https://forums.kodeco.com/t/chapter-18-backpressure-and-not-related-to-combine/104853)

<div class="topic-metadata">

**Author:** [@idelfonsog2](https://forums.kodeco.com/u/idelfonsog2)\
**Replies:** 2\
**Last updated:** [April 10, 2020, 6:56pm UTC](https://forums.kodeco.com/t/chapter-18-backpressure-and-not-related-to-combine/104853 "2020-04-10T18:56:58Z")

</div>

what does the following statement means: paused = receiveValue(input) == false Thank you In advance

---

## [Using @FetchRequest](https://forums.kodeco.com/t/using-fetchrequest/100735)

<div class="topic-metadata">

**Author:** [@wilsonilo](https://forums.kodeco.com/u/wilsonilo)\
**Replies:** 4\
**Last updated:** [April 6, 2020, 3:59pm UTC](https://forums.kodeco.com/t/using-fetchrequest/100735 "2020-04-06T15:59:50Z")

</div>

I’ve read the whole book and i loved it. Got stuck in a few parts but in general i’m happy with the content. I just felt a little underwhelmed on the specifics for @FetchRequest so i was hoping someone can help me out w…

---

## [Chapter 14: Hacker News API and printing the completion value](https://forums.kodeco.com/t/chapter-14-hacker-news-api-and-printing-the-completion-value/99906)

<div class="topic-metadata">

**Author:** [@jamieforrest](https://forums.kodeco.com/u/jamieforrest)\
**Replies:** 1\
**Last updated:** [April 1, 2020, 8:39am UTC](https://forums.kodeco.com/t/chapter-14-hacker-news-api-and-printing-the-completion-value/99906 "2020-04-01T08:39:26Z")

</div>

I have copied the code from the book in a Playground, exactly like so: func story(id: Int) -\> AnyPublisher\<Story, Error\> { URLSession.shared.dataTaskPublisher(for: EndPoint.story(id).url) .receive(on: apiQueue…

---

## [replaceNil two implementations](https://forums.kodeco.com/t/replacenil-two-implementations/98459)

<div class="topic-metadata">

**Author:** [@sever7](https://forums.kodeco.com/u/sever7)\
**Replies:** 2\
**Last updated:** [March 31, 2020, 5:06am UTC](https://forums.kodeco.com/t/replacenil-two-implementations/98459 "2020-03-31T05:06:01Z")

</div>

I read Chapter 3 and found it strange that after the replaceNil operator I had to do map with force unwrapping. It turned out that this is because replaceNil has two implementations for Publishers.Sequence. \_ = Just\<In…

---

## [Custom Publishers/Subscribers](https://forums.kodeco.com/t/custom-publishers-subscribers/86003)

<div class="topic-metadata">

**Author:** [@dehesa](https://forums.kodeco.com/u/dehesa)\
**Replies:** 6\
**Last updated:** [March 31, 2020, 4:53am UTC](https://forums.kodeco.com/t/custom-publishers-subscribers/86003 "2020-03-31T04:53:23Z")

</div>

Hi, After reading your book (v0.3), I felt inspired to use Combine in some of my newer projects. Fast forward some weeks and I have written several custom publishers/operators/subscribers. Since at the time I struggled…

---

## [Chapter 6: Throttle, playground results differ from the book results](https://forums.kodeco.com/t/chapter-6-throttle-playground-results-differ-from-the-book-results/97545)

<div class="topic-metadata">

**Author:** [@filiplazov](https://forums.kodeco.com/u/filiplazov)\
**Replies:** 2\
**Last updated:** [March 31, 2020, 2:39am UTC](https://forums.kodeco.com/t/chapter-6-throttle-playground-results-differ-from-the-book-results/97545 "2020-03-31T02:39:45Z")

</div>

Hello, First and foremost, I am really happy with the book and I think you did an outstanding job! I am reading the book and going through all the examples in the playground and I noticed that in Chapter 6 for the thro…

---

## [Testing view models that rely on an asynchronous data source](https://forums.kodeco.com/t/testing-view-models-that-rely-on-an-asynchronous-data-source/95091)

<div class="topic-metadata">

**Author:** [@rustprooffish](https://forums.kodeco.com/u/rustprooffish)\
**Replies:** 1\
**Last updated:** [March 28, 2020, 3:15pm UTC](https://forums.kodeco.com/t/testing-view-models-that-rely-on-an-asynchronous-data-source/95091 "2020-03-28T15:15:19Z")

</div>

I’m building a SwiftUI app that is using the MVVM pattern. The data source for the view models is provided by a custom Publisher for a Realm database. As I’m trying to be good and do a bit of test-driven development, I w…

---

## [AnyCancellable.store(in:) - when and how are these removed](https://forums.kodeco.com/t/anycancellable-store-in-when-and-how-are-these-removed/94568)

<div class="topic-metadata">

**Author:** [@tourultimate](https://forums.kodeco.com/u/tourultimate)\
**Replies:** 2\
**Last updated:** [March 27, 2020, 7:17pm UTC](https://forums.kodeco.com/t/anycancellable-store-in-when-and-how-are-these-removed/94568 "2020-03-27T19:17:43Z")

</div>

Let’s say you are using the built-in .store(in:) method on AnyCancellable like so: example(of: "removeDuplicates") { // 1 let words = "hey hey there! want to listen to mister mister ?" .components…

---

## [Chapter 14. HackerNews](https://forums.kodeco.com/t/chapter-14-hackernews/92628)

<div class="topic-metadata">

**Author:** [@hastoro11](https://forums.kodeco.com/u/hastoro11)\
**Replies:** 3\
**Last updated:** [January 14, 2020, 1:18am UTC](https://forums.kodeco.com/t/chapter-14-hackernews/92628 "2020-01-14T01:18:15Z")

</div>

I have a question here, it seems that some of the operators don’t really sink in my brain. So, in the stories function, when getting the new story ids from the hackernews API, we use the mergedStories function in the .…

---

## [Code error in Chapter 3](https://forums.kodeco.com/t/code-error-in-chapter-3/90198)

<div class="topic-metadata">

**Author:** [@landymagma77](https://forums.kodeco.com/u/landymagma77)\
**Replies:** 1\
**Last updated:** [January 13, 2020, 4:03am UTC](https://forums.kodeco.com/t/code-error-in-chapter-3/90198 "2020-01-13T04:03:44Z")

</div>

\<From version 1.0.2\> In the section “Flattening Publishers”, exampleOf(“flatMap”), item 3 is listed as // 3 chat .sink(receiveValue: { print($0.message.value) }) .store(in: &subscriptions) However to produce t…

---

## [Typo in Chapter 8](https://forums.kodeco.com/t/typo-in-chapter-8/90176)

<div class="topic-metadata">

**Author:** [@insidetheperimeter](https://forums.kodeco.com/u/insidetheperimeter)\
**Replies:** 1\
**Last updated:** [January 13, 2020, 3:53am UTC](https://forums.kodeco.com/t/typo-in-chapter-8/90176 "2020-01-13T03:53:38Z")

</div>

This typo is in the first paragraph of Chapter 8 (v 1.0.1) “But now, it’s time to put those new skills to worthey reached the maximumk and get your hands dirty with a real iOS app.” Excerpt From Combine By Marin Todo…

---

## [Chapter 8 Challenge #1](https://forums.kodeco.com/t/chapter-8-challenge-1/87526)

<div class="topic-metadata">

**Author:** [@vale\_cocoa](https://forums.kodeco.com/u/vale_cocoa)\
**Replies:** 1\
**Last updated:** [January 11, 2020, 6:04pm UTC](https://forums.kodeco.com/t/chapter-8-challenge-1/87526 "2020-01-11T18:04:22Z")

</div>

I was able to have this sort of working with this code: newPhotos .ignoreOutput() .filter { \[unowned self\] \_ in self.images.value.count == 6 } .sink(receiveCompletion: { \[unowned self\] \_ in …

---

## [Chapter 14: HN API - Why do we need "receive(on: apiQueue)"?](https://forums.kodeco.com/t/chapter-14-hn-api-why-do-we-need-receive-on-apiqueue/93207)

<div class="topic-metadata">

**Author:** [@mr16839072](https://forums.kodeco.com/u/mr16839072)\
**Replies:** 5\
**Last updated:** [January 2, 2020, 10:07am UTC](https://forums.kodeco.com/t/chapter-14-hn-api-why-do-we-need-receive-on-apiqueue/93207 "2020-01-02T10:07:08Z")

</div>

private let apiQueue = DispatchQueue(label: "API", qos: .default, attributes: .concurrent) func story(id: Int) -\> AnyPublisher\<Story, Error\> { URLSession.shared .dataTaskPublisher(for: EndPoint.story(id).url) .rec…

---

## [Core Data in Combine](https://forums.kodeco.com/t/core-data-in-combine/87799)

<div class="topic-metadata">

**Author:** [@gjzwart](https://forums.kodeco.com/u/gjzwart)\
**Replies:** 2\
**Last updated:** [November 12, 2019, 6:54am UTC](https://forums.kodeco.com/t/core-data-in-combine/87799 "2019-11-12T06:54:02Z")

</div>

Does the book cover Core Data with Combine?

---

## [Chapter 8: Collage - Clear Function fails](https://forums.kodeco.com/t/chapter-8-collage-clear-function-fails/84599)

<div class="topic-metadata">

**Author:** [@robsnow68](https://forums.kodeco.com/u/robsnow68)\
**Replies:** 2\
**Last updated:** [October 19, 2019, 9:31am UTC](https://forums.kodeco.com/t/chapter-8-collage-clear-function-fails/84599 "2019-10-19T09:31:03Z")

</div>

Loving the early release previews. In the Collage project, the clear function: @IBAction func actionClear() { images.send(\[\]) } …works perfectly when adding the single image. However, as soon as you subscribe to the…

---

## [Combine: Incrementally transforming output, map and flatmap](https://forums.kodeco.com/t/combine-incrementally-transforming-output-map-and-flatmap/82510)

<div class="topic-metadata">

**Author:** [@sproy](https://forums.kodeco.com/u/sproy)\
**Replies:** 2\
**Last updated:** [September 26, 2019, 12:58pm UTC](https://forums.kodeco.com/t/combine-incrementally-transforming-output-map-and-flatmap/82510 "2019-09-26T12:58:26Z")

</div>

The following section seems wrong. “You’ve seen how Combine includes operators such as map that correspond and work similarly to higher-order functions found in the Swift standard library. And you’ve learned about the f…

---

## [PSA: Use Xcode 11 beta 5 for "sneak peek" chapter](https://forums.kodeco.com/t/psa-use-xcode-11-beta-5-for-sneak-peek-chapter/80155)

<div class="topic-metadata">

**Author:** [@rwenderlich](https://forums.kodeco.com/u/rwenderlich)\
**Replies:** 8\
**Last updated:** [September 11, 2019, 1:43pm UTC](https://forums.kodeco.com/t/psa-use-xcode-11-beta-5-for-sneak-peek-chapter/80155 "2019-09-11T13:43:00Z")

</div>

UPDATE 9/11/18: This issue has been fixed in Xcode 11 GM, so if you use that (or the Xcode 11 final release) you should be set! :\] Heads up for those who preordered the Combine book: use Xcode beta 5 if you want to try …

[Previous page](https://forums.kodeco.com/c/books/combine-asynchronous-programming-with-swift/57.md?page=1)

[Next page](https://forums.kodeco.com/c/books/combine-asynchronous-programming-with-swift/57.md?page=3)
