AmivMicroAppModel.swift 1.22 KB
Newer Older
domenicw's avatar
domenicw committed
1
//
domenicw's avatar
domenicw committed
2
//  AmivMicroAppModelModel.swift
domenicw's avatar
domenicw committed
3
4
5
6
7
8
9
10
11
//  Amiv
//
//  Created by Domenic Wüthrich on 18.09.18.
//  Copyright © 2018 Amiv an der ETH. All rights reserved.
//

import Foundation
import UIKit

domenicw's avatar
domenicw committed
12
public struct AmivMicroAppModel {
domenicw's avatar
domenicw committed
13
    
domenicw's avatar
domenicw committed
14
    public let app: AmivMicroAppType
domenicw's avatar
domenicw committed
15
16
17
    
    public let title: String
    
18
19
    public let subtitle: String
    
domenicw's avatar
domenicw committed
20
21
22
23
    public let image: UIImage?
    
    // MARK: - Initializers
    
24
    public init(app: AmivMicroAppType, title: String, subtitle: String, image: UIImage?) {
domenicw's avatar
domenicw committed
25
26
        self.app = app
        self.title = title
27
        self.subtitle = subtitle
domenicw's avatar
domenicw committed
28
29
30
31
32
        self.image = image
    }
    
}

domenicw's avatar
domenicw committed
33
extension AmivMicroAppModel {
domenicw's avatar
domenicw committed
34
    
domenicw's avatar
domenicw committed
35
36
    public static func createModels() -> [AmivMicroAppModel] {
        let models: [AmivMicroAppModel] = [.createCheckinModel(), .createBarcodeModel()]
domenicw's avatar
domenicw committed
37
38
39
        return models
    }
    
domenicw's avatar
domenicw committed
40
    public static func createCheckinModel() -> AmivMicroAppModel {
41
        return self.init(app: .checkin, title: "Checkin", subtitle: "Checkin AMIV Members in and out of AMIV events.", image: nil)
domenicw's avatar
domenicw committed
42
43
    }
    
domenicw's avatar
domenicw committed
44
    public static func createBarcodeModel() -> AmivMicroAppModel {
45
        return self.init(app: .barcode, title: "Barcode", subtitle: "Display your legi barcode digitally.", image: nil)
domenicw's avatar
domenicw committed
46
47
48
    }

}