aboutsummaryrefslogtreecommitdiff
path: root/foray/Scenes/ForayTableViewController.swift
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/Scenes/ForayTableViewController.swift
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/Scenes/ForayTableViewController.swift16
1 files changed, 2 insertions, 14 deletions
diff --git a/foray/Scenes/ForayTableViewController.swift b/foray/Scenes/ForayTableViewController.swift
index 3d839a1..64ec086 100644
--- a/foray/Scenes/ForayTableViewController.swift
+++ b/foray/Scenes/ForayTableViewController.swift
@@ -80,21 +80,9 @@ class ForayTableViewController: UITableViewController, Coordinated {
}
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
- let item = self.sections[indexPath.section].items[indexPath.row]
-
- let type: String
- let icon: UIImage
- switch item.type {
- case .item:
- type = "Item"
- icon = UIImage(named: item.id) ?? UIImage.fromAsset(.it)
- case .quest:
- type = "Quest"
- icon = UIImage.fromAsset(.spy)
- }
-
guard let cell = tableView.dequeueReusableCell(withIdentifier: "ForayTableViewCell", for: indexPath) as? ForayTableViewCell else { return ForayTableViewCell() }
- cell.setData(name: item.name, desc: type + "ID: " + item.id, img: icon)
+ let item = self.sections[indexPath.section].items[indexPath.row]
+ cell.setData(name: item.name, desc: item.typeName + "ID: " + item.id, img: item.icon)
return cell
}