Skip to content

vyshane/here-and-now

Repository files navigation

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() {}
}

About

iOS Weather App with experimental architecture based on nestable components and RxSwift

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published