-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathProductViewModel.swift
More file actions
41 lines (33 loc) · 1.03 KB
/
ProductViewModel.swift
File metadata and controls
41 lines (33 loc) · 1.03 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
//
// ProductViewModel.swift
// RoutingExample
//
// Created by Cassius Pacheco on 8/3/20.
// Copyright © 2020 Cassius Pacheco. All rights reserved.
//
import Foundation
import IntentsUI
protocol ProductViewModelInterface {
var siriButtonDelegate: INUIAddVoiceShortcutButtonDelegate { get }
func productButtonTouchUpInside()
func wishlistButtonTouchUpInside()
}
final class ProductViewModel: ProductViewModelInterface {
typealias Routes = ProductRoute & PopUpRoute & SiriRoute
private let router: Routes
// Uses the router as the delegate to handle the intent controller orchestration.
var siriButtonDelegate: INUIAddVoiceShortcutButtonDelegate {
return router
}
init(router: Routes) {
self.router = router
}
func productButtonTouchUpInside() {
print("Product Button pressed")
router.openProduct()
}
func wishlistButtonTouchUpInside() {
print("Wishlist Button pressed")
router.openPopUp(withMessage: "Product added to the Wishlist!")
}
}