diff --git a/MealApp.xcodeproj/project.pbxproj b/MealApp.xcodeproj/project.pbxproj index 998c429e7c769e06c6a9d4ef50a180f0107faa43..d7ab9c1719e19973a8fe06d7730f19e2794ddd5b 100644 --- a/MealApp.xcodeproj/project.pbxproj +++ b/MealApp.xcodeproj/project.pbxproj @@ -7,15 +7,18 @@ objects = { /* Begin PBXBuildFile section */ + D23B37F92C7D6E7C003D8CE4 /* MealListTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = D23B37F82C7D6E7C003D8CE4 /* MealListTableViewCell.swift */; }; + D23B37FB2C7D76F2003D8CE4 /* MealDetailsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D23B37FA2C7D76F2003D8CE4 /* MealDetailsViewController.swift */; }; D2DFC02E2C7C6829009FFE4D /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = D2DFC02D2C7C6829009FFE4D /* AppDelegate.swift */; }; D2DFC0302C7C6829009FFE4D /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = D2DFC02F2C7C6829009FFE4D /* SceneDelegate.swift */; }; D2DFC0322C7C6829009FFE4D /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D2DFC0312C7C6829009FFE4D /* ViewController.swift */; }; - D2DFC0352C7C6829009FFE4D /* Base in Resources */ = {isa = PBXBuildFile; fileRef = D2DFC0342C7C6829009FFE4D /* Base */; }; D2DFC0372C7C682A009FFE4D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = D2DFC0362C7C682A009FFE4D /* Assets.xcassets */; }; - D2DFC03A2C7C682A009FFE4D /* Base in Resources */ = {isa = PBXBuildFile; fileRef = D2DFC0392C7C682A009FFE4D /* Base */; }; D2DFC0452C7C682A009FFE4D /* MealAppTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = D2DFC0442C7C682A009FFE4D /* MealAppTests.swift */; }; D2DFC04F2C7C682A009FFE4D /* MealAppUITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = D2DFC04E2C7C682A009FFE4D /* MealAppUITests.swift */; }; D2DFC0512C7C682A009FFE4D /* MealAppUITestsLaunchTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = D2DFC0502C7C682A009FFE4D /* MealAppUITestsLaunchTests.swift */; }; + D2DFC0652C7C6D20009FFE4D /* MealModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = D2DFC0642C7C6D20009FFE4D /* MealModel.swift */; }; + D2DFC06C2C7C7C7D009FFE4D /* MealService.swift in Sources */ = {isa = PBXBuildFile; fileRef = D2DFC06B2C7C7C7D009FFE4D /* MealService.swift */; }; + D2DFC0712C7C8EF2009FFE4D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = D2DFC0332C7C6829009FFE4D /* Main.storyboard */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -36,6 +39,8 @@ /* End PBXContainerItemProxy section */ /* Begin PBXFileReference section */ + D23B37F82C7D6E7C003D8CE4 /* MealListTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MealListTableViewCell.swift; sourceTree = "<group>"; }; + D23B37FA2C7D76F2003D8CE4 /* MealDetailsViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MealDetailsViewController.swift; sourceTree = "<group>"; }; D2DFC02A2C7C6829009FFE4D /* MealApp.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = MealApp.app; sourceTree = BUILT_PRODUCTS_DIR; }; D2DFC02D2C7C6829009FFE4D /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; }; D2DFC02F2C7C6829009FFE4D /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = "<group>"; }; @@ -49,6 +54,8 @@ D2DFC04A2C7C682A009FFE4D /* MealAppUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = MealAppUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; D2DFC04E2C7C682A009FFE4D /* MealAppUITests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MealAppUITests.swift; sourceTree = "<group>"; }; D2DFC0502C7C682A009FFE4D /* MealAppUITestsLaunchTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MealAppUITestsLaunchTests.swift; sourceTree = "<group>"; }; + D2DFC0642C7C6D20009FFE4D /* MealModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MealModel.swift; sourceTree = "<group>"; }; + D2DFC06B2C7C7C7D009FFE4D /* MealService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MealService.swift; sourceTree = "<group>"; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -99,13 +106,13 @@ D2DFC02C2C7C6829009FFE4D /* MealApp */ = { isa = PBXGroup; children = ( - D2DFC02D2C7C6829009FFE4D /* AppDelegate.swift */, - D2DFC02F2C7C6829009FFE4D /* SceneDelegate.swift */, - D2DFC0312C7C6829009FFE4D /* ViewController.swift */, - D2DFC0332C7C6829009FFE4D /* Main.storyboard */, - D2DFC0362C7C682A009FFE4D /* Assets.xcassets */, - D2DFC0382C7C682A009FFE4D /* LaunchScreen.storyboard */, - D2DFC03B2C7C682A009FFE4D /* Info.plist */, + D2DFC0662C7C6E91009FFE4D /* Service */, + D2DFC0612C7C6B6A009FFE4D /* App */, + D2DFC05F2C7C6B19009FFE4D /* Controller */, + D2DFC05D2C7C6B07009FFE4D /* Model */, + D2DFC0622C7C6BA9009FFE4D /* Resources */, + D2DFC0632C7C6BCF009FFE4D /* Storyboards */, + D2DFC05E2C7C6B13009FFE4D /* View */, ); path = MealApp; sourceTree = "<group>"; @@ -127,6 +134,66 @@ path = MealAppUITests; sourceTree = "<group>"; }; + D2DFC05D2C7C6B07009FFE4D /* Model */ = { + isa = PBXGroup; + children = ( + D2DFC0642C7C6D20009FFE4D /* MealModel.swift */, + ); + path = Model; + sourceTree = "<group>"; + }; + D2DFC05E2C7C6B13009FFE4D /* View */ = { + isa = PBXGroup; + children = ( + D23B37F82C7D6E7C003D8CE4 /* MealListTableViewCell.swift */, + ); + path = View; + sourceTree = "<group>"; + }; + D2DFC05F2C7C6B19009FFE4D /* Controller */ = { + isa = PBXGroup; + children = ( + D2DFC0312C7C6829009FFE4D /* ViewController.swift */, + D23B37FA2C7D76F2003D8CE4 /* MealDetailsViewController.swift */, + ); + path = Controller; + sourceTree = "<group>"; + }; + D2DFC0612C7C6B6A009FFE4D /* App */ = { + isa = PBXGroup; + children = ( + D2DFC02D2C7C6829009FFE4D /* AppDelegate.swift */, + D2DFC02F2C7C6829009FFE4D /* SceneDelegate.swift */, + ); + path = App; + sourceTree = "<group>"; + }; + D2DFC0622C7C6BA9009FFE4D /* Resources */ = { + isa = PBXGroup; + children = ( + D2DFC0362C7C682A009FFE4D /* Assets.xcassets */, + D2DFC03B2C7C682A009FFE4D /* Info.plist */, + ); + path = Resources; + sourceTree = "<group>"; + }; + D2DFC0632C7C6BCF009FFE4D /* Storyboards */ = { + isa = PBXGroup; + children = ( + D2DFC0332C7C6829009FFE4D /* Main.storyboard */, + D2DFC0382C7C682A009FFE4D /* LaunchScreen.storyboard */, + ); + path = Storyboards; + sourceTree = "<group>"; + }; + D2DFC0662C7C6E91009FFE4D /* Service */ = { + isa = PBXGroup; + children = ( + D2DFC06B2C7C7C7D009FFE4D /* MealService.swift */, + ); + path = Service; + sourceTree = "<group>"; + }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ @@ -232,8 +299,7 @@ buildActionMask = 2147483647; files = ( D2DFC0372C7C682A009FFE4D /* Assets.xcassets in Resources */, - D2DFC03A2C7C682A009FFE4D /* Base in Resources */, - D2DFC0352C7C6829009FFE4D /* Base in Resources */, + D2DFC0712C7C8EF2009FFE4D /* Main.storyboard in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -258,9 +324,13 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + D23B37F92C7D6E7C003D8CE4 /* MealListTableViewCell.swift in Sources */, + D23B37FB2C7D76F2003D8CE4 /* MealDetailsViewController.swift in Sources */, D2DFC0322C7C6829009FFE4D /* ViewController.swift in Sources */, + D2DFC06C2C7C7C7D009FFE4D /* MealService.swift in Sources */, D2DFC02E2C7C6829009FFE4D /* AppDelegate.swift in Sources */, D2DFC0302C7C6829009FFE4D /* SceneDelegate.swift in Sources */, + D2DFC0652C7C6D20009FFE4D /* MealModel.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -443,7 +513,7 @@ CODE_SIGN_STYLE = Automatic; CURRENT_PROJECT_VERSION = 1; GENERATE_INFOPLIST_FILE = YES; - INFOPLIST_FILE = MealApp/Info.plist; + INFOPLIST_FILE = MealApp/Resources/Info.plist; INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; INFOPLIST_KEY_UILaunchStoryboardName = LaunchScreen; INFOPLIST_KEY_UIMainStoryboardFile = Main; @@ -470,7 +540,7 @@ CODE_SIGN_STYLE = Automatic; CURRENT_PROJECT_VERSION = 1; GENERATE_INFOPLIST_FILE = YES; - INFOPLIST_FILE = MealApp/Info.plist; + INFOPLIST_FILE = MealApp/Resources/Info.plist; INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; INFOPLIST_KEY_UILaunchStoryboardName = LaunchScreen; INFOPLIST_KEY_UIMainStoryboardFile = Main; diff --git a/MealApp/AppDelegate.swift b/MealApp/App/AppDelegate.swift similarity index 100% rename from MealApp/AppDelegate.swift rename to MealApp/App/AppDelegate.swift diff --git a/MealApp/SceneDelegate.swift b/MealApp/App/SceneDelegate.swift similarity index 100% rename from MealApp/SceneDelegate.swift rename to MealApp/App/SceneDelegate.swift diff --git a/MealApp/Base.lproj/Main.storyboard b/MealApp/Base.lproj/Main.storyboard deleted file mode 100644 index 25a763858ecdbea5c897a9fd8fa2225d7223d2ad..0000000000000000000000000000000000000000 --- a/MealApp/Base.lproj/Main.storyboard +++ /dev/null @@ -1,24 +0,0 @@ -<?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"> - <dependencies> - <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13104.12"/> - <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--> - <scene sceneID="tne-QT-ifu"> - <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"/> - <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"/> - </objects> - </scene> - </scenes> -</document> diff --git a/MealApp/Controller/MealDetailsViewController.swift b/MealApp/Controller/MealDetailsViewController.swift new file mode 100644 index 0000000000000000000000000000000000000000..375b41423de79824914cfc3cb252e8421f79db7e --- /dev/null +++ b/MealApp/Controller/MealDetailsViewController.swift @@ -0,0 +1,36 @@ +// +// MealDetailsViewController.swift +// MealApp +// +// Created by Allysa Marie David on 8/27/24. +// + +import UIKit + +class MealDetailsViewController: UIViewController { + + @IBOutlet weak var imgView: UIImageView! + @IBOutlet weak var imgDescription: UILabel! + + var details: String? + var image: UIImage? + + override func viewDidLoad() { + super.viewDidLoad() + + imgView.image = image + imgDescription.text = details + } + + + /* + // MARK: - Navigation + + // In a storyboard-based application, you will often want to do a little preparation before navigation + override func prepare(for segue: UIStoryboardSegue, sender: Any?) { + // Get the new view controller using segue.destination. + // Pass the selected object to the new view controller. + } + */ + +} diff --git a/MealApp/Controller/ViewController.swift b/MealApp/Controller/ViewController.swift new file mode 100644 index 0000000000000000000000000000000000000000..3da0c528b9bf2d15f4be4e75a31c7e9966e0abc8 --- /dev/null +++ b/MealApp/Controller/ViewController.swift @@ -0,0 +1,104 @@ +// +// ViewController.swift +// MealApp +// +// Created by Allysa Marie David on 8/26/24. +// + +import UIKit + +class ViewController: UIViewController, UITableViewDataSource, UITableViewDelegate { + + @IBOutlet weak var tableView: UITableView! + + private var meals: [Meal] = [] + private let mealService = MealService() + + override func viewDidLoad() { + super.viewDidLoad() + fetchAllMeal() + + tableView.dataSource = self + tableView.delegate = self + } + + private func fetchAllMeal() { + Task { + do { + meals = try await mealService.fetchMeals() + tableView.reloadData() + print(meals) + } catch { + print("Failed to fetch data: \(error)") + } + } + } + + // MARK: - Image Loading + + private func loadImage(from url: URL, into imageView: UIImageView) { + + let task = URLSession.shared.dataTask(with: url) { data, response, error in + if let error = error { + print("Failed to load image:", error) + return + } + + guard let data = data, let image = UIImage(data: data) else { + print("No image data received") + return + } + + DispatchQueue.main.async { + imageView.image = image + } + } + task.resume() + } + + // MARK: - Table View Data Source + + func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { + return meals.count + } + + func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { + let cell = tableView.dequeueReusableCell(withIdentifier: "Cell", for: indexPath) as! MealListTableViewCell + + let meal = meals[indexPath.row] + cell.imgLabel.text = meal.strCategory + + if let url = URL(string: meal.strCategoryThumb) { + loadImage(from: url, into: cell.imgView) + } + + return cell + } + + // MARK: - To View Details + + func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { + self.performSegue(withIdentifier: "ToViewMealDetails", sender: self) + } + + override func prepare(for segue: UIStoryboardSegue, sender: Any?) { + if segue.identifier == "ToViewMealDetails", + let indexPath = tableView.indexPathForSelectedRow, + let destinationVC = segue.destination as? MealDetailsViewController { + + let meal = meals[indexPath.row] + let imageUrl = URL(string: meal.strCategoryThumb)! + + + let imageData = try? Data(contentsOf: imageUrl) + let image = UIImage(data: imageData!) + + DispatchQueue.main.async { + destinationVC.image = image + destinationVC.details = meal.strCategoryDescription + } + + } + } +} + diff --git a/MealApp/Model/MealModel.swift b/MealApp/Model/MealModel.swift new file mode 100644 index 0000000000000000000000000000000000000000..f61613078c215afce217fa59ec470be3033890c2 --- /dev/null +++ b/MealApp/Model/MealModel.swift @@ -0,0 +1,19 @@ +// +// ProductModel.swift +// MealApp +// +// Created by Allysa Marie David on 8/26/24. +// + +import Foundation + +struct Meal: Codable { + let idCategory: String + let strCategory: String + let strCategoryDescription: String + let strCategoryThumb: String +} + +struct MealsInfo: Codable { + let categories: [Meal] +} diff --git a/MealApp/Assets.xcassets/AccentColor.colorset/Contents.json b/MealApp/Resources/Assets.xcassets/AccentColor.colorset/Contents.json similarity index 100% rename from MealApp/Assets.xcassets/AccentColor.colorset/Contents.json rename to MealApp/Resources/Assets.xcassets/AccentColor.colorset/Contents.json diff --git a/MealApp/Assets.xcassets/AppIcon.appiconset/Contents.json b/MealApp/Resources/Assets.xcassets/AppIcon.appiconset/Contents.json similarity index 100% rename from MealApp/Assets.xcassets/AppIcon.appiconset/Contents.json rename to MealApp/Resources/Assets.xcassets/AppIcon.appiconset/Contents.json diff --git a/MealApp/Assets.xcassets/Contents.json b/MealApp/Resources/Assets.xcassets/Contents.json similarity index 100% rename from MealApp/Assets.xcassets/Contents.json rename to MealApp/Resources/Assets.xcassets/Contents.json diff --git a/MealApp/Info.plist b/MealApp/Resources/Info.plist similarity index 100% rename from MealApp/Info.plist rename to MealApp/Resources/Info.plist diff --git a/MealApp/Service/MealService.swift b/MealApp/Service/MealService.swift new file mode 100644 index 0000000000000000000000000000000000000000..550d974768e69bd9777569098747ff3dc34f5b40 --- /dev/null +++ b/MealApp/Service/MealService.swift @@ -0,0 +1,23 @@ +// +// MealService.swift +// MealApp +// +// Created by Allysa Marie David on 8/26/24. +// + +import Foundation + +class MealService { + + private let urlString = "https://www.themealdb.com/api/json/v1/1/categories.php" + + func fetchMeals() async throws -> [Meal] { + guard let url = URL(string: urlString) else { + throw URLError(.badURL) + } + + let (data, _) = try await URLSession.shared.data(from: url) + let apiResponse = try JSONDecoder().decode(MealsInfo.self, from: data) + return apiResponse.categories + } +} diff --git a/MealApp/Base.lproj/LaunchScreen.storyboard b/MealApp/Storyboards/Base.lproj/LaunchScreen.storyboard similarity index 100% rename from MealApp/Base.lproj/LaunchScreen.storyboard rename to MealApp/Storyboards/Base.lproj/LaunchScreen.storyboard diff --git a/MealApp/Storyboards/Base.lproj/Main.storyboard b/MealApp/Storyboards/Base.lproj/Main.storyboard new file mode 100644 index 0000000000000000000000000000000000000000..0bf74338f7893ca806c19c8a944f3ebf54a9bc74 --- /dev/null +++ b/MealApp/Storyboards/Base.lproj/Main.storyboard @@ -0,0 +1,150 @@ +<?xml version="1.0" encoding="UTF-8"?> +<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="32700.99.1234" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="BRz-qi-1uz"> + <device id="retina6_12" orientation="portrait" appearance="light"/> + <dependencies> + <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="22685"/> + <capability name="Safe area layout guides" minToolsVersion="9.0"/> + <capability name="System colors in document resources" minToolsVersion="11.0"/> + <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/> + </dependencies> + <scenes> + <!--View Controller--> + <scene sceneID="tne-QT-ifu"> + <objects> + <viewController id="BYZ-38-t0r" customClass="ViewController" customModule="MealApp" customModuleProvider="target" sceneMemberID="viewController"> + <view key="view" contentMode="scaleToFill" id="8bC-Xf-vdC"> + <rect key="frame" x="0.0" y="0.0" width="393" height="852"/> + <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> + <subviews> + <tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="-1" estimatedRowHeight="-1" sectionHeaderHeight="-1" estimatedSectionHeaderHeight="-1" sectionFooterHeight="-1" estimatedSectionFooterHeight="-1" translatesAutoresizingMaskIntoConstraints="NO" id="G2b-Oz-73u"> + <rect key="frame" x="0.0" y="103" width="393" height="715"/> + <color key="backgroundColor" systemColor="systemBackgroundColor"/> + <prototypes> + <tableViewCell clipsSubviews="YES" contentMode="scaleToFill" insetsLayoutMarginsFromSafeArea="NO" selectionStyle="blue" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" reuseIdentifier="Cell" rowHeight="137" id="8Yi-zY-GKJ" customClass="MealListTableViewCell" customModule="MealApp" customModuleProvider="target"> + <rect key="frame" x="0.0" y="50" width="393" height="137"/> + <autoresizingMask key="autoresizingMask"/> + <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="8Yi-zY-GKJ" id="gbW-Q8-uEe"> + <rect key="frame" x="0.0" y="0.0" width="393" height="137"/> + <autoresizingMask key="autoresizingMask"/> + <subviews> + <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="ZTB-a3-n9S"> + <rect key="frame" x="10" y="10" width="150" height="117"/> + <constraints> + <constraint firstAttribute="width" constant="150" id="qMz-gd-VGl"/> + </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="9dI-YT-hNs"> + <rect key="frame" x="170" y="21" width="193" height="95"/> + <fontDescription key="fontDescription" type="system" pointSize="24"/> + <nil key="textColor"/> + <nil key="highlightedColor"/> + </label> + </subviews> + <constraints> + <constraint firstItem="ZTB-a3-n9S" firstAttribute="leading" secondItem="gbW-Q8-uEe" secondAttribute="leading" constant="10" id="DAU-Be-Beo"/> + <constraint firstItem="9dI-YT-hNs" firstAttribute="top" secondItem="gbW-Q8-uEe" secondAttribute="topMargin" constant="10" id="FcT-ud-S7E"/> + <constraint firstAttribute="bottomMargin" secondItem="9dI-YT-hNs" secondAttribute="bottom" constant="10" id="d1p-R0-5e7"/> + <constraint firstAttribute="bottom" secondItem="ZTB-a3-n9S" secondAttribute="bottom" constant="10" id="lrx-MG-iUW"/> + <constraint firstAttribute="trailingMargin" secondItem="9dI-YT-hNs" secondAttribute="trailing" constant="10" id="nst-uT-CNC"/> + <constraint firstItem="ZTB-a3-n9S" firstAttribute="top" secondItem="gbW-Q8-uEe" secondAttribute="top" constant="10" id="uNf-X5-CjO"/> + <constraint firstItem="9dI-YT-hNs" firstAttribute="leading" secondItem="ZTB-a3-n9S" secondAttribute="trailing" constant="10" id="xOo-4H-6JA"/> + </constraints> + </tableViewCellContentView> + <connections> + <outlet property="imgLabel" destination="9dI-YT-hNs" id="SCq-fl-v6j"/> + <outlet property="imgView" destination="ZTB-a3-n9S" id="vJ0-Ke-Tct"/> + </connections> + </tableViewCell> + </prototypes> + <connections> + <outlet property="dataSource" destination="BYZ-38-t0r" id="JT6-G6-faA"/> + <outlet property="delegate" destination="BYZ-38-t0r" id="Qwe-KS-kg2"/> + </connections> + </tableView> + </subviews> + <viewLayoutGuide key="safeArea" id="6Tk-OE-BBY"/> + <color key="backgroundColor" systemColor="systemBackgroundColor"/> + <constraints> + <constraint firstItem="6Tk-OE-BBY" firstAttribute="trailing" secondItem="G2b-Oz-73u" secondAttribute="trailing" id="5xV-Qt-cpL"/> + <constraint firstItem="6Tk-OE-BBY" firstAttribute="bottom" secondItem="G2b-Oz-73u" secondAttribute="bottom" id="CtL-hb-1Qy"/> + <constraint firstItem="G2b-Oz-73u" firstAttribute="leading" secondItem="6Tk-OE-BBY" secondAttribute="leading" id="Ey2-XA-j5Y"/> + <constraint firstItem="G2b-Oz-73u" firstAttribute="top" secondItem="6Tk-OE-BBY" secondAttribute="top" id="gvl-cH-gI2"/> + </constraints> + </view> + <navigationItem key="navigationItem" id="4df-tq-gND"/> + <connections> + <outlet property="tableView" destination="G2b-Oz-73u" id="Wz4-a1-oj4"/> + <segue destination="9QQ-JV-X3W" kind="show" identifier="ToViewMealDetails" id="saB-mm-lfe"/> + </connections> + </viewController> + <placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/> + </objects> + <point key="canvasLocation" x="980.91603053435108" y="-34.507042253521128"/> + </scene> + <!--Meal Details View Controller--> + <scene sceneID="pCA-rc-Wh1"> + <objects> + <viewController id="9QQ-JV-X3W" customClass="MealDetailsViewController" customModule="MealApp" customModuleProvider="target" sceneMemberID="viewController"> + <view key="view" contentMode="scaleToFill" id="GfX-zd-HAe"> + <rect key="frame" x="0.0" y="0.0" width="393" height="852"/> + <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> + <subviews> + <stackView opaque="NO" contentMode="scaleToFill" axis="vertical" translatesAutoresizingMaskIntoConstraints="NO" id="kx4-sA-1fE"> + <rect key="frame" x="0.0" y="103" width="393" height="715"/> + <subviews> + <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="Mnu-EM-DJE"> + <rect key="frame" x="0.0" y="0.0" width="393" height="246"/> + </imageView> + <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="justified" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="2YL-oC-tyg"> + <rect key="frame" x="0.0" y="246" width="393" height="469"/> + <fontDescription key="fontDescription" type="system" pointSize="17"/> + <nil key="textColor"/> + <nil key="highlightedColor"/> + </label> + </subviews> + </stackView> + </subviews> + <viewLayoutGuide key="safeArea" id="ELu-Gm-iiL"/> + <color key="backgroundColor" systemColor="systemBackgroundColor"/> + <constraints> + <constraint firstItem="ELu-Gm-iiL" firstAttribute="trailing" secondItem="kx4-sA-1fE" secondAttribute="trailing" id="97J-a1-adc"/> + <constraint firstItem="kx4-sA-1fE" firstAttribute="leading" secondItem="ELu-Gm-iiL" secondAttribute="leading" id="LDg-3o-JHo"/> + <constraint firstItem="kx4-sA-1fE" firstAttribute="top" secondItem="ELu-Gm-iiL" secondAttribute="top" id="NvF-8T-tRl"/> + <constraint firstItem="ELu-Gm-iiL" firstAttribute="bottom" secondItem="kx4-sA-1fE" secondAttribute="bottom" id="ecT-4e-iRv"/> + </constraints> + </view> + <navigationItem key="navigationItem" id="yXM-eg-NmK"/> + <connections> + <outlet property="imgDescription" destination="2YL-oC-tyg" id="duO-pO-MGR"/> + <outlet property="imgView" destination="Mnu-EM-DJE" id="uo8-5t-OxF"/> + </connections> + </viewController> + <placeholder placeholderIdentifier="IBFirstResponder" id="vkT-dx-PME" userLabel="First Responder" customClass="UIResponder" sceneMemberID="firstResponder"/> + </objects> + <point key="canvasLocation" x="1747.3282442748091" y="-17.605633802816904"/> + </scene> + <!--Navigation Controller--> + <scene sceneID="1DP-1E-lGA"> + <objects> + <navigationController automaticallyAdjustsScrollViewInsets="NO" id="BRz-qi-1uz" sceneMemberID="viewController"> + <toolbarItems/> + <navigationBar key="navigationBar" contentMode="scaleToFill" id="M9z-a1-Tce"> + <rect key="frame" x="0.0" y="59" width="393" height="44"/> + <autoresizingMask key="autoresizingMask"/> + </navigationBar> + <nil name="viewControllers"/> + <connections> + <segue destination="BYZ-38-t0r" kind="relationship" relationship="rootViewController" id="rAK-FD-sMw"/> + </connections> + </navigationController> + <placeholder placeholderIdentifier="IBFirstResponder" id="WNy-Lo-uQH" userLabel="First Responder" customClass="UIResponder" sceneMemberID="firstResponder"/> + </objects> + <point key="canvasLocation" x="54.198473282442748" y="-34.507042253521128"/> + </scene> + </scenes> + <resources> + <systemColor name="systemBackgroundColor"> + <color white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/> + </systemColor> + </resources> +</document> diff --git a/MealApp/View/MealListTableViewCell.swift b/MealApp/View/MealListTableViewCell.swift new file mode 100644 index 0000000000000000000000000000000000000000..2a258aa1e48834dc080d4360feeb548439030b5f --- /dev/null +++ b/MealApp/View/MealListTableViewCell.swift @@ -0,0 +1,15 @@ +// +// MealListTableViewCell.swift +// MealApp +// +// Created by Allysa Marie David on 8/27/24. +// + +import UIKit + +class MealListTableViewCell: UITableViewCell { + + @IBOutlet weak var imgView: UIImageView! + @IBOutlet weak var imgLabel: UILabel! + +} diff --git a/MealApp/ViewController.swift b/MealApp/ViewController.swift deleted file mode 100644 index 13a882d0060aca771dc7588aa26eee92faee0ac1..0000000000000000000000000000000000000000 --- a/MealApp/ViewController.swift +++ /dev/null @@ -1,19 +0,0 @@ -// -// ViewController.swift -// MealApp -// -// Created by Allysa Marie David on 8/26/24. -// - -import UIKit - -class ViewController: UIViewController { - - override func viewDidLoad() { - super.viewDidLoad() - // Do any additional setup after loading the view. - } - - -} -