APP DEVELOPMENT
An App With SCA: Logic
How to transform a SwiftUI project with Swift Composable Architecture
This is the second article of a series on how to write an app using SwiftUI and Swift Composable Architecture by https://pointfree.co.
The first episode can be found here.
In last week's article, we explored how to write the UI of the Snake classic game. We used SwiftUI, the new framework from Apple. In the final code, we had the UI and a first version of the logic. The logic was intertwined in the body
field of our ContentView
: not a really good thing! When we write an app we would like to decouple the UI from the Logic.
There are several solutions that can help here. At Bending Spoons we developed our own framework for that, called Katana. However, as I like to explore new technologies, I want to try a new framework I have been studying in the past months: Swift Composable Architecture (SCA) by https://pointfree.co.
SCA in Pills
Swift Composable Architecture is another Redux-like framework for state management. It shares the same main concepts of this kind of solutions:
- The
state
, which is a structure that holds all the data of the applications. Thestate
is immutable and the…