Swiftpack.co - synesthesia-it/Boomerang as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by synesthesia-it.
synesthesia-it/Boomerang 6.8.0
Swift micro-framework for MVVM (Model-View-ViewModel) native applications.
⭐️ 37
🕓 6 weeks ago
iOS macOS watchOS tvOS
.package(url: "https://github.com/synesthesia-it/Boomerang.git", from: "6.8.0")

Boomerang

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.

Key Features / TLDR

  • Concept of ViewModel for all your app.
  • ListViewModel to handle lists of ViewModels. 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 app
  • Route protocol to design and encapsulate how a scene should navigate to another. Write pushViewController only once for your app :)
  • Never write datasource and delegate for your collection/table views again!
  • Automatic sizing for table view and collection views. Painless.
  • TDD-ready: use RxBoomerangTest with your test target to quickly write tests around your code.

Installation

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

Contributing

To integrate new features in the library, you can open the Package.swift file and edit the source folder.

Examples

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.

Table of contents (WIP)

GitHub

link
Stars: 37
Last commit: 6 weeks ago
Advertisement: IndiePitcher.com - Cold Email Software for Startups

Release Notes

RxBoomerang and RxBoomerangTest pods
2 years 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)

Breaking Changes

  • Removed 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.

New stuff

  • 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!" }
  • Introducing 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 to import Boomerang only even for Rx extensions. SPM requires a double import (Boomerang + RxBoomerang). With this change we keep the two approaches in sync.

  • Introducing RxBoomerangTest, a test framework to use in test targets, helping testing process of RxListViewModels and RxNavigationViewModels
  • Support for MacOS and Watchos targets

There'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)
  • Some inline documentation
  • ... this changelog :)

Fixes

  • LICENSE.md is now properly recognized as MIT by automatic parsers.

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics