A shared package for all the infrastructure required to support the Architecture styles I use in my own apps.
Very shortly, this architecture is centered around Combines, and passing events between types using Combine publishers.
From a top-down perspective we have:
Coordinator- these types manage user-level Actions, and can send those types of events up to parent coordinators. Coordinators typically map 1-1 to a ViewController, which can either be a container controller, or one actually showing views.
UIViewController- Either container controllers or otherwise. These interact directly with
Viewobjects (either SwiftUI or UIKit) to translate events from the User to things shown on the view. View Controllers here serve to keep Coordinators from having to care about/interact directly with Views.
This also contains a number of other subpackages and helpers, because I don't care to split them off into their own repository:
UICoordinator.swiftis the big one, already detailed above. This is meant to be used with UIKit/UIViewController.
NSCoordinator.swiftlike UICoordinator, but for Cocoa/NSViewController.
Withable.swiftis a protocol for setting properties via their keypaths, which is really useful for using the builder pattern with objective-c types.
CombineExtensions.swiftcontains a number of extensions on Combine that make life a bit easier.
Future.successcreates an already-finished
Futurewith the given output.
Future.failurecreates an already-finished
Futurewith the given error.
Futurethat completes once either it receives a value, or if it receives an error. Whichever comes first.
Publisherforwards events from the receiver onto the given
Subject. It returns an
mergeManyAndKeepOrdertakes an array of
Futures with the same
Failuretypes and returns a single
Futurethat's finished with an array of
Outputfrom those futures, in the same order those futures were given in.
UIControlsuch that it can create a publisher for when the given