All Projects â†’ ww-tech â†’ lasso

ww-tech / lasso

Licence: Apache-2.0 license
iOS architectural pattern and framework

Programming Languages

swift
15916 projects
ruby
36898 projects - #4 most used programming language

Projects that are alternatives of or similar to lasso

Aftermath
🔮 Stateless message-driven micro-framework in Swift.
Stars: ✭ 67 (-14.1%)
Mutual labels:  unidirectional-data-flow
Uniflow Polymer
UniFlow for Polymer
Stars: ✭ 168 (+115.38%)
Mutual labels:  unidirectional-data-flow
Kaskade
[INACTIVE] Simplifying state management
Stars: ✭ 223 (+185.9%)
Mutual labels:  unidirectional-data-flow
Awesome Tca
Awesome list for The Composable Architecture
Stars: ✭ 124 (+58.97%)
Mutual labels:  unidirectional-data-flow
Reactivefeedback
Unidirectional reactive architecture
Stars: ✭ 156 (+100%)
Mutual labels:  unidirectional-data-flow
Render
UIKit a-lĂ  SwiftUI.framework [min deployment target iOS10]
Stars: ✭ 2,150 (+2656.41%)
Mutual labels:  unidirectional-data-flow
Fluxxkit
Unidirectional data flow for reactive programming in iOS.
Stars: ✭ 42 (-46.15%)
Mutual labels:  unidirectional-data-flow
Movies
Simple movies app for architectural experiments.
Stars: ✭ 90 (+15.38%)
Mutual labels:  unidirectional-data-flow
Remvvm
ReMVVM is an application architecture concept, marriage of Unidirectional Data Flow (Redux) with MVVM.
Stars: ✭ 168 (+115.38%)
Mutual labels:  unidirectional-data-flow
Movies Usf Android
Movie searching using a Unidirectional State Flow pattern for Android
Stars: ✭ 222 (+184.62%)
Mutual labels:  unidirectional-data-flow
Reactivereswift
Unidirectional Data Flow in Swift via FRP - Inspired by Elm
Stars: ✭ 133 (+70.51%)
Mutual labels:  unidirectional-data-flow
Rxstate
Redux implementation in Swift using RxSwift
Stars: ✭ 142 (+82.05%)
Mutual labels:  unidirectional-data-flow
Knot
Unidirectional reactive state container for Android & Kotlin
Stars: ✭ 198 (+153.85%)
Mutual labels:  unidirectional-data-flow
Unidirectional Architecture On Mobile
Dive into 📱 Unidirectional Architecture!
Stars: ✭ 115 (+47.44%)
Mutual labels:  unidirectional-data-flow
knot
Unidirectional reactive state container for Android & Kotlin
Stars: ✭ 231 (+196.15%)
Mutual labels:  unidirectional-data-flow
Reduxpaperswift
A simple approach to learning the beginnings of Redux in Swift.
Stars: ✭ 65 (-16.67%)
Mutual labels:  unidirectional-data-flow
Reactor
🔄 Unidirectional data flow in Swift.
Stars: ✭ 174 (+123.08%)
Mutual labels:  unidirectional-data-flow
trux
Unidirectional data layer for reactive user interfaces
Stars: ✭ 59 (-24.36%)
Mutual labels:  unidirectional-data-flow
Core
Starter kit for Core architecture.
Stars: ✭ 69 (-11.54%)
Mutual labels:  unidirectional-data-flow
Viw
VI Worsened, a lightweight and fun VI clone.
Stars: ✭ 212 (+171.79%)
Mutual labels:  unidirectional-data-flow

Lasso logo

Lasso is an iOS application architecture for building discrete, composable and testable components both big and small - from single one-off screens, through complex flows, to high-level application structures.

Why Lasso?

Without a set of structural principles, it's very easy for an application's code base to become hard to both reason about, and maintain. In particular, these problems will eventually arise:

  • tight coupling of components makes it hard to change/test things
  • business logic living in strange places makes it hard to modify/reuse/debug/test existing code
  • view presentation choices made in inappropriate places makes it hard to refactor/reorganize/test flows
  • inconsistent organization across team makes it hard to cross-contribute

The Lasso way

Lasso encourages a strong separation of concerns by clearly defining discrete, single-responsibility components where specific types of code should live, and a clear, flexible way for these components to communicate. Larger units of behavior are easily composed, and re-composed.

Screens

We generally think of a screen as a single page/view in an app - e.g., a login view, a contacts list view, an audio settings view, etc.

In Lasso, a Screen is the collection of types used to implement a single view:

Diagram of a Screen and its constituent parts

The View (i.e., a UIViewController) is responsible for:

  • accurately rendering the current State (i.e., the content) of the screen
  • forwarding user interactions to the Store (i.e., the decision maker)
  • responding to state changes to keep the presentation up to date

Lasso views tend to be small, with practically zero logic in them.

A unidirectional data flow is used to ensure consistency: a View never re-renders anything in direct response to a user action. Views send Actions to the Store, which updates the State, which come back to the View as State change notifications.

The Store is where a screen's decisions are made, and is the source of truth for the screen's State. A Store is responsible for:

  • all business logic for the screen
  • responding to Actions (i.e. events sent from the View)
  • updates to the screen's State

A Store can also generate an Output when an event occurs that is more appropriately handled elsewhere. E.g., a login screen might generate a "user did login" output as a signal to a higher-level system to move to a logged-in portion of an app; or a contact list screen might generate a "did select contact" output as a signal to a higher-level flow to either present or push a contact detail screen.

Flows

A Flow represents a feature - or area - of an app, and is commonly composed of a collection of Screens. For example, a "new user" flow might be composed of a series of one-time informational screens followed by a single "let's get started" screen.

Diagram of a Flow

A Flow is instantiated and started within an appropriate context of a view hierarchy (e.g., a "sign up" flow might be presented on a menu screen, or a "welcome" flow might be pushed onto a navigation stack). The Flow starts by creating its initial Screen, and listens for Output signals. As Outputs arrive, the Flow decides what to do with them - it can create and place another Screen into the view hierarchy, emit its own Output (when an event occurs that is more appropriately handled elsewhere), or whatever is appropriate for the Flow.

Since Screens and Flows are encapsulated modules with discrete entry and exit points, it's quite easy and common for a Flow to manage both Screens and Flows. In this way, it becomes possible to define your application as a hierarchy of components, reducing complexity from the top level down.

Diagram of a Flow within another Flow

Example App

To run the example project

  1. Clone the Lasso repo
  2. Run pod install from the Example directory
  3. Open up Lasso.xcworkspace

Learn more

Requirements

Lasso supports iOS 13 and up, and can be compiled with Swift 4.2 and up.

Note: Lasso v.1.3.0 has added support for SwiftUI, and has a minimum deployment target of iOS 13.0. If you need support for earlier versions of iOS, please use v1.2.1.

Installation

Cocoapods

The core Lasso framework is added to the primary target in your Podfile:

Pod 'Lasso'

Also add LassoTestUtilities to your test target(s):

Pod 'LassoTestUtilities'

Swift Package Manager

The Lasso package URL is:

`https://github.com/ww-tech/lasso.git`

For sample usage, see: Swift Package Manager Sample.

Contributing

We love contributions!

If you have a feature in mind, and/or have found a bug, the best thing to do is:

  1. Search the issues to see if someone has already brought it up!
  2. Create a new issue that explains in detail the improvements you'd like to see.
  3. If you have a code change in mind, that's awesome!
    1. Fork the Lasso repo
    2. Create a branch for your feature change
    3. Open a PR!

Authors

Steven Grosmark, Trevor Beasty, Yuichi Kuroda, and the WW iOS Team.

License

Lasso is licensed under the Apache-2.0 Open Source license.

You are free to do with it as you please. We do welcome attribution, and would love to hear from you if you are using it in a project!

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].