diff --git a/Side-dish/Side-dish.xcodeproj/project.pbxproj b/Side-dish/Side-dish.xcodeproj/project.pbxproj index 0fff223a6..fdf55bda9 100644 --- a/Side-dish/Side-dish.xcodeproj/project.pbxproj +++ b/Side-dish/Side-dish.xcodeproj/project.pbxproj @@ -7,23 +7,31 @@ objects = { /* Begin PBXBuildFile section */ + 8844B7BF262D6C3000FA49E9 /* FoodCardCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8844B7BE262D6C3000FA49E9 /* FoodCardCell.swift */; }; + 8844B7C4262D6ED500FA49E9 /* FoodCardCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 8844B7C3262D6ED500FA49E9 /* FoodCardCell.xib */; }; + 8844B7D0262DB6A500FA49E9 /* Item.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8844B7CF262DB6A500FA49E9 /* Item.swift */; }; + 8844B7D4262DBA3F00FA49E9 /* Category.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8844B7D3262DBA3F00FA49E9 /* Category.swift */; }; BFCE4953262D4891006C0882 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = BFCE4952262D4891006C0882 /* AppDelegate.swift */; }; BFCE4955262D4891006C0882 /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = BFCE4954262D4891006C0882 /* SceneDelegate.swift */; }; BFCE4957262D4891006C0882 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = BFCE4956262D4891006C0882 /* ViewController.swift */; }; - BFCE495A262D4891006C0882 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = BFCE4958262D4891006C0882 /* Main.storyboard */; }; BFCE495C262D4895006C0882 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = BFCE495B262D4895006C0882 /* Assets.xcassets */; }; BFCE495F262D4895006C0882 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = BFCE495D262D4895006C0882 /* LaunchScreen.storyboard */; }; + BFCE496F262D883F006C0882 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = BFCE496E262D883F006C0882 /* Main.storyboard */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ + 8844B7BE262D6C3000FA49E9 /* FoodCardCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FoodCardCell.swift; sourceTree = ""; }; + 8844B7C3262D6ED500FA49E9 /* FoodCardCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = FoodCardCell.xib; sourceTree = ""; }; + 8844B7CF262DB6A500FA49E9 /* Item.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Item.swift; sourceTree = ""; }; + 8844B7D3262DBA3F00FA49E9 /* Category.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Category.swift; sourceTree = ""; }; BFCE494F262D4891006C0882 /* Side-dish.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "Side-dish.app"; sourceTree = BUILT_PRODUCTS_DIR; }; BFCE4952262D4891006C0882 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; BFCE4954262D4891006C0882 /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = ""; }; BFCE4956262D4891006C0882 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; - BFCE4959262D4891006C0882 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; BFCE495B262D4895006C0882 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; BFCE495E262D4895006C0882 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; BFCE4960262D4895006C0882 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + BFCE496E262D883F006C0882 /* Main.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = Main.storyboard; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -37,6 +45,32 @@ /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ + 8844B7C1262D6CEC00FA49E9 /* View */ = { + isa = PBXGroup; + children = ( + 8844B7BE262D6C3000FA49E9 /* FoodCardCell.swift */, + 8844B7C3262D6ED500FA49E9 /* FoodCardCell.xib */, + ); + path = View; + sourceTree = ""; + }; + 8844B7CD262DB62C00FA49E9 /* DataLayer */ = { + isa = PBXGroup; + children = ( + 8844B7CE262DB63B00FA49E9 /* Model */, + ); + path = DataLayer; + sourceTree = ""; + }; + 8844B7CE262DB63B00FA49E9 /* Model */ = { + isa = PBXGroup; + children = ( + 8844B7CF262DB6A500FA49E9 /* Item.swift */, + 8844B7D3262DBA3F00FA49E9 /* Category.swift */, + ); + path = Model; + sourceTree = ""; + }; BFCE4946262D4891006C0882 = { isa = PBXGroup; children = ( @@ -56,10 +90,12 @@ BFCE4951262D4891006C0882 /* Side-dish */ = { isa = PBXGroup; children = ( + 8844B7CD262DB62C00FA49E9 /* DataLayer */, BFCE4952262D4891006C0882 /* AppDelegate.swift */, BFCE4954262D4891006C0882 /* SceneDelegate.swift */, + 8844B7C1262D6CEC00FA49E9 /* View */, BFCE4956262D4891006C0882 /* ViewController.swift */, - BFCE4958262D4891006C0882 /* Main.storyboard */, + BFCE496E262D883F006C0882 /* Main.storyboard */, BFCE495B262D4895006C0882 /* Assets.xcassets */, BFCE495D262D4895006C0882 /* LaunchScreen.storyboard */, BFCE4960262D4895006C0882 /* Info.plist */, @@ -124,9 +160,10 @@ isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( + 8844B7C4262D6ED500FA49E9 /* FoodCardCell.xib in Resources */, BFCE495F262D4895006C0882 /* LaunchScreen.storyboard in Resources */, BFCE495C262D4895006C0882 /* Assets.xcassets in Resources */, - BFCE495A262D4891006C0882 /* Main.storyboard in Resources */, + BFCE496F262D883F006C0882 /* Main.storyboard in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -137,23 +174,18 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + 8844B7D0262DB6A500FA49E9 /* Item.swift in Sources */, BFCE4957262D4891006C0882 /* ViewController.swift in Sources */, BFCE4953262D4891006C0882 /* AppDelegate.swift in Sources */, BFCE4955262D4891006C0882 /* SceneDelegate.swift in Sources */, + 8844B7BF262D6C3000FA49E9 /* FoodCardCell.swift in Sources */, + 8844B7D4262DBA3F00FA49E9 /* Category.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXSourcesBuildPhase section */ /* Begin PBXVariantGroup section */ - BFCE4958262D4891006C0882 /* Main.storyboard */ = { - isa = PBXVariantGroup; - children = ( - BFCE4959262D4891006C0882 /* Base */, - ); - name = Main.storyboard; - sourceTree = ""; - }; BFCE495D262D4895006C0882 /* LaunchScreen.storyboard */ = { isa = PBXVariantGroup; children = ( diff --git a/Side-dish/Side-dish.xcodeproj/project.xcworkspace/xcuserdata/hoonhachoi.xcuserdatad/UserInterfaceState.xcuserstate b/Side-dish/Side-dish.xcodeproj/project.xcworkspace/xcuserdata/hoonhachoi.xcuserdatad/UserInterfaceState.xcuserstate index 7ae600ce4..b61d38584 100644 Binary files a/Side-dish/Side-dish.xcodeproj/project.xcworkspace/xcuserdata/hoonhachoi.xcuserdatad/UserInterfaceState.xcuserstate and b/Side-dish/Side-dish.xcodeproj/project.xcworkspace/xcuserdata/hoonhachoi.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/Side-dish/Side-dish.xcodeproj/xcuserdata/jojung-yun.xcuserdatad/xcschemes/xcschememanagement.plist b/Side-dish/Side-dish.xcodeproj/xcuserdata/jojung-yun.xcuserdatad/xcschemes/xcschememanagement.plist new file mode 100644 index 000000000..c21154a8c --- /dev/null +++ b/Side-dish/Side-dish.xcodeproj/xcuserdata/jojung-yun.xcuserdatad/xcschemes/xcschememanagement.plist @@ -0,0 +1,14 @@ + + + + + SchemeUserState + + Side-dish.xcscheme_^#shared#^_ + + orderHint + 0 + + + + diff --git a/Side-dish/Side-dish/Base.lproj/Main.storyboard b/Side-dish/Side-dish/Base.lproj/Main.storyboard deleted file mode 100644 index 25a763858..000000000 --- a/Side-dish/Side-dish/Base.lproj/Main.storyboard +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Side-dish/Side-dish/DataLayer/Model/Category.swift b/Side-dish/Side-dish/DataLayer/Model/Category.swift new file mode 100644 index 000000000..41bcc13f0 --- /dev/null +++ b/Side-dish/Side-dish/DataLayer/Model/Category.swift @@ -0,0 +1,18 @@ +// +// Category.swift +// Side-dish +// +// Created by 조중윤 on 2021/04/19. +// + +import Foundation + +struct Category: Codable { + let categoryID, name: String + let items: [Item] + + enum CodingKeys: String, CodingKey { + case categoryID = "category_id" + case name, items + } +} diff --git a/Side-dish/Side-dish/DataLayer/Model/Item.swift b/Side-dish/Side-dish/DataLayer/Model/Item.swift new file mode 100644 index 000000000..4119da232 --- /dev/null +++ b/Side-dish/Side-dish/DataLayer/Model/Item.swift @@ -0,0 +1,41 @@ +// +// Item.swift +// Side-dish +// +// Created by 조중윤 on 2021/04/19. +// + +import Foundation + +struct Item: Codable { + let detailHash: String + let image: String + let alt: String + let deliveryType: [DeliveryType] + let title: String + let description: String + let nPrice: String? + let sPrice: String + let badge: [Badge]? + + enum CodingKeys: String, CodingKey { + case detailHash = "detail_hash" + case image, alt + case deliveryType = "delivery_type" + case title, description + case nPrice = "n_price" + case sPrice = "s_price" + case badge + } +} + +enum DeliveryType: String, Codable { + case dawnDelivery = "새벽배송" + case nationDelivery = "전국택배" +} + +enum Badge: String, Codable { + case eventPrice = "이벤트특가" + case launchingPrice = "론칭특가" + case bestPrice = "베스트" +} diff --git a/Side-dish/Side-dish/Main.storyboard b/Side-dish/Side-dish/Main.storyboard new file mode 100644 index 000000000..a4d2ef32d --- /dev/null +++ b/Side-dish/Side-dish/Main.storyboard @@ -0,0 +1,82 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Side-dish/Side-dish/SceneDelegate.swift b/Side-dish/Side-dish/SceneDelegate.swift index 9c6059427..c21a88f6a 100644 --- a/Side-dish/Side-dish/SceneDelegate.swift +++ b/Side-dish/Side-dish/SceneDelegate.swift @@ -16,3 +16,4 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate { } } + diff --git a/Side-dish/Side-dish/View/FoodCardCell.swift b/Side-dish/Side-dish/View/FoodCardCell.swift new file mode 100644 index 000000000..2d6a929ef --- /dev/null +++ b/Side-dish/Side-dish/View/FoodCardCell.swift @@ -0,0 +1,18 @@ +// +// FoodCardCell.swift +// Side-dish +// +// Created by 조중윤 on 2021/04/19. +// + +import UIKit + +class FoodCardCell: UICollectionViewCell { + static var identifier: String { + return String(describing: self) + } + + static var nib : UINib { + return UINib(nibName: identifier, bundle: nil) + } +} diff --git a/Side-dish/Side-dish/View/FoodCardCell.xib b/Side-dish/Side-dish/View/FoodCardCell.xib new file mode 100644 index 000000000..d4eecfea3 --- /dev/null +++ b/Side-dish/Side-dish/View/FoodCardCell.xib @@ -0,0 +1,124 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Side-dish/Side-dish/View/Main.Storyboard b/Side-dish/Side-dish/View/Main.Storyboard new file mode 100644 index 000000000..f9a048edf --- /dev/null +++ b/Side-dish/Side-dish/View/Main.Storyboard @@ -0,0 +1,7 @@ + + + + + + + diff --git a/Side-dish/Side-dish/ViewController.swift b/Side-dish/Side-dish/ViewController.swift index cb97196df..beda888dd 100644 --- a/Side-dish/Side-dish/ViewController.swift +++ b/Side-dish/Side-dish/ViewController.swift @@ -8,9 +8,31 @@ import UIKit class ViewController: UIViewController { - + + @IBOutlet weak var SideDishCollectionView: UICollectionView! + override func viewDidLoad() { super.viewDidLoad() + SideDishCollectionView.register(FoodCardCell.nib, forCellWithReuseIdentifier: FoodCardCell.identifier) + SideDishCollectionView.dataSource = self + SideDishCollectionView.delegate = self } + } +extension ViewController: UICollectionViewDataSource { + func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { + return 3 + } + + func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { + let cell = collectionView.dequeueReusableCell(withReuseIdentifier: FoodCardCell.identifier, for: indexPath) as! FoodCardCell + return cell + } +} + +extension ViewController: UICollectionViewDelegateFlowLayout { + func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize { + return CGSize(width: collectionView.frame.width, height: 130) + } +}