Skip to content

Commit

Permalink
Implement list view
Browse files Browse the repository at this point in the history
  • Loading branch information
DipanshKhandelwal committed Oct 20, 2019
1 parent ef968a8 commit 0849b16
Show file tree
Hide file tree
Showing 5 changed files with 124 additions and 42 deletions.
16 changes: 12 additions & 4 deletions food-tracker-app.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,25 +9,29 @@
/* Begin PBXBuildFile section */
0B04A696235B7232006E556A /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0B04A695235B7232006E556A /* AppDelegate.swift */; };
0B04A698235B7232006E556A /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0B04A697235B7232006E556A /* SceneDelegate.swift */; };
0B04A69A235B7232006E556A /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0B04A699235B7232006E556A /* ViewController.swift */; };
0B04A69A235B7232006E556A /* MealViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0B04A699235B7232006E556A /* MealViewController.swift */; };
0B04A69D235B7232006E556A /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 0B04A69B235B7232006E556A /* Main.storyboard */; };
0B04A69F235B7233006E556A /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 0B04A69E235B7233006E556A /* Assets.xcassets */; };
0B04A6A2235B7233006E556A /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 0B04A6A0235B7233006E556A /* LaunchScreen.storyboard */; };
0B99E20A235C23FA00EAD6EA /* RatingControl.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0B99E209235C23FA00EAD6EA /* RatingControl.swift */; };
0B99E20C235C326200EAD6EA /* Meal.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0B99E20B235C326200EAD6EA /* Meal.swift */; };
0B99E20E235C35FA00EAD6EA /* MealTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0B99E20D235C35FA00EAD6EA /* MealTableViewCell.swift */; };
0B99E210235C3C5F00EAD6EA /* MealTableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0B99E20F235C3C5F00EAD6EA /* MealTableViewController.swift */; };
/* End PBXBuildFile section */

/* Begin PBXFileReference section */
0B04A692235B7232006E556A /* food-tracker-app.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "food-tracker-app.app"; sourceTree = BUILT_PRODUCTS_DIR; };
0B04A695235B7232006E556A /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
0B04A697235B7232006E556A /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = "<group>"; };
0B04A699235B7232006E556A /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = "<group>"; };
0B04A699235B7232006E556A /* MealViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MealViewController.swift; sourceTree = "<group>"; };
0B04A69C235B7232006E556A /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
0B04A69E235B7233006E556A /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
0B04A6A1235B7233006E556A /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
0B04A6A3235B7233006E556A /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
0B99E209235C23FA00EAD6EA /* RatingControl.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RatingControl.swift; sourceTree = "<group>"; };
0B99E20B235C326200EAD6EA /* Meal.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Meal.swift; sourceTree = "<group>"; };
0B99E20D235C35FA00EAD6EA /* MealTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MealTableViewCell.swift; sourceTree = "<group>"; };
0B99E20F235C3C5F00EAD6EA /* MealTableViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MealTableViewController.swift; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
Expand Down Expand Up @@ -62,8 +66,10 @@
children = (
0B04A695235B7232006E556A /* AppDelegate.swift */,
0B04A697235B7232006E556A /* SceneDelegate.swift */,
0B04A699235B7232006E556A /* ViewController.swift */,
0B04A699235B7232006E556A /* MealViewController.swift */,
0B04A69B235B7232006E556A /* Main.storyboard */,
0B99E20F235C3C5F00EAD6EA /* MealTableViewController.swift */,
0B99E20D235C35FA00EAD6EA /* MealTableViewCell.swift */,
0B99E20B235C326200EAD6EA /* Meal.swift */,
0B04A69E235B7233006E556A /* Assets.xcassets */,
0B99E209235C23FA00EAD6EA /* RatingControl.swift */,
Expand Down Expand Up @@ -146,7 +152,9 @@
files = (
0B99E20C235C326200EAD6EA /* Meal.swift in Sources */,
0B99E20A235C23FA00EAD6EA /* RatingControl.swift in Sources */,
0B04A69A235B7232006E556A /* ViewController.swift in Sources */,
0B99E210235C3C5F00EAD6EA /* MealTableViewController.swift in Sources */,
0B99E20E235C35FA00EAD6EA /* MealTableViewCell.swift in Sources */,
0B04A69A235B7232006E556A /* MealViewController.swift in Sources */,
0B04A696235B7232006E556A /* AppDelegate.swift in Sources */,
0B04A698235B7232006E556A /* SceneDelegate.swift in Sources */,
);
Expand Down
75 changes: 59 additions & 16 deletions food-tracker-app/Base.lproj/Main.storyboard
Original file line number Diff line number Diff line change
@@ -1,36 +1,80 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="14868" 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="14868" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="a2D-lO-M9A">
<device id="retina6_1" orientation="portrait" appearance="light"/>
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14824"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
<!--View Controller-->
<!--Meal Table View Controller-->
<scene sceneID="ySL-pw-fxL">
<objects>
<tableViewController id="a2D-lO-M9A" customClass="MealTableViewController" customModule="food_tracker_app" customModuleProvider="target" sceneMemberID="viewController">
<tableView key="view" clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="90" estimatedRowHeight="-1" sectionHeaderHeight="28" sectionFooterHeight="28" id="Vy0-IJ-Jxt">
<rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" systemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/>
<prototypes>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="default" indentationWidth="10" reuseIdentifier="MealTableViewCell" id="8J3-DF-UD9" customClass="MealTableViewCell" customModule="food_tracker_app" customModuleProvider="target">
<rect key="frame" x="0.0" y="28" width="414" height="90"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" preservesSuperviewLayoutMargins="YES" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="8J3-DF-UD9" id="nIY-BH-8sR">
<rect key="frame" x="0.0" y="0.0" width="414" height="90"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" image="Default" translatesAutoresizingMaskIntoConstraints="NO" id="bcu-n4-KLP">
<rect key="frame" x="0.0" y="0.0" width="87" height="90"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
</imageView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="nth-uN-sVU">
<rect key="frame" x="95" y="11" width="299" height="21"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<stackView opaque="NO" userInteractionEnabled="NO" contentMode="scaleToFill" fixedFrame="YES" spacing="8" translatesAutoresizingMaskIntoConstraints="NO" id="4Om-QT-Nyo" customClass="RatingControl" customModule="food_tracker_app" customModuleProvider="target">
<rect key="frame" x="95" y="40" width="252" height="44"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
</stackView>
</subviews>
</tableViewCellContentView>
<connections>
<outlet property="nameLabel" destination="nth-uN-sVU" id="Gkb-hq-MGu"/>
<outlet property="photoImageView" destination="bcu-n4-KLP" id="7Jf-us-nfi"/>
<outlet property="ratingControl" destination="4Om-QT-Nyo" id="dNk-ac-YtN"/>
</connections>
</tableViewCell>
</prototypes>
<connections>
<outlet property="dataSource" destination="a2D-lO-M9A" id="SqV-Hu-7Vf"/>
<outlet property="delegate" destination="a2D-lO-M9A" id="oPL-jV-6KD"/>
</connections>
</tableView>
</tableViewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="2QY-k6-5Ns" userLabel="First Responder" customClass="UIResponder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="-657.97101449275362" y="125.89285714285714"/>
</scene>
<!--Meal View Controller-->
<scene sceneID="tne-QT-ifu">
<objects>
<viewController id="BYZ-38-t0r" customClass="ViewController" customModule="food_tracker_app" customModuleProvider="target" sceneMemberID="viewController">
<viewController id="BYZ-38-t0r" customClass="MealViewController" customModule="food_tracker_app" customModuleProvider="target" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="8bC-Xf-vdC">
<rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" alignment="center" spacing="8" translatesAutoresizingMaskIntoConstraints="NO" id="NuG-Lf-rXT">
<rect key="frame" x="20" y="64" width="374" height="496.5"/>
<stackView opaque="NO" contentMode="scaleToFill" ambiguous="YES" axis="vertical" alignment="center" spacing="8" translatesAutoresizingMaskIntoConstraints="NO" id="NuG-Lf-rXT">
<rect key="frame" x="20" y="64" width="374" height="474"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Meal Name" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="uNi-bg-8bh">
<rect key="frame" x="144" y="0.0" width="86.5" height="20.5"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<textField opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" placeholder="Enter meal name" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="twI-5p-iym">
<rect key="frame" x="0.0" y="28.5" width="374" height="34"/>
<rect key="frame" x="0.0" y="0.0" width="374" height="34"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<textInputTraits key="textInputTraits" returnKeyType="done" enablesReturnKeyAutomatically="YES"/>
</textField>
<imageView clipsSubviews="YES" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" placeholderIntrinsicWidth="320" placeholderIntrinsicHeight="320" image="Default" translatesAutoresizingMaskIntoConstraints="NO" id="LLN-ga-dNp">
<rect key="frame" x="0.0" y="70.5" width="374" height="374"/>
<rect key="frame" x="0.0" y="42" width="374" height="374"/>
<gestureRecognizers/>
<constraints>
<constraint firstAttribute="width" secondItem="LLN-ga-dNp" secondAttribute="height" multiplier="1:1" id="KWd-OH-XmV"/>
Expand All @@ -39,8 +83,8 @@
<outletCollection property="gestureRecognizers" destination="UfM-Iz-2xt" appends="YES" id="zdG-wK-KNd"/>
</connections>
</imageView>
<stackView opaque="NO" contentMode="scaleToFill" spacing="8" translatesAutoresizingMaskIntoConstraints="NO" id="RbP-JF-Oo7" customClass="RatingControl" customModule="food_tracker_app" customModuleProvider="target">
<rect key="frame" x="61" y="452.5" width="252" height="44"/>
<stackView opaque="NO" contentMode="scaleToFill" ambiguous="YES" spacing="8" translatesAutoresizingMaskIntoConstraints="NO" id="RbP-JF-Oo7" customClass="RatingControl" customModule="food_tracker_app" customModuleProvider="target">
<rect key="frame" x="61" y="424" width="252" height="50"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="number" keyPath="starCount">
<integer key="value" value="5"/>
Expand All @@ -64,7 +108,6 @@
<viewLayoutGuide key="safeArea" id="6Tk-OE-BBY"/>
</view>
<connections>
<outlet property="mealNameLabel" destination="uNi-bg-8bh" id="5rP-pi-mYt"/>
<outlet property="nameTextField" destination="twI-5p-iym" id="ego-jW-u8a"/>
<outlet property="photoImageView" destination="LLN-ga-dNp" id="C40-Mp-m7L"/>
<outlet property="ratingControl" destination="RbP-JF-Oo7" id="P5W-zb-dVA"/>
Expand Down
7 changes: 6 additions & 1 deletion food-tracker-app/MealTableViewCell.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,12 @@
import UIKit

class MealTableViewCell: UITableViewCell {


//MARK: Properties
@IBOutlet weak var nameLabel: UILabel!
@IBOutlet weak var photoImageView: UIImageView!
@IBOutlet weak var ratingControl: RatingControl!

override func awakeFromNib() {
super.awakeFromNib()
// Initialization code
Expand Down
Loading

0 comments on commit 0849b16

Please sign in to comment.