aboutsummaryrefslogtreecommitdiff
path: root/foray
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--foray/ForayDetailViewController.swift2
-rw-r--r--foray/ForayTableViewController.swift26
2 files changed, 14 insertions, 14 deletions
diff --git a/foray/ForayDetailViewController.swift b/foray/ForayDetailViewController.swift
index 9c261ac..eb5b577 100644
--- a/foray/ForayDetailViewController.swift
+++ b/foray/ForayDetailViewController.swift
@@ -9,7 +9,7 @@ import UIKit
class ForayDetailViewController: UIViewController {
- var selectedItem: MyItem!
+ var selectedItem: PenguinItem!
@IBOutlet weak var titleLabel: UILabel!
@IBOutlet weak var imageView: UIImageView!
diff --git a/foray/ForayTableViewController.swift b/foray/ForayTableViewController.swift
index 0643051..c984634 100644
--- a/foray/ForayTableViewController.swift
+++ b/foray/ForayTableViewController.swift
@@ -12,7 +12,7 @@ enum ItemType: String, Decodable {
case quest
}
-struct MyItem: Decodable {
+struct PenguinItem: Decodable {
var type: ItemType
var releaseDate: Date
var id: String
@@ -21,7 +21,7 @@ struct MyItem: Decodable {
struct YearSection {
var year: Date
- var items: [MyItem]
+ var items: [PenguinItem]
}
class ForayTableViewCell: UITableViewCell {
@@ -47,7 +47,7 @@ class ForayTableViewController: UITableViewController {
// MARK: - Static data TEMP
- var items = [MyItem]()
+ var items = [PenguinItem]()
var sections = [YearSection]()
// MARK: - On load
@@ -95,16 +95,16 @@ class ForayTableViewController: UITableViewController {
})
}
- func loadApiData(onComplete: @escaping ([MyItem]) -> ()) {
+ func loadApiData(onComplete: @escaping ([PenguinItem]) -> ()) {
// return [
-// MyItem(type: .item, releaseDate: parseDate("2006-05-26"), id: "mh", name: "Miners Helmet"),
-// MyItem(type: .item, releaseDate: parseDate("2010-05-01"), id: "it", name: "Inner Tube"),
-// MyItem(type: .item, releaseDate: parseDate("2009-04-24"), id: "tbg", name: "Toboggan"),
-// MyItem(type: .item, releaseDate: parseDate("2006-03-29"), id: "spy", name: "Spy Phone"),
-// MyItem(type: .item, releaseDate: parseDate("2008-11-18"), id: "bnb", name: "Black Ninja Belt"),
-// MyItem(type: .quest, releaseDate: parseDate("2006-05-23"), id: "cmp", name: "Case of the Missing Puffles"),
-// MyItem(type: .quest, releaseDate: parseDate("2009-11-16"), id: "gsm", name: "G's Secret Mission"),
-// MyItem(type: .quest, releaseDate: parseDate("2009-04-18"), id: "cmc", name: "Case of the Missing Coins"),
+// PenguinItem(type: .item, releaseDate: parseDate("2006-05-26"), id: "mh", name: "Miners Helmet"),
+// PenguinItem(type: .item, releaseDate: parseDate("2010-05-01"), id: "it", name: "Inner Tube"),
+// PenguinItem(type: .item, releaseDate: parseDate("2009-04-24"), id: "tbg", name: "Toboggan"),
+// PenguinItem(type: .item, releaseDate: parseDate("2006-03-29"), id: "spy", name: "Spy Phone"),
+// PenguinItem(type: .item, releaseDate: parseDate("2008-11-18"), id: "bnb", name: "Black Ninja Belt"),
+// PenguinItem(type: .quest, releaseDate: parseDate("2006-05-23"), id: "cmp", name: "Case of the Missing Puffles"),
+// PenguinItem(type: .quest, releaseDate: parseDate("2009-11-16"), id: "gsm", name: "G's Secret Mission"),
+// PenguinItem(type: .quest, releaseDate: parseDate("2009-04-18"), id: "cmc", name: "Case of the Missing Coins"),
// ]
var request = URLRequest(url: URL(string: "https://.../dummy.json")!)
@@ -122,7 +122,7 @@ class ForayTableViewController: UITableViewController {
let dateStr = try container.decode(String.self)
return parseDate(dateStr)
})
- let items = try! jsonDecoder.decode([MyItem].self, from: data!)
+ let items = try! jsonDecoder.decode([PenguinItem].self, from: data!)
print("json decoded")
// Passing back to UI, need to do it on the main thread (I think due to async?)