Skip to content

Instantly share code, notes, and snippets.

@Herakleis
Herakleis / SceneCoordinatorType.swift
Created August 19, 2017 15:57
SceneCoordinatorType
import UIKit
import RxSwift
protocol SceneCoordinatorType {
init(window: UIWindow)
var currentViewController: UIViewController { get }
@discardableResult
func transition(to scene: Scene, type: SceneTransitionType) -> Observable<Void>
@Herakleis
Herakleis / BindableType.swift
Created August 19, 2017 15:28
BindableType
import UIKit
import RxSwift
protocol BindableType {
associatedtype ViewModelType
var viewModel: ViewModelType! { get set }
func bindViewModel()
}
@Herakleis
Herakleis / Scene+ViewControllerTemplate.swift
Last active August 19, 2017 15:16
Scene+ViewControllerTemplate
import UIKit
extension Scene {
func viewController() -> UIViewController {
switch self {
case .firstScene(let viewModel):
let nc = UINavigationController(rootViewController: FirstSceneViewController())
@Herakleis
Herakleis / Scene.swift
Last active August 19, 2017 14:55
Scene+Template
import Foundation
enum Scene {
// Sub-group of scenes related to each other
// E.g.: all scenes part of a login process
case firstScene(FirstSceneViewModel)
case secondScene(SecondSceneViewModel)
// Another sub-group of scenes related to each other
@Herakleis
Herakleis / Singleton+Template.swift
Created August 18, 2017 20:58
Singleton+Template
final class Singleton {
static let shared = Singleton()
private init() { }
}
import RxSwift
import Action
protocol MyViewModelInputsType {
// Inputs headers
}
protocol MyViewModelOutputsType {
// Outputs headers
}