aboutsummaryrefslogblamecommitdiff
path: root/foray/ForayDetailViewController.swift
blob: eb5b5770b04f56e006dc690674e8f0c14792db7d (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11










                                                   
                                  









                                                         

                                   

                                  
                                       
                    
                                        

                                                   





                                                                                                  


     
//
//  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)
    }

}