aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--foray/Coordinators/ForayCoordinator.swift15
-rw-r--r--foray/Scenes/ForayDetailViewController.swift17
2 files changed, 16 insertions, 16 deletions
diff --git a/foray/Coordinators/ForayCoordinator.swift b/foray/Coordinators/ForayCoordinator.swift
index 6c4bb3f..bb0c407 100644
--- a/foray/Coordinators/ForayCoordinator.swift
+++ b/foray/Coordinators/ForayCoordinator.swift
@@ -34,20 +34,7 @@ class ForayCoordinator: Coordinator {
let detailViewController = ForayDetailViewController()
func showDetails(item: PenguinItemViewModel) {
- let image: UIImage
- var description: String = "Type: "
- switch item.type {
- case .item:
- description += "Item"
- image = UIImage(named: item.id)!
- case .quest:
- description += "Quest"
- image = UIImage(named: "spy")!
- }
- description += "\nID: " + item.id
- description += "\nReleased: " + item.releaseDateFormatted
-
- detailViewController.setDetails(name: item.name, description: description, image: image)
+ detailViewController.setDetails(item: item)
push(vc: detailViewController)
}
diff --git a/foray/Scenes/ForayDetailViewController.swift b/foray/Scenes/ForayDetailViewController.swift
index c676df6..85b2929 100644
--- a/foray/Scenes/ForayDetailViewController.swift
+++ b/foray/Scenes/ForayDetailViewController.swift
@@ -22,8 +22,21 @@ class ForayDetailViewController: UIViewController, HasCustomView, ForayCoordinat
view = ForayDetailView()
}
- public func setDetails(name: String, description: String, image: UIImage) {
- self.customView.setDetails(name: name, description: description, image: image)
+ public func setDetails(item: PenguinItemViewModel) {
+ let image: UIImage
+ var description: String = "Type: "
+ switch item.type {
+ case .item:
+ description += "Item"
+ image = UIImage(named: item.id)!
+ case .quest:
+ description += "Quest"
+ image = UIImage(named: "spy")!
+ }
+ description += "\nID: " + item.id
+ description += "\nReleased: " + item.releaseDateFormatted
+
+ self.customView.setDetails(name: item.name, description: description, image: image)
}
}