All Projects → geekaurora → SwiftUIRedux

geekaurora / SwiftUIRedux

Licence: MIT License
🚀Comprehensive Redux library for SwiftUI, ensures State consistency across Stores with type-safe pub/sub pattern.

Programming Languages

swift
15916 projects

Projects that are alternatives of or similar to SwiftUIRedux

RRSettingsKit
A beautiful customizable settings screen created in SwiftUI
Stars: ✭ 118 (+555.56%)
Mutual labels:  swiftui
aws-serverless-fullstack-swift-apple-carplay-example
This application demonstrates a full-stack Apple CarPlay app that uses Swift for both the UI and the backend services in AWS. The app accesses Lambda functions written in Swift and deployed from Docker images. The app accesses Amazon Location Service and a 3rd party weather api to display information in the vicinity of the user.
Stars: ✭ 84 (+366.67%)
Mutual labels:  swiftui
SwiftUI-Shimmer
Shimmer is a super-light modifier that adds a shimmering effect to any SwiftUI View, for example, to show that an operation is in progress. It works well on light and dark modes, and across iOS, macOS, tvOS and watchOS.
Stars: ✭ 168 (+833.33%)
Mutual labels:  swiftui
iOS interviews
iOS Interviews - 史上最贴心 iOS 面试知识点分享!不只是 iOS !只为技术的执拗 !👍 全网火速更新中 🔥 期待你的讨论,期待你的 issue ! 🌟
Stars: ✭ 25 (+38.89%)
Mutual labels:  swiftui
ImageFilterSwiftUICompleted
Completed Project for Cross Platform Image Filter SwiftUI macOS & iOS App
Stars: ✭ 67 (+272.22%)
Mutual labels:  swiftui
SettingsAppInSwiftUI
I have recreated a Settings App in iPhoneXR using SwiftUI concepts such as Form,Section,Toggle,Picker,Stack..etc
Stars: ✭ 37 (+105.56%)
Mutual labels:  swiftui
Standford-CS193p-2020Spring-SwiftUI
Stanford University's course CS193p in the spring quarter of 2020 (Developing Applications for iOS using SwiftUI)
Stars: ✭ 110 (+511.11%)
Mutual labels:  swiftui
lockd
Generate strong passwords and save them in Keychain. Made with SwiftUI
Stars: ✭ 38 (+111.11%)
Mutual labels:  swiftui
SwiftUI-Fractals
The Sierpinski carpet, triangle, and a fractal tree using SwiftUI
Stars: ✭ 22 (+22.22%)
Mutual labels:  swiftui
Helm
A graph-based SwiftUI router
Stars: ✭ 64 (+255.56%)
Mutual labels:  swiftui
chip-8
Jetpack Compose and SwiftUI based Kotlin Multiplatform fork of https://github.com/cbeust/chip-8 (Chip-8 Emulator)
Stars: ✭ 36 (+100%)
Mutual labels:  swiftui
SwiftyIllustrator
A tool for quickly converting Adobe Illustrator shapes into SwiftUI code.
Stars: ✭ 26 (+44.44%)
Mutual labels:  swiftui
ColorUp
An easy way to generate strongly typed Swift extensions for either UIColor or Color based off of your colors within the project's asset catalog.
Stars: ✭ 16 (-11.11%)
Mutual labels:  swiftui
SwimplyPlayIndicator
Animated PlayIndicator written in SwiftUI. Inspired by Apple's Music Player.
Stars: ✭ 52 (+188.89%)
Mutual labels:  swiftui
BDUIKnit
A Swift Package Manager packed with SwiftUI custom reusable UI components and extensions.
Stars: ✭ 21 (+16.67%)
Mutual labels:  swiftui
swiftui
Discussion forum for SwiftUI
Stars: ✭ 92 (+411.11%)
Mutual labels:  swiftui
column-text-view-ui
📄 Column Text View is an adaptive UI component that renders text in columns, horizontally [iOS 12, UIKit, TextKit, SwiftUI].
Stars: ✭ 11 (-38.89%)
Mutual labels:  swiftui
PathBuilder
SwiftUI result builder for Path
Stars: ✭ 48 (+166.67%)
Mutual labels:  swiftui
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 (+0%)
Mutual labels:  swiftui
IndieApps
A platform to showcase your side projects/apps
Stars: ✭ 23 (+27.78%)
Mutual labels:  swiftui

SwiftUIRedux

Carthage compatible Swift Version License

Comprehensive Redux library for SwiftUI.

  • Keep State consistent across Stores by type safe pub/sub pattern with Reducers of RootStore.
  • Waterfall Action propagation flow from root to State subtree.

Unidirectional Data Flow

  • RootStore/Dispatcher: Propagates domained actions

  • Reducer: Subscribes to RootStore and reduces Action to generate new state

  • Action: Action driven - more loosely coupled pattern than Delegation pattern

  • State:

    • Reduces Action and outputs new State
    • Waterfall reduce flow: propagates Action to children nodes via State tree

Declarative/Stateful/Immutable/Predictable

  • Efficient tree diff algorithm, no more imperative manual update code.

Usage Example

FeedListView

struct FeedListView: View {
  @ObservedObject var state = FeedListState()
  
  var body: some View {
    List {
      ForEach(state.feeds, id: \.diffId) { feed in
        FeedCell(feed: feed)
      }
    }
  }
}

FeedListState

public class FeedListState: ReduxReducer, ObservableObject {  
  @Published var feeds: [Feed] = []
  
  public override func reduce(action: ReduxActionProtocol) {
    // Propagates `action` to the substate tree.
    // Setting `self.feeds` with new feeds triggers list UI reloading 
    // and SwiftUI will diff efficiently based on list identifier.
    feeds = feeds.map { $0.reduce(action: action) }
}

Dispatch FeedLikeAction

dispatch(action: FeedLikeAction(feed: feed))

Reduce FeedLikeAction

public struct Feed {
  public var diffId = UUID()
  public let feedId: Int
  public let title: String
  public var isLiked: Bool { didSet { diffId = UUID() } }     
}

extension Feed: ReduxStateProtocol {
  @discardableResult
  public func reduce(action: ReduxActionProtocol) -> Self {
    // Makes the deep copy of self.
    var feedCopy = self    
    switch action {
    case let action as FeedLikeAction:
      // Reduces the `FeedLikeAction`.
      if feedId == action.feed.feedId {
        feedCopy.isLiked = !action.feed.isLiked
      }
    default: break
    }
    return feedCopy
  }
}
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].