-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMainViewModel.swift
More file actions
45 lines (35 loc) · 1.18 KB
/
Copy pathMainViewModel.swift
File metadata and controls
45 lines (35 loc) · 1.18 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
// This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
// If a copy of the MPL was not distributed with this file,
// You can obtain one at http://mozilla.org/MPL/2.0/.
import UIKit
import ReSwift
public protocol MainViewModelDelegate: MapViewModelDelegate {
func openSearchCard()
func openBookmarksCard()
func openNotificationsCard()
func openSettingsCard()
}
public final class MainViewModel {
public let mapViewModel: MapViewModel
private weak var delegate: MainViewModelDelegate?
public init(store: Store<AppState>,
environment: Environment,
delegate: MainViewModelDelegate?) {
self.mapViewModel = MapViewModel(store: store,
environment: environment,
delegate: delegate)
self.delegate = delegate
}
public func didPressSearchButton() {
self.delegate?.openSearchCard()
}
public func didPressBookmarksButton() {
self.delegate?.openBookmarksCard()
}
public func didPressNotificationsButton() {
self.delegate?.openNotificationsCard()
}
public func didPressSettingsButton() {
self.delegate?.openSettingsCard()
}
}