-
Notifications
You must be signed in to change notification settings - Fork 80
/
Copy pathRoutable.swift
35 lines (24 loc) · 1.33 KB
/
Routable.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
//
// Routable.swift
// Meet
//
// Created by Benjamin Encz on 12/3/15.
// Copyright © 2015 ReSwift Community. All rights reserved.
//
public typealias RoutingCompletion = () -> Void
public protocol Routable {
func push(_ element: RouteElement, animated: Bool, completion: @escaping RoutingCompletion) -> Routable
func pop(_ element: RouteElement, animated: Bool, completion: @escaping RoutingCompletion)
func change(_ from: RouteElement, to: RouteElement, animated: Bool, completion: @escaping RoutingCompletion) -> Routable
}
extension Routable {
public func push(_ element: RouteElement, animated: Bool, completion: @escaping RoutingCompletion) -> Routable {
fatalError("This routable cannot push elements. You have not implemented it. (Asked \(type(of: self)) to push \(element))")
}
public func pop(_ element: RouteElement, animated: Bool, completion: @escaping RoutingCompletion) {
fatalError("This routable cannot pop elements. You have not implemented it. (Asked \(type(of: self)) to pop \(element))")
}
public func change(_ from: RouteElement, to: RouteElement, animated: Bool, completion: @escaping RoutingCompletion) -> Routable {
fatalError("This routable cannot change elements. You have not implemented it. (Asked \(type(of: self)) to change from \(from) to \(to))")
}
}