All Projects → VergeGroup → Verge

VergeGroup / Verge

Licence: mit
🟣 Verge is a very tunable state-management engine on iOS App (UIKit / SwiftUI) and built-in ORM.

Programming Languages

swift
15916 projects

Projects that are alternatives of or similar to Verge

Qiitawithfluxsample
A sample project uses Flux and MVVM features with RxSwift.
Stars: ✭ 94 (-65.57%)
Mutual labels:  rxswift, mvvm, flux
CLE-Architecture-Tools
A library for making view controller presentation and dismissal more functional.
Stars: ✭ 32 (-88.28%)
Mutual labels:  rxswift, uikit
flux-redux
An application implementing Flux and Redux with few other dependencies
Stars: ✭ 24 (-91.21%)
Mutual labels:  flux, dispatcher
ios-architecture-example
Architecture pattern simple examples in iOS. You can compare differences in MVC, MVP, MVVM-Delegate and MVVM-Rx for same feature
Stars: ✭ 16 (-94.14%)
Mutual labels:  rxswift, mvvm
Swifthub
GitHub iOS client in RxSwift and MVVM-C clean architecture
Stars: ✭ 2,330 (+753.48%)
Mutual labels:  rxswift, mvvm
Zhuishushenqi
追书神器Swift版客户端(非官方)。 不断更新中......
Stars: ✭ 196 (-28.21%)
Mutual labels:  rxswift, mvvm
Mp3ID3Tagger
🎶🎵A macOS application to edit the ID3 tag of your mp3 files. Developed with RxSwift and RxCocoa. 🎸🎼
Stars: ✭ 17 (-93.77%)
Mutual labels:  rxswift, mvvm
Rxgithub
An example of MVVM using RxSwift and Swinject (DI)
Stars: ✭ 109 (-60.07%)
Mutual labels:  rxswift, mvvm
mvvm-with-rxswift-mentoring-008
Project and source code of the iOS Dev Mentoring #008 - Test-driven MVVM with RxSwift
Stars: ✭ 45 (-83.52%)
Mutual labels:  rxswift, mvvm
MGCleanArchitecture
Clean Architecture with RxSwift & MVVM - Templates and Solutions
Stars: ✭ 156 (-42.86%)
Mutual labels:  rxswift, mvvm
GITGET
GitHub의 Contributions를 iOS의 Widget으로 보여주는 App
Stars: ✭ 101 (-63%)
Mutual labels:  rxswift, mvvm
Unio
🔄 KeyPath based Unidirectional Input / Output framework with RxSwift.
Stars: ✭ 139 (-49.08%)
Mutual labels:  rxswift, mvvm
Xcoordinator
🎌 Powerful navigation library for iOS based on the coordinator pattern
Stars: ✭ 1,752 (+541.76%)
Mutual labels:  rxswift, mvvm
minimalist
Observable Property and Signal for building data-driven UI without Rx
Stars: ✭ 88 (-67.77%)
Mutual labels:  rxswift, data-driven
Bark
Bark is an iOS App which allows you to push customed notifications to your iPhone
Stars: ✭ 2,371 (+768.5%)
Mutual labels:  rxswift, mvvm
RxSwiftDemo
RxSwift Demo
Stars: ✭ 19 (-93.04%)
Mutual labels:  rxswift, mvvm
Rxmarvel
Playing around marvel public API with RxSwift, Argo, Alamofire
Stars: ✭ 86 (-68.5%)
Mutual labels:  rxswift, mvvm
mvcvm-swift-file-templates
Swift file templates for boosting mobile app development.
Stars: ✭ 16 (-94.14%)
Mutual labels:  rxswift, mvvm
Cathay
an iOS project for demonstration of Reactive Programming
Stars: ✭ 21 (-92.31%)
Mutual labels:  rxswift, mvvm
TVToday
iOS TV Shows app with TMDb Api. RxSwift, MVVM, Clean Architecture. Tuist + Swift Package Manager
Stars: ✭ 27 (-90.11%)
Mutual labels:  rxswift, mvvm

Verge is giving the power of state-management in muukii/Pixel v2 development!

VergeIcon

Verge.swift

📍An effective state management architecture for iOS - SwiftUI and UIKit📍
_ An easier way to get unidirectional data flow _
_ Supports concurrent processing _

📖 Docs and tips

swift5.3 Tests cocoapods

Join the community on Spectrum

Requirements

  • Swift 5.3 +
  • @available(iOS 10, macOS 10.13, tvOS 10, watchOS 3)
  • UIKit
  • SwiftUI

Verge is not Flux, it's store-pattern and super powerful.

Verge is a performant store-pattern based state management library for iOS.

Please see the website: https://vergegroup.org

And the article about store-pattern

What store-pattern is

The word 'store-pattern' is used on Vue.js documentation that about how we manage the state between multiple components.

Projects which use Verge

We're welcome to publish here your application which powered by Verge!
Please Submit from Pull requests

Exmaple - UIKit / SwiftUI

Creating a view-model (meaning Store)

final class MyViewModel: StoreComponentType {

  /// 💡 The state declaration can be aslo inner-type.
  /// As possible adding Equatable for better performance.
  struct State: Equatable {
  
    struct NestedState: Equatable {
      ...
    }
    
    var name: String = ""
    var count: Int = 0
    
    var nested: NestedState = .init()  
    
  }

  /// 💡 This is basically a template statement. You might have something type of `Store`.
  let store: DefaultStore = .init(initialState: .init())

  // MARK: - ✅ These are actions as well as writing methods.

  func myAction() {
    // 💥 Mutating a state
    commit {
      $0.name = "Hello, Verge"
    }
  }

  func incrementAsync() {
    /**
    💥 Asynchronously mutating.
    Verge just provides thread-safety.
    We should manage operations in the Action.
    */
    DispatchQueue.global().async {    
      commit {
        // We must finish here synchronously - here is a critical session.
        $0.count += 1
      }
    }
  }
}

In SwiftUI

struct MyView: View {

  let store: MyViewModel

  var body: some View {
    // ✅ Uses `StateReader` to read the state this clarifies where components need the state.
    StateReader(store).content { state in
      Text(state.name)
      Button(action: {
        self.store.myAction()
      }) {
        Text("Action")
      }
    }
  }
}

StateReader supports to derive a part of the state like below.

StateReader(store.derived(.map(\.nested))).content { state in
  ...
}

🤲 Verge has not gathered enough experience in SwiftUI. Please let us know your ideas that improve Verge using in SwiftUI! (in Discussions or Issues)

In UIKit

Binding with a view (or view controller)

final class MyViewController: UIViewController {

  let viewModel: MyViewModel

  ...

  var cancellable: VergeAnyCancellable?

  init(viewModel: MyViewModel) {

    self.viewModel = viewModel

    // ✅ Start subscribing the state.
    self.cancellable = viewModel.sinkState { [weak self] (state: Changes<MyViewModel.State>) in
      self?.update(state: state)
    }

  }

  /**
  Actually we don't need to create such as this method, but here is for better clarity in this document.  
  */
  private func update(state: Changes<MyViewModel.State>) {
    
    /**
    💡 `Changes` is a reference-type, but it's immutable.
    And so can not subscribe.
    
    Why is it a reference-type? Because it's for reducing copying cost.
    
    It can detect difference with previous value with it contains a previous value.
    Which is using `.ifChanged` or `.takeIfChanged`.
    */

    /// 🥤 An example that setting the value if the target value has updated.
    state.ifChanged(\.name) { (name) in
      // ✅ `name` has changed! Update the text.
      nameLabel.text = name
    }
    
    /// 🥤 An example that composing as a tuple to behave like RxSwift's combine latest.
    state.ifChanged({ ($0.name, $0.count) }, ==) { (name, count) in
      /**
      Receives every time the tuple differs from the previous one.
      This means it changes when anyone in the tuple changed
      */
      nameLabel.text = name
      countLabel.text = age.description
    }

    ...
  }

}

The details are here!

Supports Integrating with RxSwift

Verge supports to integrate with RxSwift that enables to create a stream of State and Activity. To activate it, install VergeRx module.

What differences between Flux library are

'store-pattern' is the core-concept of Flux. Flux works with the multiple restricted rules top of the 'store-pattern'.

store-pattern

This means we can start using like Flux without using Action, Muation payload values.

// ✌️ no needs to use.
enum Action {
  case increment
  case decrement
}

This declarations might be quite big cost of implementation in order to start to use Flux.
Verge does not have this rules, so we can do like this when we update the state.

// 🤞 just like this
extension MyStore {
  func increment() {
    commit { 
      $0.count += 1
    }
  }
}

let store: MyStore
store.increment()

It can be easy start.
Of cource, we can create the layer to manage strict action and mutation payload on top of the Verge primitive layer.
Because 'store-pattern' is core-concept of Flux.

--

Motivation

Verge focuses use-cases in the real-world

Recently, we could say the unidirectional data flow is a popular architecture such as flux.

Does store-pattern(flux) architecture have a good performance?

It depends. The performance will be the worst depends on how it is used.

However, most of the cases, we don't know the app we're creating how it will grow and scales.
While the application is scaling up, the performance might decrease by getting complexity.
To keep performance, we need to tune it up with several approaches.
Considering the performance takes time from the beginning.
it will make us be annoying to use flux architecture.

Verge is designed for use from small and supports to scale.

Setting Verge up quickly, and tune-up when we need it.

Verge automatically tune-up and shows us what makes performance badly while development from Xcode's documentation.

For example, Verge provides these stuff to tune performance up.

Supports volatile events

We use an event as Activity that won't be stored in the state.
This concept would help us to describe something that is not easy to describe as a state in the client application.

Installation

CocoaPods

Verge (core module)

pod 'Verge/Store'

VergeORM

pod 'Verge/ORM'

VergeRx

pod 'Verge/Rx'

These are separated with subspecs in Podspec.
After installed, these are merged into single module as Verge.

To use Verge in your code, define import decralation following.

import Verge

SwiftPM

Verge supports also SwiftPM.

Questions

Please feel free to ask something about this library!
I can reply to you faster in Twitter.

日本語での質問も全然オーケーです😆
Twitterからだと早く回答できます⛱

Twitter

Demo applications

This repo has several demo applications in Demo directory. And we're looking for your demo applications to list it here! Please tell us from Issue!

Thanks

Author

🇯🇵 Muukii (Hiroshi Kimura)

License

Verge is released under the MIT license.

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