Unidirectional Data Flow
Inherited from ReSwift.
ReSwift is a Redux-like implementation of the unidirectional data flow architecture in Swift. ReSwift helps you to separate three important concerns of your app's components:
- State: in a ReSwift app the entire app state is explicitly stored in a data structure. This helps avoid complicated state management code, enables better debugging and has many, many more benefits...
- Views: in a ReSwift app your views update when your state changes. Your views become simple visualizations of the current app state.
- State Changes: in a ReSwift app you can only perform state changes through actions. Actions are small pieces of data that describe a state change. By drastically limiting the way state can be mutated, your app becomes easier to understand and it gets easier to work with many collaborators.
Go to the repository for more information.
Modularization
In order to use ReSwift, you have to declare a state, a reducer and a store. Then, in most of the cases, the state ends up being spread all around the app, meaning that it's hard to keep the modules as decoupled as you probably want.
That's when Caesura
comes in handy. It encapsulates the state, reducer and store in such way that your only concern is to develop the modules, without them depending on each other. All of that without loosing the capability to stop the app at any moment and get to know the state of the entire app.
So, a simple app would look like:
Check out the usage documentation for more information.
Navigation Router
There is a built-in module based on actions that is as flexible as UIKit is.
Check out the usage documentation for more information.
Time Travel
Have you ever dreamed about traveling back and forth in time? Well, it's not possible yet. But your app can easily do it with an optional built-in module.
Check out the usage documentation for more information.
Crash Tracking
An optional built-in module is capable of detecting crashes and reporting them. Each report contains all the actions dispatched to the store. Therefore, you can replay the exactly same session and discover the reason of such event easily.
Check out the usage documentation for more information.
Session Injection
The last feature wasn't complete without a way of injecting such report without having to do it manually. There is another optional built-in module capable of such thing.
Check out the usage documentation for more information.
ReRxSwift Integration
There is also an optional built-in module to bring the benefits of ReRxSwift into Caesura
.
Similar to react-redux, ReRxSwift allows you to create view controllers that have
props
andactions
. View controllers read all data they need from theirprops
(instead of directly from the state), and they change data by invoking callbacks defined byactions
(instead of directly dispatching ReSwift actions). This has some nice advantages:
- Better separation of concerns. It is easier to understand what your view controller does and what data it uses. In other words, it facilitates local reasoning.
- Unit-testing. Because of the separation of concerns, you can easily unit-test your view controllers, all the way up to the Interface Builder connections.
- Better reusability. Reusing your view controllers is as simple as specifying different mappings from state to
props
and from ReSwift actions toactions
.- Rapid prototyping. You can easily use dummy
props
andactions
so that you get a working UI layer prototype. Without writing any of your application's business logic, you can implement your presentation layer in such a way that it is very simple to replace the dummies with real state and actions.
Check out the usage documentation for more information.
- Xcode 10.0+
- Swift 5.0+
To integrate Caesura
into your project using Swift Package Manager, specify it in your Package.swift
:
// swift-tools-version:5.0
import PackageDescription
let package = Package(
name: "YourPackageName",
dependencies: [
.package(
url: "https://github.com/LucianoPolit/Caesura.git",
.upToNextMajor(from: "1.0.0")
)
],
targets: [
.target(
name: "YourTarget",
dependencies: [
"Caesura",
"CaesuraUI",
"CaesuraStandardAction",
"CaesuraMiddlewares",
"ReRxCaesura"
]
)
]
)
To integrate Caesura
into your project using CocoaPods, specify it in your Podfile
:
pod 'Caesura', '~> 1.0'
pod 'Caesura/Core'
pod 'Caesura/UI'
pod 'Caesura/StandardAction'
pod 'Caesura/Middlewares'
pod 'Caesura/ReRxSwift'
- If you need help, chat with the community.
- If you found a bug, open an issue.
- If you have a feature request, open an issue.
- If you want to contribute, submit a pull request.
Luciano Polit | lucianopolit@gmail.com
Caesura
is available under the MIT license. See the LICENSE file for more info.