aboutsummaryrefslogtreecommitdiff
path: root/foray/ForayDetailViewController.swift
blob: eb5b5770b04f56e006dc690674e8f0c14792db7d (plain) (blame)
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
//
//  ForayDetailViewController.swift
//  foray
//
//  Created by Nicholas Tay on 16/3/2022.
//

import UIKit

class ForayDetailViewController: UIViewController {
    
    var selectedItem: PenguinItem!

    @IBOutlet weak var titleLabel: UILabel!
    @IBOutlet weak var imageView: UIImageView!
    @IBOutlet weak var detailLabel: UILabel!
    
    override func viewDidLoad() {
        super.viewDidLoad()

        titleLabel.text = selectedItem.name
        imageView.image = UIImage(named: selectedItem.id)
        
        detailLabel.text = "Type: "
        switch selectedItem.type {
        case .item:
            detailLabel.text! += "Item"
        case .quest:
            detailLabel.text! += "Quest"
            imageView.image = UIImage(named: "spy")
        }
        
        detailLabel.text! += "\nID: " + selectedItem.id
        
        let dateFormatter = DateFormatter()
        dateFormatter.dateFormat = "yyyy-MM-dd"
        detailLabel.text! += "\nReleased: " + dateFormatter.string(from: selectedItem.releaseDate)
    }

}