All Projects → weegigs → Swiftea

weegigs / Swiftea

Licence: mit
Bits of the Elm Architecture in Swift for iOS, MacOS and SwiftUI

Programming Languages

swift
15916 projects

Projects that are alternatives of or similar to Swiftea

ReMVVM
ReMVVM is an application architecture concept, marriage of Unidirectional Data Flow (Redux) with MVVM.
Stars: ✭ 180 (+462.5%)
Mutual labels:  unidirectional-data-flow
Norris
Showcase for Unidirectional Data Flow architecture for Android, powered by Kotlin Coroutines
Stars: ✭ 315 (+884.38%)
Mutual labels:  unidirectional-data-flow
Store
Unidirectional, transactional, operation-based Store implementation.
Stars: ✭ 477 (+1390.63%)
Mutual labels:  unidirectional-data-flow
mini-swift
Minimal Flux architecture written in Swift.
Stars: ✭ 40 (+25%)
Mutual labels:  flux-architecture
universal-routed-flux-demo
The code in this repo is intended for people who want to get started building universal flux applications, with modern and exciting technologies such as Reactjs, React Router and es6.
Stars: ✭ 31 (-3.12%)
Mutual labels:  flux-architecture
Swift Composable Architecture
A library for building applications in a consistent and understandable way, with composition, testing, and ergonomics in mind.
Stars: ✭ 5,199 (+16146.88%)
Mutual labels:  unidirectional-data-flow
ballade
For unidirectional data flow.
Stars: ✭ 44 (+37.5%)
Mutual labels:  unidirectional-data-flow
Corerender
Moved to https://github.com/alexdrone/Render
Stars: ✭ 25 (-21.87%)
Mutual labels:  unidirectional-data-flow
Kunidirectional
The goal of this sample app is to show how we can implement unidirectional data flow architecture based on Flux and Redux on Android... using Kotlin 😉
Stars: ✭ 303 (+846.88%)
Mutual labels:  unidirectional-data-flow
Reactive Interaction Gateway
Create low-latency, interactive user experiences for stateless microservices.
Stars: ✭ 465 (+1353.13%)
Mutual labels:  unidirectional-data-flow
Keemun
No description or website provided.
Stars: ✭ 13 (-59.37%)
Mutual labels:  unidirectional-data-flow
alveron-old
Opinionated Elm-inspired Redux Component Architecture for React
Stars: ✭ 17 (-46.87%)
Mutual labels:  flux-architecture
Uniflow Kt
Uniflow 🦄 - Simple Unidirectional Data Flow for Android & Kotlin, using Kotlin coroutines and open to functional programming
Stars: ✭ 414 (+1193.75%)
Mutual labels:  unidirectional-data-flow
tapit-app
App which lets two people share their social media details by simply putting one phone on top of the other ("tapping"). Currently in development by Nikita Mounier.
Stars: ✭ 18 (-43.75%)
Mutual labels:  unidirectional-data-flow
React Essential Course
ITVDN - React Essential course materials
Stars: ✭ 495 (+1446.88%)
Mutual labels:  flux-architecture
Vuex-Alt
An alternative approach to Vuex helpers for accessing state, getters and actions that doesn't rely on string constants.
Stars: ✭ 15 (-53.12%)
Mutual labels:  flux-architecture
Vueflux
♻️ Unidirectional State Management Architecture for Swift - Inspired by Vuex and Flux
Stars: ✭ 315 (+884.38%)
Mutual labels:  unidirectional-data-flow
Reswift
Unidirectional Data Flow in Swift - Inspired by Redux
Stars: ✭ 7,054 (+21943.75%)
Mutual labels:  unidirectional-data-flow
Delorean
An Agnostic, Complete Flux Architecture Framework
Stars: ✭ 748 (+2237.5%)
Mutual labels:  flux-architecture
Roxie
Lightweight Android library for building reactive apps.
Stars: ✭ 441 (+1278.13%)
Mutual labels:  unidirectional-data-flow

SwifTEA

Build status

SwifTEA is a small implementation of the Model and Update aspects of TEA.

SwifTEA has a companion library SwifTEAUI which provides integration components for SwiftUI

Semantic Versioning

SwifTEA uses semantic versioning. Until version 1.0.0 breaking changes may be introduced on minor version number changes. Bug fixes and backward compatible features will be added on patch versions. You should take this into account when setting your package dependency details.

Installation

SwifTEA is available via the swift package manager.

dependencies: [
  .package(url: "https://github.com/weegigs/swiftea.git", .upToNextMinor(from: "0.13.0"))
]

Examples

  • QOTD - An example application using SwifTEA, SwifTEAUI and SwiftUI.

Overview

The documentation below is only partially complete. Slides from the the talk SwifTEA UI - Unidirectional dataflow with SwiftUI and SwifTEA at the Melbourne CocoaHeads meetup in August 2019 are available on SlideShare

A SwifTEA Program state is driven by two separate components:

  • Model - current state of the program
  • Messages - changes that influence the state of the model. Message are updates in TEA terms. I use the term message is used as they represent something that has happened rather than something you want to happen. This makes modeling a system easier than the terms used in other TEA derivatives such as Action which is a little ambiguous and could easily be confused with command

SwifTEA also provides an execution environment for operations that rely on external components (i.e. state that is not directly managed via messages) in the form of:

  • Command - an async operation that produces messages. Command dependencies are supplied by the environment
  • Environment - A container for Command dependencies

Basic Operation

The model is updated as messages are applied to the model via a MessageHandler.

In it's most fundamental form a MessageHandler is a function (Model[^1], Message) -> (Model[^1], Command). It takes a Model and a Message and produces a new Model along with any side effects you want to trigger in the form of a Command.

SwifTEA provides a simplified MessageHandler, Reducer that lacks the Command output. This helps with the ergonomics when creating a MessageHandler that simply updates the Model

WeeDux

SwifTEA started life as a FLUX style library and the name WeeDux fit nicely with the theme (a small Flux library). It was quickly apparent to me that without explicit side effect handling I was leaving a lot of usefulness on the table. By moving to an Elm styled approach I was able to create a specific place to manage side effects and, as a bonus, manage dependency injection for side effect producing operations. Though the base architectural approach had changed I stuck with WeeDux name because that was the name I had.

When @mattdelves suggested SwifTEA UI for the name of my talk on combining WeeDux with SwiftUI, like the original architectural change, the name change was apparent.

License

MIT License

Copyright (c) 2019 Kevin O'Neill

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Footnotes

[^1]: The model is passed as an inout variable for ergonomic reasons

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].