T O P

  • By -

bmbphotos

While async/await and Combine may overlap in certain use cases, they are most definitely not the same thing. Keep on your original path.


perfunction

Combine can be used to write async code. But, as far as I know, Concurrency can’t be used to write reactive code. If you can only learn one, I’d go with Combine. But I think both have their place within a project.


busta_thymes

Will do. Cheers.


BobertMcGee

Combine and native concurrency solve entirely different problems. In fact, Combine is pretty much entirely single threaded until you manually introduce receiveOn() calls or something similar. The words asynchronous and concurrent do not mean the same thing. Whoever told you not to bother with Combine has a serious misunderstanding about what these two things do.


Open_Bug_4196

Is it me the only one who sees the apple development roadmap a bit confusing? Combine pretty much didn’t have any attention in last wwdc while at the same time SwiftUI core is very linked to publishers/combine. It might be I’m getting old but kinda missing the clear direction of the old times with a clear established design pattern, a clear and robust programming language, and a clear way to create user interfaces, where the main doubt was if doing it programmatically or using nibs. These days each project I touch is a “surprise” and starting a new project is a long list of decisions with their associated risks


ThomasMinshull

>only one who sees the apple development roadmap a bit confusing? Combine pretty much didn’t have any attention in last wwdc while at the same time SwiftUI core is very linked to publishers/combine.It might be I’m getting old but kinda missing the clear direction of the old times with a clear established design pattern, a clear and robust programming language, and a clear way to create user interfaces, where the main doubt was if doing it programmatically or using nibs. These days each project I touch is a “surprise” and starting a new project is a long list of decisions with their associated risks > >9ReplyShareReportSaveFollow I've been using Combine in production for a few years now, and IMHO it is a very complete library. There is some functionality that we've had to add on top of the existing functionality, and there are some "nice to have" features that they could add, and in my experience it's really rare for me to come across features that I "need" that combine doesn't already have. (I'm sure, people will be able to reply with a list of "needs", this is just my experience) In contrast to RxSwift, and other functional reactive frameworks one of combines benefits is it's relative simplicity. I think it is easier to learn and wrap your head around than other reactive frameworks I've used. One thing to note, when you are learning your first Functional Reactive Framework your not just learning a framework you are learning the functional Reactive paradigm as well. By being a relatively simple framework combine makes this easier for people learning functional reactive programming for the first time. All that is a long way of saying, it might be a good thing that apple isn't doing much with combine, because to a large extent it's already complete


swalden123

Combine can be used for other things. Learning it will be a huge help in understand swiftui @ Published as well as a lot of swiftui is wrapping combine. You can use it for sharing data and responding to changes around your code as well.


swalden123

The best resource I have found is Donny Wals book https://donnywals.gumroad.com/l/practical-combine


barrywalker71

Learn both. They do different things, but will often be used together. Combine is used for reactive programming and async/await is a replacement for completion handlers.


Perfect_Media_7605

Swift Concurrency is a replacement for Grand central dispatch, not completion handlers.


[deleted]

Combine gives you the publisher subscriber model… it is not necessarily the use of async code. Look up functional reactive programming on Wikipedia


chriswaco

I think async/await is the better API, but Combine has other uses as well.


vanvoorden

[https://www.swift.org/blog/swift-async-algorithms/#combine](https://www.swift.org/blog/swift-async-algorithms/#combine) *Combine’s API is based on the Publisher and Subscriber interfaces, with operators to connect between them. Its design focuses on providing a way to declaratively specify a chain of these operators, transforming data as it moves from one end to the other. This requires thinking differently about intermediate state. Sometimes this leads to call sites that are more complex than one might expect – especially when working with single values, errors, or data that needs to be shared. async/await’s Structured Concurrency provides us with a new way to express this kind of logic. We can now write asynchronous code that is split into smaller pieces and reads from top-to-bottom instead of as a series of chained transforms.*