diff options
author | Nicholas Tay <nick@windblume.net> | 2022-03-18 16:54:42 +1100 |
---|---|---|
committer | Nicholas Tay <nick@windblume.net> | 2022-03-18 16:54:42 +1100 |
commit | edd350814f47b5c528a0d0cb415a76ed551c1bf2 (patch) | |
tree | f351d169a6e4ec30cc91a957f579d90e28dd6767 /foray | |
parent | 5d421e18cd6c8e633e7ca61e0255b511e2af40a8 (diff) | |
download | forayios-edd350814f47b5c528a0d0cb415a76ed551c1bf2.tar.gz forayios-edd350814f47b5c528a0d0cb415a76ed551c1bf2.tar.bz2 forayios-edd350814f47b5c528a0d0cb415a76ed551c1bf2.zip |
Cleanup old prototype cells
Diffstat (limited to 'foray')
-rw-r--r-- | foray/Base.lproj/Main.storyboard | 113 | ||||
-rw-r--r-- | foray/ForayTableViewController.swift | 26 |
2 files changed, 6 insertions, 133 deletions
diff --git a/foray/Base.lproj/Main.storyboard b/foray/Base.lproj/Main.storyboard index 231af8c..dd31919 100644 --- a/foray/Base.lproj/Main.storyboard +++ b/foray/Base.lproj/Main.storyboard @@ -15,106 +15,6 @@ <tableView key="view" clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="60" estimatedRowHeight="-1" sectionHeaderHeight="28" estimatedSectionHeaderHeight="-1" sectionFooterHeight="28" estimatedSectionFooterHeight="-1" id="PLM-PE-uRW"> <rect key="frame" x="0.0" y="0.0" width="414" height="896"/> <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> - <prototypes> - <tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="default" indentationWidth="10" reuseIdentifier="ForayCell" id="kUp-cv-FIt" customClass="ForayTableViewCell" customModule="foray" customModuleProvider="target"> - <rect key="frame" x="0.0" y="44.5" width="414" height="60"/> - <autoresizingMask key="autoresizingMask"/> - <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" preservesSuperviewLayoutMargins="YES" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="kUp-cv-FIt" id="CDx-3g-1ZI"> - <rect key="frame" x="0.0" y="0.0" width="414" height="60"/> - <autoresizingMask key="autoresizingMask"/> - <subviews> - <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="jKN-aM-nKf"> - <rect key="frame" x="20" y="11" width="48" height="24"/> - <fontDescription key="fontDescription" type="system" pointSize="20"/> - <nil key="textColor"/> - <nil key="highlightedColor"/> - </label> - <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="z5f-A4-Dya"> - <rect key="frame" x="335" y="11" width="59" height="38"/> - <constraints> - <constraint firstAttribute="width" constant="59" id="cEP-8O-21m"/> - <constraint firstAttribute="height" constant="38" id="l2f-tB-2kn"/> - </constraints> - </imageView> - <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="M3N-lx-IrZ"> - <rect key="frame" x="20" y="35" width="26.5" height="12"/> - <fontDescription key="fontDescription" type="system" pointSize="10"/> - <nil key="textColor"/> - <nil key="highlightedColor"/> - </label> - </subviews> - <constraints> - <constraint firstItem="M3N-lx-IrZ" firstAttribute="leading" secondItem="CDx-3g-1ZI" secondAttribute="leadingMargin" id="KeF-RN-wyV"/> - <constraint firstAttribute="trailingMargin" secondItem="z5f-A4-Dya" secondAttribute="trailing" id="UCW-gu-rZA"/> - <constraint firstItem="M3N-lx-IrZ" firstAttribute="top" secondItem="jKN-aM-nKf" secondAttribute="bottom" id="VDg-QZ-gcI"/> - <constraint firstItem="z5f-A4-Dya" firstAttribute="top" secondItem="CDx-3g-1ZI" secondAttribute="topMargin" id="dKR-yJ-oZX"/> - <constraint firstItem="jKN-aM-nKf" firstAttribute="top" secondItem="CDx-3g-1ZI" secondAttribute="topMargin" id="kVc-EV-Ha7"/> - <constraint firstAttribute="bottomMargin" secondItem="z5f-A4-Dya" secondAttribute="bottom" id="uQ1-WF-3rj"/> - <constraint firstItem="jKN-aM-nKf" firstAttribute="leading" secondItem="CDx-3g-1ZI" secondAttribute="leadingMargin" id="zwv-y1-sL8"/> - </constraints> - </tableViewCellContentView> - <connections> - <outlet property="cellItemImage" destination="z5f-A4-Dya" id="NTq-uY-NQQ"/> - <outlet property="cellItemName" destination="jKN-aM-nKf" id="G3W-mL-GPh"/> - <outlet property="cellItemSubtitle" destination="M3N-lx-IrZ" id="cXh-X9-bBs"/> - <segue destination="8GL-ME-btj" kind="show" id="jtV-rb-2Wu"/> - </connections> - </tableViewCell> - <tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="default" indentationWidth="10" reuseIdentifier="ForayQuestCell" id="sac-28-Cry" customClass="ForayTableViewCell" customModule="foray" customModuleProvider="target"> - <rect key="frame" x="0.0" y="104.5" width="414" height="60"/> - <autoresizingMask key="autoresizingMask"/> - <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" preservesSuperviewLayoutMargins="YES" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="sac-28-Cry" id="IdU-MR-tpK"> - <rect key="frame" x="0.0" y="0.0" width="414" height="60"/> - <autoresizingMask key="autoresizingMask"/> - <subviews> - <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Nba-Kh-67y"> - <rect key="frame" x="20" y="11" width="265" height="24"/> - <fontDescription key="fontDescription" type="system" pointSize="20"/> - <nil key="textColor"/> - <nil key="highlightedColor"/> - </label> - <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="spy" translatesAutoresizingMaskIntoConstraints="NO" id="ZpN-1x-wiY"> - <rect key="frame" x="335" y="11" width="59" height="38"/> - <constraints> - <constraint firstAttribute="height" constant="38" id="D8r-cM-iXE"/> - <constraint firstAttribute="width" constant="59" id="ozc-KT-4QY"/> - </constraints> - </imageView> - <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="n6u-bY-nfG"> - <rect key="frame" x="20" y="35" width="265" height="12"/> - <fontDescription key="fontDescription" type="system" pointSize="10"/> - <nil key="textColor"/> - <nil key="highlightedColor"/> - </label> - <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="QUEST" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="mFP-n7-yqT"> - <rect key="frame" x="10" y="0.0" width="40.5" height="14.5"/> - <fontDescription key="fontDescription" type="italicSystem" pointSize="12"/> - <color key="textColor" systemColor="systemOrangeColor"/> - <nil key="highlightedColor"/> - </label> - </subviews> - <constraints> - <constraint firstItem="ZpN-1x-wiY" firstAttribute="top" secondItem="IdU-MR-tpK" secondAttribute="topMargin" id="8Jf-ts-z1R"/> - <constraint firstItem="Nba-Kh-67y" firstAttribute="leading" secondItem="IdU-MR-tpK" secondAttribute="leadingMargin" id="CAg-wX-hDK"/> - <constraint firstItem="n6u-bY-nfG" firstAttribute="top" secondItem="Nba-Kh-67y" secondAttribute="bottom" id="DIu-kt-ees"/> - <constraint firstAttribute="bottomMargin" secondItem="ZpN-1x-wiY" secondAttribute="bottom" id="RES-c1-6zK"/> - <constraint firstItem="ZpN-1x-wiY" firstAttribute="leading" secondItem="n6u-bY-nfG" secondAttribute="trailing" constant="50" id="Rf6-oe-ma3"/> - <constraint firstItem="ZpN-1x-wiY" firstAttribute="leading" secondItem="Nba-Kh-67y" secondAttribute="trailing" constant="50" id="Rk8-TC-7Zl"/> - <constraint firstAttribute="trailingMargin" secondItem="ZpN-1x-wiY" secondAttribute="trailing" id="S2Y-mc-a4w"/> - <constraint firstItem="mFP-n7-yqT" firstAttribute="leading" secondItem="IdU-MR-tpK" secondAttribute="leading" constant="10" id="SJX-QO-mMB"/> - <constraint firstItem="Nba-Kh-67y" firstAttribute="top" secondItem="IdU-MR-tpK" secondAttribute="topMargin" id="l9z-W9-Hg6"/> - <constraint firstItem="n6u-bY-nfG" firstAttribute="leading" secondItem="IdU-MR-tpK" secondAttribute="leadingMargin" id="lch-UF-tgt"/> - <constraint firstItem="mFP-n7-yqT" firstAttribute="top" secondItem="IdU-MR-tpK" secondAttribute="top" id="oi5-CN-YSA"/> - </constraints> - </tableViewCellContentView> - <connections> - <outlet property="cellItemImage" destination="ZpN-1x-wiY" id="ydK-D6-Kii"/> - <outlet property="cellItemName" destination="Nba-Kh-67y" id="lOq-hq-b38"/> - <outlet property="cellItemSubtitle" destination="n6u-bY-nfG" id="sJh-Cy-jKm"/> - <segue destination="8GL-ME-btj" kind="show" id="dWq-Z4-mZP"/> - </connections> - </tableViewCell> - </prototypes> <sections/> <connections> <outlet property="dataSource" destination="wzT-eD-ghF" id="VID-cT-ap6"/> @@ -140,19 +40,19 @@ <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> <subviews> <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="aBf-Zs-Jkz"> - <rect key="frame" x="0.0" y="178" width="414" height="200"/> + <rect key="frame" x="0.0" y="134" width="414" height="200"/> <constraints> <constraint firstAttribute="height" constant="200" id="hSS-D1-lO9"/> </constraints> </imageView> <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="center" lineBreakMode="tailTruncation" numberOfLines="3" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="aP2-hq-U5p"> - <rect key="frame" x="16" y="104" width="382" height="42"/> + <rect key="frame" x="16" y="60" width="382" height="42"/> <fontDescription key="fontDescription" type="boldSystem" pointSize="35"/> <nil key="textColor"/> <nil key="highlightedColor"/> </label> <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" lineBreakMode="tailTruncation" numberOfLines="6" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="odL-rc-3m5"> - <rect key="frame" x="16" y="410" width="382" height="20.5"/> + <rect key="frame" x="16" y="366" width="382" height="20.5"/> <fontDescription key="fontDescription" type="system" pointSize="17"/> <nil key="textColor"/> <nil key="highlightedColor"/> @@ -202,16 +102,9 @@ <point key="canvasLocation" x="-462.31884057971018" y="51.5625"/> </scene> </scenes> - <inferredMetricsTieBreakers> - <segue reference="dWq-Z4-mZP"/> - </inferredMetricsTieBreakers> <resources> - <image name="spy" width="700" height="490"/> <systemColor name="systemBackgroundColor"> <color white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/> </systemColor> - <systemColor name="systemOrangeColor"> - <color red="1" green="0.58431372549019611" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> - </systemColor> </resources> </document> diff --git a/foray/ForayTableViewController.swift b/foray/ForayTableViewController.swift index 6a0baa1..2a0188e 100644 --- a/foray/ForayTableViewController.swift +++ b/foray/ForayTableViewController.swift @@ -24,13 +24,6 @@ struct YearSection { var items: [PenguinItem] } -class ForayTableViewCell: UITableViewCell { - @IBOutlet weak var cellItemName: UILabel! - @IBOutlet weak var cellItemSubtitle: UILabel! - @IBOutlet weak var cellItemImage: UIImageView! -} - -// copied from sample project private func parseDate(_ str : String) -> Date { let dateFormat = DateFormatter() dateFormat.dateFormat = "yyyy-MM-dd" @@ -47,7 +40,6 @@ class ForayTableViewController: UITableViewController { // MARK: - Static data TEMP - var items = [PenguinItem]() var sections = [YearSection]() // MARK: - On load @@ -77,17 +69,16 @@ class ForayTableViewController: UITableViewController { self.refreshControl?.addTarget(self, action: #selector(doRefresh), for: UIControl.Event.valueChanged) } - // Not sure why need @objc. Is it due to class private/public? @objc func doRefresh(sender: AnyObject) { reloadApiData() } func reloadApiData() { loadApiData(onComplete: { (apiItems) in - self.items = apiItems - self.items.sort { (lhs, rhs) in lhs.releaseDate < rhs.releaseDate } + var items = apiItems + items.sort { (lhs, rhs) in lhs.releaseDate < rhs.releaseDate } - let groups = Dictionary(grouping: self.items) { (item) in + let groups = Dictionary(grouping: apiItems) { (item) in return firstDayOfYear(date: item.releaseDate) } self.sections = groups.map { (key, values) in @@ -102,17 +93,6 @@ class ForayTableViewController: UITableViewController { } func loadApiData(onComplete: @escaping ([PenguinItem]) -> ()) { -// return [ -// 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://users.windblume.net/~nick/upload/dummy.json")!) request.cachePolicy = .reloadRevalidatingCacheData // Needed otherwise default caching policy seems not to check properly |