Skip to content

Instantly share code, notes, and snippets.

View hmlongco's full-sized avatar

Michael Long hmlongco

View GitHub Profile
@hmlongco
hmlongco / StructStateViewModel.swift
Last active January 29, 2019 16:39
StructStateViewModel
class StructStateViewModel {
public let state: Observable<State>
struct State {
var id: String?
var loading = false
var image: UIImage?
var empty: String?
var error: String?
@hmlongco
hmlongco / EnumeratedStateViewModel.swift
Last active January 29, 2019 16:40
EnumeratedStateViewModel
class EnumeratedStateViewModel {
public let state: Observable<State>
enum State: Equatable {
case initial
case loading
case loaded(UIImage)
case empty(String)
case error(String)