forked from guidomb/Portal
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEffects.swift
More file actions
54 lines (34 loc) · 1.06 KB
/
Effects.swift
File metadata and controls
54 lines (34 loc) · 1.06 KB
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
//
// Effects.swift
// PortalExample
//
// Created by Guido Marucci Blas on 6/10/17.
// Copyright © 2017 Guido Marucci Blas. All rights reserved.
//
import Portal
enum IgniteSubscription: Equatable {
case foo
}
enum Command {
case search
}
final class ExampleSubscriptionManager: Portal.SubscriptionManager {
func add(subscription: IgniteSubscription, dispatch: @escaping (ExampleApplication.Action) -> Void) {
}
func remove(subscription: IgniteSubscription) {
}
}
final class ExampleCommandExecutor: Portal.CommandExecutor {
let loadState: () -> State?
init(loadState: @escaping () -> State? = { .none }) {
self.loadState = loadState
}
func execute(command: Command, dispatch: @escaping (ExampleApplication.Action) -> Void) {
switch command {
case .search:
DispatchQueue.main.asyncAfter(deadline: .now() + 3) {
dispatch(.sendMessage(.searchComplete))
}
}
}
}