I really love the old cover
Hi there, I really love the old book cover. 2 posts - 2 participants Read full topic
View ArticleChapter 8.1 help with .assign(to:)
When I add the line to func bindMainView() - .assign(to: &imagePreview) I get the following error: Cannot convert value of type ‘UIImage?’ to expected argument type...
View ArticleAssign operator can cause a strong reference cycle
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 3...
View ArticleReturn subscription on subscribe
I’m trying to figure out how Apple’s own sink subscriber (more specifically, the sink extension on Publisher) is able to subscribe and then immediately return its subscription. Combine does offer a...
View Article[Coombine][Publishers] how to use maxPublishers
not sure the following logic will create three publishers? [1,2,3].publisher [1,2,3,4].publisher .flatMap(maxPublishers: .max(1)) { result in change(result) }.sink { result in print(result)...
View Article[Combine]subscribe method
I know publisher has a method subscribe(_ subject: Subject) let arrPublisher = [1,2,3,4].publisher let tester = PassthroughSubject<Int, Never>() arrPublisher.sink { result in print(result)...
View Article[Combine]throttle bug?
let subject = PassthroughSubject<String, Never>() let throttled = subject.throttle(for: .seconds(10), scheduler: DispatchQueue.main, latest: false) throttled.sink(receiveValue: {print($0,...
View ArticleChapter 15.9 EnvironmentObject usage
Here is the moment at the end of the chapter, that describes “you need to add EnvironmentObject to ReaderView”: One as a property - @EnvironmentObject var settings: Settings Second as pass param to...
View ArticleChap 2: Understanding what's going on
Under the above heading you explain: 3. A subscriber calls subscribe(_:) on a publisher to attach to it. 4. The implementation of subscribe(_:) will call receive(subscriber:) to attach the subscriber...
View ArticleDebounce unit test
Hello, Let’s suppose we have a a string as a published property in our view model. We subscribe to this published property in our view model and use different combine operators. One of these operators...
View ArticleChapter 14.3: Complexity vs easier alternative?
When I first read the task for mergedStories I initially thought about using a flatMap and wondered about the complexity used in that function (creating array, remainder, merge). So I tried a...
View ArticleChapter 15: Lots of warnings
I’m following the text, adding to the starter/HNReader.xcodeproj Looking for the first numbers to appear when adding .onAppear method, I find my debug output cluttered with lots of warnings (I’m on...
View ArticleChapter 18: Purpose of .max(1)
In chapter 18, when defining the DispatchTimerSubscription you use self.requested -= .max(1) self.timer -= .max(1) and I wonder what .max(1) actually does and why it’s needed. I imaging it creates a...
View ArticleWhy do publishers subscribe instead of subscribers?
Hello, Could someone please help me understand why linguistically a publisher connects to a subscriber instead of the other way around? For example in Chapter 2: Custom Subscriber, we do: let...
View ArticleQuestion for Combine: Asynchronous Programming with Swift
Hello I am studying Combine with the book, and I have questions on Chapter 18. There is a description like below, and I can not understand what it means. Specifically on bold text. Use the handy...
View ArticleCharter 18 error: Publisher is only available in iOS 13.0
‘Publisher’ is only available in iOS 13.0 or newer extension Publisher { help me please 3 posts - 3 participants Read full topic
View ArticleChild view-models state management with SwiftUI and Combine
This is more of an opinion/architecture question, with questions that arose out of chapter 15 from the Combine + SwiftUI book. I have a rather larger screen that I am building with SwiftUI and...
View ArticleWhat is different between Async/Await, Combine, Closures?
Hello Kodeco team, Like the question in the title, I really wonder why apple built so many solutions for concurrency? difference between them? When should it apply? nghiaphamsg 3 posts - 2...
View ArticleHow KVO options really works (.old and .new)?
I don’t understand how .old and .new options work. Would anyone have an example to show? 1 post - 1 participant Read full topic
View ArticleErrata for Combine: Asynchronous Programming With Swift 4th Edition
Creating this topic to catch any typos and bugs in the 4th Edition of Combine: Asynchronous Programming With Swift. 2 posts - 1 participant Read full topic
View Article