Skip to content

Commit

Permalink
Create: 아이템 모델 생성
Browse files Browse the repository at this point in the history
  • Loading branch information
jung-yun committed Apr 19, 2021
1 parent 316b279 commit 104d23e
Show file tree
Hide file tree
Showing 3 changed files with 83 additions and 0 deletions.
24 changes: 24 additions & 0 deletions Side-dish/Side-dish.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
/* 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 */; };
Expand All @@ -20,6 +22,8 @@
/* Begin PBXFileReference section */
8844B7BE262D6C3000FA49E9 /* FoodCardCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FoodCardCell.swift; sourceTree = "<group>"; };
8844B7C3262D6ED500FA49E9 /* FoodCardCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = FoodCardCell.xib; sourceTree = "<group>"; };
8844B7CF262DB6A500FA49E9 /* Item.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Item.swift; sourceTree = "<group>"; };
8844B7D3262DBA3F00FA49E9 /* Category.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Category.swift; sourceTree = "<group>"; };
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 = "<group>"; };
BFCE4954262D4891006C0882 /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -50,6 +54,23 @@
path = View;
sourceTree = "<group>";
};
8844B7CD262DB62C00FA49E9 /* DataLayer */ = {
isa = PBXGroup;
children = (
8844B7CE262DB63B00FA49E9 /* Model */,
);
path = DataLayer;
sourceTree = "<group>";
};
8844B7CE262DB63B00FA49E9 /* Model */ = {
isa = PBXGroup;
children = (
8844B7CF262DB6A500FA49E9 /* Item.swift */,
8844B7D3262DBA3F00FA49E9 /* Category.swift */,
);
path = Model;
sourceTree = "<group>";
};
BFCE4946262D4891006C0882 = {
isa = PBXGroup;
children = (
Expand All @@ -69,6 +90,7 @@
BFCE4951262D4891006C0882 /* Side-dish */ = {
isa = PBXGroup;
children = (
8844B7CD262DB62C00FA49E9 /* DataLayer */,
BFCE4952262D4891006C0882 /* AppDelegate.swift */,
BFCE4954262D4891006C0882 /* SceneDelegate.swift */,
8844B7C1262D6CEC00FA49E9 /* View */,
Expand Down Expand Up @@ -152,10 +174,12 @@
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;
};
Expand Down
18 changes: 18 additions & 0 deletions Side-dish/Side-dish/DataLayer/Model/Category.swift
Original file line number Diff line number Diff line change
@@ -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
}
}
41 changes: 41 additions & 0 deletions Side-dish/Side-dish/DataLayer/Model/Item.swift
Original file line number Diff line number Diff line change
@@ -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 = "베스트"
}

0 comments on commit 104d23e

Please sign in to comment.