AmivMicroAppCheckin.swift 1.15 KB
Newer Older
domenicw's avatar
domenicw committed
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
//
//  AmivMicroAppCheckin.swift
//  Amiv
//
//  Created by Domenic Wüthrich on 26.09.18.
//  Copyright © 2018 Amiv an der ETH. All rights reserved.
//

import Foundation
import UIKit

public class AmivMicroAppCheckin: AmivMicroApp {
    
    // MARK: - Variables
    
    public var delegate: AmivMicroAppDelegate
    
    public var rootViewController: UIViewController {
        return checkinController
    }
    
    private lazy var checkinController: UIViewController = {
        let con = LoginViewController(model: LoginModel.createNormal())
        con.delegate = self
        return con
    }()
    
    // MARK: - Initializers
    
    public init(delegate: AmivMicroAppDelegate) {
        self.delegate = delegate
    }
    
    // MARK: - App lifetime
    
    public func start() -> Bool {
        return true
    }
}

extension AmivMicroAppCheckin: LoginViewControllerDelegate {
    
43
    public func login(_ viewController: LoginViewController, username: String, password: String) {
domenicw's avatar
domenicw committed
44
45
46
        self.delegate.appIsFinished()
    }
    
47
    public func smallButtonTapped(_ viewController: LoginViewController) {
domenicw's avatar
domenicw committed
48
49
50
51
        self.delegate.appIsFinished()
    }
    
}