iOS Weather App with experimental architecture based on nestable components and RxSwift
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
Doc
Here and Now Tests
Here and Now UI Tests
Here and Now.xcodeproj
Here and Now.xcworkspace
Here and Now
.gitignore
Podfile
Podfile.lock
README.md

README.md

Here & Now

Here & Now is an iOS weather app written in Swift. I made it to explore how I might structure an app using RxSwift.

Here & Now Video

Main Themes

  • View controllers are deliberately minimal. They wire up their root ViewComponent and add its subview.
  • Nested ViewComponents are used to break the UI code down to manageable pieces
  • UI state changes are defined by pure functions that operate on Rx types
  • UI logic is implemented in component protocol extensions for ease of testing

A ViewComponent is defined as

protocol ViewComponent {
    // Streams used by the component
    associatedtype Inputs
    
    // Streams produced by the component
    associatedtype Outputs
    
    // Root view of the component, used to add as subview of parent component
    var view: UIView { get }
    
    init(disposedBy: DisposeBag)
    
    // Subscribe to input streams, export any streams produced by component
    func start(_ inputs: Inputs) -> Outputs
}

extension ViewComponent {
    // Stop any services started by the component
    func stop() {}
}