Skip to content

Instantly share code, notes, and snippets.

import Foundation
enum HostResult {
case success([String])
case failure(String)
var description: String {
switch self {
case let .success(addresses): return "\(addresses)"
case let .failure(error): return "\(error)"
}

Keybase proof

I hereby claim:

  • I am agentk on github.
  • I am karlb (https://keybase.io/karlb) on keybase.
  • I have a public key ASB9nl2-v41DYm9qhJUgsGFA7F5QivD8LpE3HUvP9ghpRwo

To claim this, I am signing this object:

@agentk
agentk / ObservableStore.swift
Created April 12, 2016 02:10
ReSwift Store and ViewModel Scaffolding
import ReSwift
import ReactiveKit
class ObservableStore<State: StateType>: Store<State> {
let observable: Observable<State>
var reducer: AnyReducer!
override var state: State! {
didSet {
@agentk
agentk / AppReducer.swift
Created April 11, 2016 07:37
WIP ReSwift AppReducer
import ReSwift
struct AppReducer: Reducer {
func handleAction(action: Action, state: AppState?) -> AppState {
var state = state ?? AppState()
state.route = routeReducer(action, state: state.route)
state.signin = signInReducer(action, state: state.signin)
public protocol HandlesStack {
func setStack(_: [Segment])
}
public protocol Router {
typealias Delegate
var handlesPath: Path -> Bool { get }