aboutsummaryrefslogtreecommitdiff
path: root/foray/ForayNewDetailView.swift
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--foray/ForayNewDetailView.swift86
1 files changed, 0 insertions, 86 deletions
diff --git a/foray/ForayNewDetailView.swift b/foray/ForayNewDetailView.swift
deleted file mode 100644
index e8e2262..0000000
--- a/foray/ForayNewDetailView.swift
+++ /dev/null
@@ -1,86 +0,0 @@
-//
-// ForayNewDetailView.swift
-// foray
-//
-// Created by Nicholas Tay on 18/3/2022.
-//
-
-import UIKit
-
-class ForayNewDetailView: UIView {
-
- let nameLabel: UILabel = {
- let l = UILabel()
- l.font = UIFont.preferredFont(forTextStyle: .largeTitle)
- l.adjustsFontForContentSizeCategory = true
- l.numberOfLines = 3
- l.textAlignment = .center
- return l
- }()
-
- let itemImageView: UIImageView = {
- let iv = UIImageView()
- iv.contentMode = .scaleAspectFit
- return iv
- }()
-
- let descLabel: UILabel = {
- let l = UILabel()
- l.font = UIFont.preferredFont(forTextStyle: .body)
- l.adjustsFontForContentSizeCategory = true
- l.numberOfLines = 10
- return l
- }()
-
- override init(frame: CGRect) {
- super.init(frame: frame)
- initialiseViews()
- }
-
- required init?(coder: NSCoder) {
- fatalError("unreachable")
- }
-
- private func initialiseViews() {
- addSubview(nameLabel)
- addSubview(itemImageView)
- addSubview(descLabel)
- setupConstraints()
- }
-
- private func setupConstraints() {
- nameLabel.snp.makeConstraints { (make) in
- make.top.equalToSuperview().inset(8)
- make.leading.trailing.equalToSuperview().inset(8)
- }
- itemImageView.snp.makeConstraints { (make) in
- make.top.equalTo(nameLabel.snp.bottom).offset(32)
- make.leading.trailing.equalToSuperview()
- make.height.equalTo(150)
- }
- descLabel.snp.makeConstraints { (make) in
- make.top.equalTo(itemImageView.snp.bottom).offset(32)
- make.leading.trailing.equalToSuperview()
- }
- }
-
- public func setSelectedItem(selectedItem: PenguinItem) {
- nameLabel.text = selectedItem.name
- itemImageView.image = UIImage(named: selectedItem.id)
-
- descLabel.text = "Type: "
- switch selectedItem.type {
- case .item:
- descLabel.text! += "Item"
- case .quest:
- descLabel.text! += "Quest"
- itemImageView.image = UIImage(named: "spy")
- }
-
- descLabel.text! += "\nID: " + selectedItem.id
-
- let dateFormatter = DateFormatter()
- dateFormatter.dateFormat = "yyyy-MM-dd"
- descLabel.text! += "\nReleased: " + dateFormatter.string(from: selectedItem.releaseDate)
- }
-}