Managing state is hard. Delta aims to make it simple.

Related tags

Tools Delta
Overview

Carthage compatible

Managing state is hard. Delta aims to make it simple.

Delta takes an app that has custom state management spread throughout all the VCs and simplifies it by providing a simple interface to change state and subscribe to its changes.

It can be used standalone or with your choice of reactive framework plugged in. We recommend using a reactive framework to get the most value.

Source Compatibility

The source on master assumes Swift 2.1

Framework Installation

Carthage

github "thoughtbot/Delta"

Then run carthage update.

Follow the current instructions in Carthage's README for up to date installation instructions.

CocoaPods

Add the following to your Podfile:

pod 'Delta', :git => "https://github.com/thoughtbot/Delta.git"

You also need to make sure you're opting into using frameworks:

use_frameworks!

Then run pod install with CocoaPods 0.36 or newer.

Git Submodules

Add this repo as a submodule, and add the project file to your workspace. You can then link against Delta.framework in your application target.

Usage

Contributing

See the CONTRIBUTING document. Thank you, contributors!

License

Delta is Copyright (c) 2015 thoughtbot, inc. It is free software, and may be redistributed under the terms specified in the LICENSE file.

About

Delta is maintained by Jake Craige.

thoughtbot

Delta is maintained and funded by thoughtbot, inc. The names and logos for thoughtbot are trademarks of thoughtbot, inc.

We love open source software! See our other projects or hire us to help build your product.

Comments
  • Initial Implementation

    Initial Implementation

    Currently involves a good amount of setup which I'd like to minimize if possible. It does make it very configurable and a very simple framework at this point which doesn't have to maintain much.

    We pretty much defer to whatever the Rx implementation the user uses but so they'll have to extend it to make it conform to the protocol.

    Definitely needs docs an examples which I'd be happy to write more of once we solidify the API a bit more and decide how much this lib needs to do vs. using an Rx implementation.

    opened by jakecraige 8
  • Add a middleware stack

    Add a middleware stack

    Having an API for adding middlewares to intercept dispatches and do something else seems like it could be useful.

    A few examples I think this could be nice for is:

    1. Tracking analytics as a side effect of dispatching an event.
    2. Tracking actions for #19
    3. Debug tooling that can see what's being dispatched and do something with it, like log the action

    Thoughts?

    feature request 
    opened by jakecraige 7
  • [wip] Middleware

    [wip] Middleware

    Another attempt at middleware. I had to make Store its own concrete structure so it could store currently registered middleware. Maybe it makes more sense as a final class.

    A Middleware is a function that takes the current state value stateValue, and a () -> Bool function next.

    Middleware is executed sequentially in the order it is registered. The next middleware is only executed if the previous returns the result of next() at the end. If it returns false, the state will not be updated. If it returns true, the state will be updated immediately without executing the remaining middleware.

    See the StoreSpec for a super basic example.

    I still don't think this is the final route to go, but I think I'm getting closer. Ideally, Middleware would also take the action being dispatched. But unfortunately that's not currently possible because we can't add generic constraints to a typealias (currently Middleware is just a type alias). I think there's a way to get around this, but I haven't cracked that yet. Going to keep fiddling.

    Tracking changes aka time travel debugging #19 will be difficult. Because Swift doesn't have higher order types, there's no way to store a collection of type-constrained, protocol conforming structures of different types. In other words, even though the reduce for every ActionType associated with a particular store has the same signature, the structures themselves have different types, so they can't be stored side-by-side in a collection.

    One way we might be able to get around this and still have valuable information about mutation is by reflecting the action and initializing a Mutation structure, containing the stringified action type (e.g. "SetCurrentUserAction") and that actions stored properties (e.g. ["user": User(name: "Jane Doe")]). This would give us the same valuable information and we'd be able to store these concrete Mutations easily

    opened by gilesvangruisen 6
  • Rename protocols to match Swift API guidelines

    Rename protocols to match Swift API guidelines

    Protocols that describe what something is should read as nouns (e.g. Collection). Protocols that describe a capability should be named using the suffixes able, ible, or ing (e.g. Equatable, ProgressReporting).

    https://swift.org/documentation/api-design-guidelines.html#be-grammatical

    opened by jakecraige 4
  • Add docs/getting started

    Add docs/getting started

    Jazzy docs

    • [x] Add section about using an Rx implementation
    • [x] ~~Example repo? OSS constable?~~ let's strike for now to get this done. Constable is probably a good choice eventually
    • [x] Definitely needs edits
    • [x] Don't end in blah blah blah
    • [x] Move getting started to it's own page?
    • [x] Link to jazzy docs
    • [x] Reword async action type stuff to match dynamic action

    closes #16

    opened by jakecraige 4
  • Middleware stack

    Middleware stack

    Reopening since the issues -> PR conversion lost the original issue

    Having an API for adding middlewares to intercept dispatches and do something else seems like it could be useful.

    A few examples I think this could be nice for is:

    1. Tracking analytics as a side effect of dispatching an event.
    2. Tracking actions for #19
    3. Debug tooling that can see what's being dispatched and do something with it, like log the action

    Thoughts?

    Original issue: https://github.com/thoughtbot/Delta/pull/20

    feature request help wanted 
    opened by jakecraige 3
  • Have logo designed and add it to readme

    Have logo designed and add it to readme

    Now that we have a sweet name like Delta, we could use a nice logo for when we OSS this. Any designers interested in designing one?

    cc @thoughtbot/design

    opened by jakecraige 3
  • Store as struct / Unexpected boilerplate cleanup(Only 3 lines!)

    Store as struct / Unexpected boilerplate cleanup(Only 3 lines!)

    Why:

    • Store class syntax was a bit gross and protocol extensions!
    • Too much boilerplate #4

    This change addresses the need by:

    • Adding a StoreType that you implement on a store struct. It contains default implementations for dispatching.
    • Randomly come across the fact that implementing the reduce method on the ActionType infers the typealias

    The only required setup you need now is:

    struct Store: StoreType {
        var state: ObservableProperty<AppState>
    }
    

    Edits: Changed setup to remove redundant typealias

    opened by jakecraige 3
  • swift-3.0 branch

    swift-3.0 branch

    Hi, I am trying to add this Delta branch to a Swift 3 project I am working on. The Delta.framework is linked in the project and is seen where 'imported'.

    What occurs though is when I attempt to build and run to the Simulator. Up to now, my project ran on the Simulator with no warnings or errors.

    The compiler error I get is: dyld: Library not loaded: @rpath/Delta.framework/Delta Referenced from: /Users/mikenorman/Library/Developer/CoreSimulator/Devices/1EB55262-AAA4-41D4-892A-7E958D1CB515/data/Containers/Bundle/Application/836A24C4-D6AF-4900-92B6-9722B998F615/trips.app/trips Reason: image not found (lldb)

    Any idea of what might be causing this? I am also looking on Stackoverflow for similar issues.

    Thanks

    --mike

    opened by ghost 2
  • Organize

    Organize

    • Created a hierarchy for tests
    • Renamed a couple test files
    • Renamed ***Tests to ***Spec, including QuickSpec subclasses
    • Fixed the reference to Delta.xcodeproj

    This might be pre-emptive, but any ideas for a Source file structure?

    opened by gilesvangruisen 2
  • Improve test coverage

    Improve test coverage

    Any opposition to using Quick/Nimble?

    I'd also like to write some more extensive tests, especially with consecutive state changes. A good example in one of the FB flux videos is (I'm paraphrasing):

    You have a list of active users [Mary, John, Kate]:

    1. George becomes active
    2. Mary becomes inactive
    3. Tina becomes active

    Now what does the list of active users look like?

    opened by gilesvangruisen 2
Releases(v0.1.0)
Owner
thoughtbot, inc.
We work with organizations of all sizes to design, develop, and grow their web and mobile products.
thoughtbot, inc.
Simple PBXProj Verifier

Kin Kin is a minimalistic tool to check whether your project.pbxproj file is correct. What does it do? Have you ever found yourself undoing a merge du

Sergio Gutiérrez 857 Dec 29, 2022
Async State Machine aims to provide a way to structure an application thanks to state machines

Async State Machine Async State Machine aims to provide a way to structure an application thanks to state machines. The goal is to identify the states

Thibault Wittemberg 27 Nov 17, 2022
This app is a sample app that recognizes specific voice commands such as "make it red", "make it blue", "make it green", and "make it black" and change the background color of the view in the frame.

VoiceOperationSample This app is a sample app that recognizes specific voice commands such as "make it red", "make it blue", "make it green", and "mak

Takuya Aso 3 Dec 3, 2021
The template for Delta Client plugins.

Delta Plugin Template This repository is a template for Delta Client plugins. To create a plugin, create a repo from this template repo and then repla

null 1 Jan 12, 2022
A repository of example plugins for Delta Client

Example Plugins for Delta Client This repository contains a few example plugins to help developers get a practical understanding of how to use the plu

null 0 Oct 30, 2021
Delta is an all-in-one classic video game emulator for non-jailbroken iOS devices.

Delta Delta is an all-in-one classic video game emulator for non-jailbroken iOS devices. Delta is an iOS application that allows you to emulate and pl

Riley Testut 1.7k Jan 6, 2023
Build complex, conducted animations declaratively without manually managing state.

Maestro Build complex, conducted animations declaratively without manually managing state. Code struct AnimatedPieChart: View { private enum Trim

Ryan Wachowski 5 Nov 20, 2022
React Native Todo List example app which uses Redux for managing app state

react-native-redux-todo-list A sample todo list app developed by using React Native and Redux. How to run the app Install react-native If you don't ha

null 43 Oct 11, 2022
Vaccine is a framework that aims to make your apps immune to recompile-disease.

Vaccine Description Vaccine is a framework that aims to make your apps immune to recompile-disease. Vaccine provides a straightforward way to make you

Christoffer Winterkvist 298 Dec 23, 2022
Gauntlet is a collection of testing utility methods that aims to make writing great tests easier.

Gauntlet What is Gauntlet? Gauntlet is a collection of testing utility methods that aims to make writing great tests easier and with more helpful and

null 11 Dec 17, 2022
SimpleAuth is designed to do the hard work of social account login on iOS

SimpleAuth is designed to do the hard work of social account login on iOS. It has a small set of public APIs backed by a set of "providers"

Caleb Davenport 1.2k Nov 17, 2022
Profiling / Debugging assist tools for iOS. (Memory Leak, OOM, ANR, Hard Stalling, Network, OpenGL, Time Profile ...)

MTHawkeye Readme 中文版本 MTHawkeye is profiling, debugging tools for iOS used in Meitu. It's designed to help iOS developers improve development producti

meitu 1.4k Dec 29, 2022
iOS platform video hard decoding, support h264, h265

VideoDecoder iOS platform video hard decoding, support h264, h265 Example To run the example project, clone the repo, and run pod install from the Exa

null 21 Sep 8, 2022
LaiFeng IOS Live Kit,H264 and AAC Hard coding,support GPUImage Beauty, rtmp transmission,weak network lost frame,Dynamic switching rate

LFLiveKit LFLiveKit is a opensource RTMP streaming SDK for iOS. Features Background recording Support horizontal vertical recording Support Beauty Fac

null 4.3k Jan 6, 2023
HealthKit is notoriously hard to work with. Let's change that.

Health X Better interfacing with HealthKit HealthKit is notoriously hard to work with. Let's change that. Using Combine features like ObservableObject

Siddharth 1 Feb 17, 2022
Secure your app by obfuscating all the hard-coded security-sensitive strings.

App Obfuscator for iOS Apps Secure your app by obfuscating all the hard-coded security-sensitive strings. Security Sensitive strings can be: REST API

pj 601 Dec 16, 2022
A simple todo app which aims to demonstrate some new concepts from SwiftUI 3

TodoAppSwiftUI3 A simple todo app which aims to demonstrate some new concepts from SwiftUI 3 Description This is a simple todo app built to demonstrat

Roman Luzgin 50 Nov 1, 2022
Spin aims to provide a versatile Feedback Loop implementation working with the three main reactive frameworks available in the Swift community (RxSwift, ReactiveSwift and Combine)

With the introduction of Combine and SwiftUI, we will face some transition periods in our code base. Our applications will use both Combine and a thir

Spinners 119 Dec 29, 2022
JSONNeverDie - Auto reflection tool from JSON to Model, user friendly JSON encoder / decoder, aims to never die

JSONNeverDie is an auto reflection tool from JSON to Model, a user friendly JSON encoder / decoder, aims to never die. Also JSONNeverDie is a very important part of Pitaya.

John Lui 454 Oct 30, 2022
Jogendra 113 Nov 28, 2022