Boomerang is a library for MVVM in Swift applications
Due to the lack of ViewModel concepts in UIKit, Boomerang defines a set of scenarios through protocols and shares a common, reusable way to build screens in the app.
On top of that, it provides a set of extensions for common components like UICollectionView
, UITableView
, UIViewController
so that they can become compatible with a ViewModel.
Used with RxSwift (and RxDataSources) bindings (not required, but highly recommended), Boomerang can really improve project workflow and help keeping things simple and light.
ViewModel
for all your app.ListViewModel
to handle lists of ViewModel
s. Each item in the list represents contents for a view (a "cell" in a table/collection view)NavigationViewModel
to handle business logic for navigation through the appRoute
protocol to design and encapsulate how a scene should navigate to another. Write pushViewController
only once for your app :)Boomerang is available through Cocoapods.
Add this to your Podfile
pod 'Boomerang'
To use RxSwift integration, use
pod 'RxBoomerang`
We used to integrate Rx extensions with
pod Boomerang/RxSwift
This is still available at the moment but differs in how Rx extensions needs to be integrated in your project files: in this old scenario,import RxBoomerang
is not needed in every file with Boomerang extensions because import is handled by cocoapods; however, we believe that package managers should be interchangeable as much as possible; therefore, we suggest to use the new separated pod as it's more "futureproof".
To integrate new features in the library, you can open the Package.swift
file and edit the source folder.
You can find some integration examples in the Examples
folder.
We use XcodeGen to easily maintain xcodeproj files.
To install XcodeGen it, run brew install xcodegen
To setup each example project, run xcodegen
in each folder.
link |
Stars: 37 |
Last commit: 6 weeks ago |
This release introduce RxBoomerang and RxBoomerangTest specs for Cocoapods for a better support in test environments. Support for macOS and watchOS is back (at ViewModel and compilation level)
func elementSize(at indexPath: IndexPath) -> ElementSize?
in ListViewModel."Duality" between this method and
func elementSize(at indexPath: IndexPath, type: String?) -> ElementSize?
has caused some issues in normal usage in projects when overriding. We decided to keep a single method. This breaking change shouldn't have any impact on projects.
WithPropertyAssignment
now works with both classes and structs, and includes a closure method to quickly edit object properties upon creation
Example: UILabel().with { $0.text = "hey!" }
RxBoomerang
pod, which should be preferred over Boomerang/RxSwift
. This change should allow developers to quickly switch between SPM and Cocoapods without impact on their existing sources.As of today, using
pod Boomerang/RxSwift
in Podfile requires toimport Boomerang
only even for Rx extensions. SPM requires a double import (Boomerang + RxBoomerang). With this change we keep the two approaches in sync.
RxBoomerangTest
, a test framework to use in test targets, helping testing process of RxListViewModels and RxNavigationViewModelsThere's no real added value at the moment, as we're missing support for AppKit and WatchKit extensions like we have on UIKit. Support is added to simply allow complex projects to link Boomerang in sub-frameworks.
RxStateMachine
: a state management helper built for tests based on ComposableArchitecture concepts (credits: @jrBordet)Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics