writing declarative, reactive apps with Swift for Apple platforms.
In Apple’s own words: “The Combine framework provides a declarative approach for how your app processes events. Rather than potentially implementing multiple delegate callbacks or completion handler closures, you can create a single processing chain for a given event source. Each part of the chain is a Combine operator that performs a distinct action on the elements received from the previous step.”
Now, imagine you wrote the program in a multi-threaded language that is running an asynchronous event-driven UI framework, like an iOS app running on Swift and UIKit.
--- Thread 1 ---
begin
var name = "Tom"
print(name)
--- Thread 2 ---
name = "Billy Bob"
--- Thread 1 ---
name += " Harding"
print(name)
end
Apple has been continually improving asynchronous programming for their platforms over the years. They’ve created several mechanisms you can use, on different system levels, to create and execute asynchronous code.
Managing mutable state in your app becomes a loaded task once you run asynchronous concurrent code.