aboutsummaryrefslogtreecommitdiff
path: root/foray/Models
diff options
context:
space:
mode:
authorNicholas Tay <nick@windblume.net>2022-07-18 10:24:49 +1000
committerNicholas Tay <nick@windblume.net>2022-07-18 10:26:05 +1000
commit338256206f5e11d7e21a714dedb461ae89281526 (patch)
treea67e03473a2f2e749e58b2babe532ace9d396826 /foray/Models
parent8b255702c674bf1bfeca96697711f6e4f088dfdb (diff)
downloadforayios-338256206f5e11d7e21a714dedb461ae89281526.tar.gz
forayios-338256206f5e11d7e21a714dedb461ae89281526.tar.bz2
forayios-338256206f5e11d7e21a714dedb461ae89281526.zip
Custom share sheet icons and load them with UIImage
Found that LPLinkMetadata + NSItemProvider can actually use UIImage. I think this is better now since not using a bundle load and can use assets.
Diffstat (limited to '')
-rw-r--r--foray/Models/PenguinItemViewModel.swift19
1 files changed, 19 insertions, 0 deletions
diff --git a/foray/Models/PenguinItemViewModel.swift b/foray/Models/PenguinItemViewModel.swift
index 9b9b058..dcaa16d 100644
--- a/foray/Models/PenguinItemViewModel.swift
+++ b/foray/Models/PenguinItemViewModel.swift
@@ -6,6 +6,7 @@
//
import Foundation
+import UIKit
struct PenguinItemViewModel {
let type: PenguinItemType
@@ -13,4 +14,22 @@ struct PenguinItemViewModel {
let year: Int
let id: String
let name: String
+
+ var typeName: String {
+ switch type {
+ case .item:
+ return "Item"
+ case .quest:
+ return "Quest"
+ }
+ }
+
+ var icon: UIImage {
+ switch type {
+ case .item:
+ return UIImage(named: id) ?? UIImage.fromAsset(.spy)
+ case .quest:
+ return UIImage.fromAsset(.spy)
+ }
+ }
}