From 338256206f5e11d7e21a714dedb461ae89281526 Mon Sep 17 00:00:00 2001 From: Nicholas Tay Date: Mon, 18 Jul 2022 10:24:49 +1000 Subject: 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. --- foray/Models/PenguinItemViewModel.swift | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'foray/Models/PenguinItemViewModel.swift') 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) + } + } } -- cgit