diff options
author | Nicholas Tay <nick@windblume.net> | 2022-03-14 15:47:36 +1100 |
---|---|---|
committer | Nicholas Tay <nick@windblume.net> | 2022-03-14 16:06:32 +1100 |
commit | a8c3db459cc1be105dd910efb8bbc08bc163fb91 (patch) | |
tree | 2a523f0a71adc1be28fff0c9881e43f579ce3ab1 | |
parent | 2dc7c2df9ba4f6201d3dcefaa77a52425a65e2c7 (diff) | |
download | forayios-a8c3db459cc1be105dd910efb8bbc08bc163fb91.tar.gz forayios-a8c3db459cc1be105dd910efb8bbc08bc163fb91.tar.bz2 forayios-a8c3db459cc1be105dd910efb8bbc08bc163fb91.zip |
Learning UITableViewController: array data + custom cells
Forgot to commit after finishing just the using array data bit. So committing with the custom cells done.
https://www.ralfebert.com/ios-examples/uikit/uitableviewcontroller/
Diffstat (limited to '')
30 files changed, 250 insertions, 36 deletions
diff --git a/foray.xcodeproj/project.pbxproj b/foray.xcodeproj/project.pbxproj index 52d5a18..6df1a30 100644 --- a/foray.xcodeproj/project.pbxproj +++ b/foray.xcodeproj/project.pbxproj @@ -9,21 +9,21 @@ /* Begin PBXBuildFile section */ C04B45A427DEF117001451A3 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = C04B45A327DEF117001451A3 /* AppDelegate.swift */; }; C04B45A627DEF117001451A3 /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = C04B45A527DEF117001451A3 /* SceneDelegate.swift */; }; - C04B45A827DEF117001451A3 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = C04B45A727DEF117001451A3 /* ViewController.swift */; }; C04B45AB27DEF117001451A3 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = C04B45A927DEF117001451A3 /* Main.storyboard */; }; C04B45AD27DEF118001451A3 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = C04B45AC27DEF118001451A3 /* Assets.xcassets */; }; C04B45B027DEF118001451A3 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = C04B45AE27DEF118001451A3 /* LaunchScreen.storyboard */; }; + C04B45B827DEF2ED001451A3 /* ForayTableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = C04B45B727DEF2ED001451A3 /* ForayTableViewController.swift */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ C04B45A027DEF117001451A3 /* foray.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = foray.app; sourceTree = BUILT_PRODUCTS_DIR; }; C04B45A327DEF117001451A3 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; }; C04B45A527DEF117001451A3 /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = "<group>"; }; - C04B45A727DEF117001451A3 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = "<group>"; }; C04B45AA27DEF117001451A3 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; }; C04B45AC27DEF118001451A3 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; }; C04B45AF27DEF118001451A3 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; }; C04B45B127DEF118001451A3 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; }; + C04B45B727DEF2ED001451A3 /* ForayTableViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ForayTableViewController.swift; sourceTree = "<group>"; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -58,8 +58,8 @@ children = ( C04B45A327DEF117001451A3 /* AppDelegate.swift */, C04B45A527DEF117001451A3 /* SceneDelegate.swift */, - C04B45A727DEF117001451A3 /* ViewController.swift */, C04B45A927DEF117001451A3 /* Main.storyboard */, + C04B45B727DEF2ED001451A3 /* ForayTableViewController.swift */, C04B45AC27DEF118001451A3 /* Assets.xcassets */, C04B45AE27DEF118001451A3 /* LaunchScreen.storyboard */, C04B45B127DEF118001451A3 /* Info.plist */, @@ -138,7 +138,7 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - C04B45A827DEF117001451A3 /* ViewController.swift in Sources */, + C04B45B827DEF2ED001451A3 /* ForayTableViewController.swift in Sources */, C04B45A427DEF117001451A3 /* AppDelegate.swift in Sources */, C04B45A627DEF117001451A3 /* SceneDelegate.swift in Sources */, ); @@ -292,6 +292,7 @@ DEVELOPMENT_TEAM = 6DXVFJU35J; GENERATE_INFOPLIST_FILE = YES; INFOPLIST_FILE = foray/Info.plist; + INFOPLIST_KEY_CFBundleDisplayName = Foray; INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; INFOPLIST_KEY_UILaunchStoryboardName = LaunchScreen; INFOPLIST_KEY_UIMainStoryboardFile = Main; @@ -320,6 +321,7 @@ DEVELOPMENT_TEAM = 6DXVFJU35J; GENERATE_INFOPLIST_FILE = YES; INFOPLIST_FILE = foray/Info.plist; + INFOPLIST_KEY_CFBundleDisplayName = Foray; INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; INFOPLIST_KEY_UILaunchStoryboardName = LaunchScreen; INFOPLIST_KEY_UIMainStoryboardFile = Main; diff --git a/foray/Assets.xcassets/AppIcon.appiconset/Contents.json b/foray/Assets.xcassets/AppIcon.appiconset/Contents.json index 9221b9b..995ee2f 100644 --- a/foray/Assets.xcassets/AppIcon.appiconset/Contents.json +++ b/foray/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -1,91 +1,109 @@ { "images" : [ { + "filename" : "rbt-20@2x.png", "idiom" : "iphone", "scale" : "2x", "size" : "20x20" }, { + "filename" : "rbt-20@3x.png", "idiom" : "iphone", "scale" : "3x", "size" : "20x20" }, { + "filename" : "rbt-29@2x.png", "idiom" : "iphone", "scale" : "2x", "size" : "29x29" }, { + "filename" : "rbt-29@3x.png", "idiom" : "iphone", "scale" : "3x", "size" : "29x29" }, { + "filename" : "rbt-40@2x.png", "idiom" : "iphone", "scale" : "2x", "size" : "40x40" }, { + "filename" : "rbt-40@3x.png", "idiom" : "iphone", "scale" : "3x", "size" : "40x40" }, { + "filename" : "rbt-60@2x.png", "idiom" : "iphone", "scale" : "2x", "size" : "60x60" }, { + "filename" : "rbt-60@3x.png", "idiom" : "iphone", "scale" : "3x", "size" : "60x60" }, { + "filename" : "rbt-20.png", "idiom" : "ipad", "scale" : "1x", "size" : "20x20" }, { + "filename" : "rbt-20@2x.png", "idiom" : "ipad", "scale" : "2x", "size" : "20x20" }, { + "filename" : "rbt-29.png", "idiom" : "ipad", "scale" : "1x", "size" : "29x29" }, { + "filename" : "rbt-29@2x.png", "idiom" : "ipad", "scale" : "2x", "size" : "29x29" }, { + "filename" : "rbt-40.png", "idiom" : "ipad", "scale" : "1x", "size" : "40x40" }, { + "filename" : "rbt-40@2x.png", "idiom" : "ipad", "scale" : "2x", "size" : "40x40" }, { + "filename" : "rbt-76.png", "idiom" : "ipad", "scale" : "1x", "size" : "76x76" }, { + "filename" : "rbt-76@2x.png", "idiom" : "ipad", "scale" : "2x", "size" : "76x76" }, { + "filename" : "rbt-83.5@2x.png", "idiom" : "ipad", "scale" : "2x", "size" : "83.5x83.5" }, { + "filename" : "rbt-1024.png", "idiom" : "ios-marketing", "scale" : "1x", "size" : "1024x1024" diff --git a/foray/Assets.xcassets/AppIcon.appiconset/rbt-1024.png b/foray/Assets.xcassets/AppIcon.appiconset/rbt-1024.png Binary files differnew file mode 100644 index 0000000..0497ff3 --- /dev/null +++ b/foray/Assets.xcassets/AppIcon.appiconset/rbt-1024.png diff --git a/foray/Assets.xcassets/AppIcon.appiconset/rbt-20.png b/foray/Assets.xcassets/AppIcon.appiconset/rbt-20.png Binary files differnew file mode 100644 index 0000000..7227ece --- /dev/null +++ b/foray/Assets.xcassets/AppIcon.appiconset/rbt-20.png diff --git a/foray/Assets.xcassets/AppIcon.appiconset/rbt-20@2x.png b/foray/Assets.xcassets/AppIcon.appiconset/rbt-20@2x.png Binary files differnew file mode 100644 index 0000000..a8e97e9 --- /dev/null +++ b/foray/Assets.xcassets/AppIcon.appiconset/rbt-20@2x.png diff --git a/foray/Assets.xcassets/AppIcon.appiconset/rbt-20@3x.png b/foray/Assets.xcassets/AppIcon.appiconset/rbt-20@3x.png Binary files differnew file mode 100644 index 0000000..e4738a9 --- /dev/null +++ b/foray/Assets.xcassets/AppIcon.appiconset/rbt-20@3x.png diff --git a/foray/Assets.xcassets/AppIcon.appiconset/rbt-29.png b/foray/Assets.xcassets/AppIcon.appiconset/rbt-29.png Binary files differnew file mode 100644 index 0000000..bb7c736 --- /dev/null +++ b/foray/Assets.xcassets/AppIcon.appiconset/rbt-29.png diff --git a/foray/Assets.xcassets/AppIcon.appiconset/rbt-29@2x.png b/foray/Assets.xcassets/AppIcon.appiconset/rbt-29@2x.png Binary files differnew file mode 100644 index 0000000..5415390 --- /dev/null +++ b/foray/Assets.xcassets/AppIcon.appiconset/rbt-29@2x.png diff --git a/foray/Assets.xcassets/AppIcon.appiconset/rbt-29@3x.png b/foray/Assets.xcassets/AppIcon.appiconset/rbt-29@3x.png Binary files differnew file mode 100644 index 0000000..d884864 --- /dev/null +++ b/foray/Assets.xcassets/AppIcon.appiconset/rbt-29@3x.png diff --git a/foray/Assets.xcassets/AppIcon.appiconset/rbt-40.png b/foray/Assets.xcassets/AppIcon.appiconset/rbt-40.png Binary files differnew file mode 100644 index 0000000..a8e97e9 --- /dev/null +++ b/foray/Assets.xcassets/AppIcon.appiconset/rbt-40.png diff --git a/foray/Assets.xcassets/AppIcon.appiconset/rbt-40@2x.png b/foray/Assets.xcassets/AppIcon.appiconset/rbt-40@2x.png Binary files differnew file mode 100644 index 0000000..e4f5b5e --- /dev/null +++ b/foray/Assets.xcassets/AppIcon.appiconset/rbt-40@2x.png diff --git a/foray/Assets.xcassets/AppIcon.appiconset/rbt-40@3x.png b/foray/Assets.xcassets/AppIcon.appiconset/rbt-40@3x.png Binary files differnew file mode 100644 index 0000000..3f6ad84 --- /dev/null +++ b/foray/Assets.xcassets/AppIcon.appiconset/rbt-40@3x.png diff --git a/foray/Assets.xcassets/AppIcon.appiconset/rbt-60@2x.png b/foray/Assets.xcassets/AppIcon.appiconset/rbt-60@2x.png Binary files differnew file mode 100644 index 0000000..3f6ad84 --- /dev/null +++ b/foray/Assets.xcassets/AppIcon.appiconset/rbt-60@2x.png diff --git a/foray/Assets.xcassets/AppIcon.appiconset/rbt-60@3x.png b/foray/Assets.xcassets/AppIcon.appiconset/rbt-60@3x.png Binary files differnew file mode 100644 index 0000000..387990b --- /dev/null +++ b/foray/Assets.xcassets/AppIcon.appiconset/rbt-60@3x.png diff --git a/foray/Assets.xcassets/AppIcon.appiconset/rbt-76.png b/foray/Assets.xcassets/AppIcon.appiconset/rbt-76.png Binary files differnew file mode 100644 index 0000000..a099901 --- /dev/null +++ b/foray/Assets.xcassets/AppIcon.appiconset/rbt-76.png diff --git a/foray/Assets.xcassets/AppIcon.appiconset/rbt-76@2x.png b/foray/Assets.xcassets/AppIcon.appiconset/rbt-76@2x.png Binary files differnew file mode 100644 index 0000000..c3087cb --- /dev/null +++ b/foray/Assets.xcassets/AppIcon.appiconset/rbt-76@2x.png diff --git a/foray/Assets.xcassets/AppIcon.appiconset/rbt-83.5@2x.png b/foray/Assets.xcassets/AppIcon.appiconset/rbt-83.5@2x.png Binary files differnew file mode 100644 index 0000000..7f60014 --- /dev/null +++ b/foray/Assets.xcassets/AppIcon.appiconset/rbt-83.5@2x.png diff --git a/foray/Assets.xcassets/bnb.imageset/Contents.json b/foray/Assets.xcassets/bnb.imageset/Contents.json new file mode 100644 index 0000000..754ecd5 --- /dev/null +++ b/foray/Assets.xcassets/bnb.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "filename" : "bnb.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/foray/Assets.xcassets/bnb.imageset/bnb.png b/foray/Assets.xcassets/bnb.imageset/bnb.png Binary files differnew file mode 100644 index 0000000..d7fed27 --- /dev/null +++ b/foray/Assets.xcassets/bnb.imageset/bnb.png diff --git a/foray/Assets.xcassets/it.imageset/Contents.json b/foray/Assets.xcassets/it.imageset/Contents.json new file mode 100644 index 0000000..505c0ec --- /dev/null +++ b/foray/Assets.xcassets/it.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "filename" : "it.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/foray/Assets.xcassets/it.imageset/it.png b/foray/Assets.xcassets/it.imageset/it.png Binary files differnew file mode 100644 index 0000000..da65be4 --- /dev/null +++ b/foray/Assets.xcassets/it.imageset/it.png diff --git a/foray/Assets.xcassets/mh.imageset/Contents.json b/foray/Assets.xcassets/mh.imageset/Contents.json new file mode 100644 index 0000000..b2edaaa --- /dev/null +++ b/foray/Assets.xcassets/mh.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "filename" : "mh.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/foray/Assets.xcassets/mh.imageset/mh.png b/foray/Assets.xcassets/mh.imageset/mh.png Binary files differnew file mode 100644 index 0000000..22f9125 --- /dev/null +++ b/foray/Assets.xcassets/mh.imageset/mh.png diff --git a/foray/Assets.xcassets/spy.imageset/Contents.json b/foray/Assets.xcassets/spy.imageset/Contents.json new file mode 100644 index 0000000..feac6bb --- /dev/null +++ b/foray/Assets.xcassets/spy.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "filename" : "spy.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/foray/Assets.xcassets/spy.imageset/spy.png b/foray/Assets.xcassets/spy.imageset/spy.png Binary files differnew file mode 100644 index 0000000..c8d88df --- /dev/null +++ b/foray/Assets.xcassets/spy.imageset/spy.png diff --git a/foray/Assets.xcassets/tbg.imageset/Contents.json b/foray/Assets.xcassets/tbg.imageset/Contents.json new file mode 100644 index 0000000..eca59d1 --- /dev/null +++ b/foray/Assets.xcassets/tbg.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "filename" : "tbg.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/foray/Assets.xcassets/tbg.imageset/tbg.png b/foray/Assets.xcassets/tbg.imageset/tbg.png Binary files differnew file mode 100644 index 0000000..83018da --- /dev/null +++ b/foray/Assets.xcassets/tbg.imageset/tbg.png diff --git a/foray/Base.lproj/Main.storyboard b/foray/Base.lproj/Main.storyboard index 25a7638..7af2493 100644 --- a/foray/Base.lproj/Main.storyboard +++ b/foray/Base.lproj/Main.storyboard @@ -1,24 +1,73 @@ <?xml version="1.0" encoding="UTF-8"?> -<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="13122.16" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="BYZ-38-t0r"> +<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="19529" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="wzT-eD-ghF"> + <device id="retina6_1" orientation="portrait" appearance="light"/> <dependencies> - <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13104.12"/> - <capability name="Safe area layout guides" minToolsVersion="9.0"/> + <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="19529"/> <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/> </dependencies> <scenes> - <!--View Controller--> - <scene sceneID="tne-QT-ifu"> + <!--Foray Table View Controller--> + <scene sceneID="YPJ-bK-iaL"> <objects> - <viewController id="BYZ-38-t0r" customClass="ViewController" customModuleProvider="target" sceneMemberID="viewController"> - <view key="view" contentMode="scaleToFill" id="8bC-Xf-vdC"> - <rect key="frame" x="0.0" y="0.0" width="375" height="667"/> + <tableViewController id="wzT-eD-ghF" customClass="ForayTableViewController" customModule="foray" customModuleProvider="target" sceneMemberID="viewController"> + <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"/> - <color key="backgroundColor" xcode11CocoaTouchSystemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/> - <viewLayoutGuide key="safeArea" id="6Tk-OE-BBY"/> - </view> - </viewController> - <placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/> + <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"/> + </connections> + </tableViewCell> + </prototypes> + <sections/> + <connections> + <outlet property="dataSource" destination="wzT-eD-ghF" id="VID-cT-ap6"/> + <outlet property="delegate" destination="wzT-eD-ghF" id="Pqi-RZ-Q7p"/> + </connections> + </tableView> + </tableViewController> + <placeholder placeholderIdentifier="IBFirstResponder" id="pPD-Wc-Rc9" userLabel="First Responder" customClass="UIResponder" sceneMemberID="firstResponder"/> </objects> + <point key="canvasLocation" x="-462.31884057971018" y="51.5625"/> </scene> </scenes> </document> diff --git a/foray/ForayTableViewController.swift b/foray/ForayTableViewController.swift new file mode 100644 index 0000000..66e9274 --- /dev/null +++ b/foray/ForayTableViewController.swift @@ -0,0 +1,59 @@ +// +// ForayTableViewController.swift +// foray +// +// Created by Nicholas Tay on 14/3/2022. +// + +import UIKit + +struct MyItem { + var id: String + var name: String +} + +class ForayTableViewCell: UITableViewCell { + @IBOutlet weak var cellItemName: UILabel! + @IBOutlet weak var cellItemSubtitle: UILabel! + @IBOutlet weak var cellItemImage: UIImageView! +} + +class ForayTableViewController: UITableViewController { + + // MARK: - Static data TEMP + + let items = [ + MyItem(id: "mh", name: "Miners Helmet"), + MyItem(id: "it", name: "Inner Tube"), + MyItem(id: "tbg", name: "Toboggan"), + MyItem(id: "spy", name: "Spy Phone"), + MyItem(id: "bnb", name: "Black Ninja Belt"), + ] + + // MARK: - Table view data source + + override func numberOfSections(in tableView: UITableView) -> Int { + // Returns number of sections for table + return 1 + } + + override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { + // Returns number of rows for table + return items.count + } + + override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { + let cell = tableView.dequeueReusableCell(withIdentifier: "ForayCell", for: indexPath) as! ForayTableViewCell + + let item = items[indexPath.row] + cell.cellItemName?.text = item.name + cell.cellItemSubtitle?.text = "Item ID: \(item.id)" + cell.cellItemImage?.image = UIImage(named: item.id) + + return cell + } + + override func tableView(_ tableView: UITableView, titleForHeaderInSection section: Int) -> String? { + return "Section \(section)" + } +} diff --git a/foray/ViewController.swift b/foray/ViewController.swift deleted file mode 100644 index 7b442c4..0000000 --- a/foray/ViewController.swift +++ /dev/null @@ -1,19 +0,0 @@ -// -// ViewController.swift -// foray -// -// Created by Nicholas Tay on 14/3/2022. -// - -import UIKit - -class ViewController: UIViewController { - - override func viewDidLoad() { - super.viewDidLoad() - // Do any additional setup after loading the view. - } - - -} - |