Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weโ€™ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[๐Ÿฅ’Team-6 / iOS / ์ญ & ์žญ์Šจ] ์ƒ์„ธ ํŽ˜์ด์ง€ ๋ฐ Persistence ๊ตฌํ˜„ #74

Open
wants to merge 128 commits into
base: banchan-code
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 125 commits
Commits
Show all changes
128 commits
Select commit Hold shift + click to select a range
221872e
Update README.md
JacksonPk Apr 23, 2021
70429f0
Update README.md
JacksonPk Apr 23, 2021
4a80ab8
Merge branch 'dev-iOS' of https://github.com/rla36/sidedish into iOS/โ€ฆ
JacksonPk Apr 27, 2021
2ec2b27
feat : add Realm library(#24)
JacksonPk Apr 27, 2021
9f69adf
feat : add navigation controller
1song2 Apr 27, 2021
8292668
feat : add DetailPageViewController
1song2 Apr 27, 2021
51febc4
feat : go to DetailPageViewController when specific cell is selected
1song2 Apr 27, 2021
5b6418e
refactor : rename method to goToDishDetail
1song2 Apr 27, 2021
6471088
refactor : replace mockup API URL with real one
1song2 Apr 28, 2021
f8de5da
feat : add thumbnailImageScrollView
1song2 Apr 28, 2021
7bce9a3
feat : add dish data in DB
JacksonPk Apr 28, 2021
0f9370c
feat : add required elements to DetailPageViewController
1song2 Apr 28, 2021
d90a8a7
feat : add DishDetail and DishDetailResponseDTO
1song2 Apr 28, 2021
0028aee
feat : let ViewController get id information when cell is selected
1song2 Apr 28, 2021
96eb4fe
feat : show detailed info on dish
1song2 Apr 28, 2021
6ca3976
feat : let ViewController get category information when cell is selected
1song2 Apr 28, 2021
231310c
fix : enable to add array to Realm by list<T>() (#24)
JacksonPk Apr 28, 2021
16db4bc
feat : add FetchDishDetailsUseCase
1song2 Apr 28, 2021
f3fdb26
refactor : replace category with categoryName
1song2 Apr 28, 2021
9d9878b
feat : show detailed information about selected dish
1song2 Apr 28, 2021
7543910
refactor : make labels multiline
1song2 Apr 28, 2021
ec93be7
chore : update DetailPageView UI
1song2 Apr 28, 2021
0990fc4
chore : update UI of point and delivery
1song2 Apr 28, 2021
9ef2707
feat : add custom stepper
1song2 Apr 28, 2021
92e4ce7
refactor : change value of Obervable to non-optional DishDetail type
1song2 Apr 29, 2021
7b67445
refactor : embed badgeBackgroundView and label in stack view
1song2 Apr 29, 2021
1e7f2a1
feat : add functions data to DB and get from DB (#24)
JacksonPk Apr 29, 2021
dd1dafd
feat : add RealmManger to handle Realm
JacksonPk Apr 29, 2021
71c0eb5
refactor : add thousand separator to prices
1song2 Apr 29, 2021
e87710f
refactor : customize button style
1song2 Apr 29, 2021
ce18911
refactor : add section inset
1song2 Apr 29, 2021
82ad7f3
refactor : rename get set methods
JacksonPk Apr 29, 2021
7c70eea
refactor : change catogory type to non-observable
1song2 Apr 29, 2021
b07e127
refactor : update stepper state
1song2 Apr 29, 2021
a9f6261
refactor : make thumbImage nil in prepareForReuse
1song2 Apr 29, 2021
6b7ed44
chore
JacksonPk Apr 29, 2021
820e727
Merge pull request #25 from rla36/iOS/feat/detail-page-view
JacksonPk Apr 29, 2021
aaf57e0
Merge remote-tracking branch 'refs/remotes/banchancode/dev-iOS'
JacksonPk Apr 29, 2021
f10ac4b
feat : merge with iOS/feat/detail-page-view
JacksonPk Apr 29, 2021
b22b22b
feat : add DishDetailDB funcs
JacksonPk Apr 29, 2021
156b4c5
refactor : add custom UIView BadgeView
1song2 Apr 29, 2021
6b0e33b
refactor : break DishDetail up into three elements
1song2 Apr 29, 2021
d425037
refactor : add KeyColors enum
1song2 Apr 29, 2021
54598e8
refactor : move add to Realm func from ViewModel to UseCase
JacksonPk Apr 29, 2021
ebcebbf
refactor : add failure case to network functions to use RealmDB
JacksonPk Apr 29, 2021
9852175
refactor : move DBlayer in ViewModel to UseCase
JacksonPk Apr 29, 2021
631246b
chore : remove comments(#24)
JacksonPk Apr 29, 2021
c7de000
refactor : move network related logic to ViewModel
1song2 Apr 29, 2021
e9571cc
refactor :extend NSAttributedString to make part of the text bold
1song2 Apr 29, 2021
36ee292
style : add line breaks for better readability
1song2 Apr 29, 2021
bb05ed9
refactor : modify method performRequest to generic function
1song2 Apr 29, 2021
5513f47
style : remove unnecessary line break
1song2 Apr 29, 2021
b5c3d21
refactor : move currentQuantity and totalPrice to ViewModel
1song2 Apr 30, 2021
e92e0a7
refactor : move price related logic to ViewModel
1song2 Apr 30, 2021
cfa02b4
refactor : change paramter type to optional Int
1song2 Apr 30, 2021
b4fc47a
Merge remote-tracking branch 'refs/remotes/banchancode/iOS/feat/refacโ€ฆ
JacksonPk Apr 30, 2021
c9db182
refactor : merge with refactoring
JacksonPk Apr 30, 2021
a63cc03
refactor : update overall codes
JacksonPk Apr 30, 2021
bf834af
Merge pull request #26 from rla36/iOS/feat/Realm
1song2 Apr 30, 2021
91226cb
feat : add sectionHeaderContent with hidden option(#17)
JacksonPk May 1, 2021
b236f79
Merge pull request #27 from rla36/iOS/feat/Toast
JacksonPk May 1, 2021
f2e9884
Merge pull request #28 from rla36/iOS/feat/toast
1song2 May 2, 2021
22190e3
refactor : try to reload each section
1song2 May 2, 2021
23ac570
refactor : move network related code from cell to data source
1song2 May 2, 2021
a078518
refactor : move price related logic from cell to view model
1song2 May 2, 2021
2894fd8
Merge branch 'iOS/feat/refactoring' into dev-iOS
1song2 May 2, 2021
fd930a6
Merge branch 'iOS/feat/refactoring' into dev-iOS
1song2 May 2, 2021
a371aca
Update README.md
JacksonPk Apr 23, 2021
91ec3d3
feat : add Realm library(#24)
JacksonPk Apr 27, 2021
30f16d4
feat : add dish data in DB
JacksonPk Apr 28, 2021
7a30ced
fix : enable to add array to Realm by list<T>() (#24)
JacksonPk Apr 28, 2021
0e9eb2b
feat : add functions data to DB and get from DB (#24)
JacksonPk Apr 29, 2021
a91e197
feat : add RealmManger to handle Realm
JacksonPk Apr 29, 2021
1665972
refactor : rename get set methods
JacksonPk Apr 29, 2021
eb13ad3
chore
JacksonPk Apr 29, 2021
b4f483e
feat : add navigation controller
1song2 Apr 27, 2021
3452825
feat : add DetailPageViewController
1song2 Apr 27, 2021
d0e3168
feat : add navigation controller
1song2 Apr 27, 2021
49a06ae
refactor : rename method to goToDishDetail
1song2 Apr 27, 2021
132d8bf
feat : add navigation controller
1song2 Apr 27, 2021
52011f5
feat : add thumbnailImageScrollView
1song2 Apr 28, 2021
20dbece
feat : add required elements to DetailPageViewController
1song2 Apr 28, 2021
9669352
feat : add DishDetail and DishDetailResponseDTO
1song2 Apr 28, 2021
ff962a1
feat : let ViewController get id information when cell is selected
1song2 Apr 28, 2021
542b445
feat : show detailed info on dish
1song2 Apr 28, 2021
d2c345f
feat : let ViewController get category information when cell is selected
1song2 Apr 28, 2021
5d5691c
feat : add FetchDishDetailsUseCase
1song2 Apr 28, 2021
6449ad4
feat : let ViewController get category information when cell is selected
1song2 Apr 28, 2021
be22b8d
feat : show detailed information about selected dish
1song2 Apr 28, 2021
5d00d1a
refactor : make labels multiline
1song2 Apr 28, 2021
af785fb
chore : update DetailPageView UI
1song2 Apr 28, 2021
e47fac9
chore : update UI of point and delivery
1song2 Apr 28, 2021
1640865
feat : add custom stepper
1song2 Apr 28, 2021
0e5efbb
refactor : change value of Obervable to non-optional DishDetail type
1song2 Apr 29, 2021
4145305
refactor : embed badgeBackgroundView and label in stack view
1song2 Apr 29, 2021
e7c697a
refactor : add thousand separator to prices
1song2 Apr 29, 2021
57421b6
refactor : customize button style
1song2 Apr 29, 2021
251cb14
refactor : add section inset
1song2 Apr 29, 2021
0c6588b
refactor : customize button style
1song2 Apr 29, 2021
b875eb2
refactor : add section inset
1song2 Apr 29, 2021
d3d5805
refactor : make thumbImage nil in prepareForReuse
1song2 Apr 29, 2021
3588bf7
refactor : add section inset
1song2 Apr 29, 2021
24833d6
refactor : make thumbImage nil in prepareForReuse
1song2 Apr 29, 2021
214a920
refactor : add section inset
1song2 Apr 29, 2021
73457cc
refactor : make thumbImage nil in prepareForReuse
1song2 Apr 29, 2021
22d46e0
refactor : add section inset
1song2 Apr 29, 2021
833b2ae
refactor : add custom UIView BadgeView
1song2 Apr 29, 2021
ceb6366
refactor : add section inset
1song2 Apr 29, 2021
ce44c0e
refactor : add KeyColors enum
1song2 Apr 29, 2021
19c6f28
refactor : add section inset
1song2 Apr 29, 2021
596bf06
refactor :extend NSAttributedString to make part of the text bold
1song2 Apr 29, 2021
482b79a
style : add line breaks for better readability
1song2 Apr 29, 2021
3259116
refactor :extend NSAttributedString to make part of the text bold
1song2 Apr 29, 2021
63a55d9
style : remove unnecessary line break
1song2 Apr 29, 2021
e4fe0e3
refactor :extend NSAttributedString to make part of the text bold
1song2 Apr 29, 2021
e203d34
style : remove unnecessary line break
1song2 Apr 29, 2021
cd75dde
refactor : change paramter type to optional Int
1song2 Apr 30, 2021
4a8cf5a
style : remove unnecessary line break
1song2 Apr 29, 2021
0990e2f
refactor : change paramter type to optional Int
1song2 Apr 30, 2021
4fa0b3e
feat : add sectionHeaderContent with hidden option(#17)
JacksonPk May 1, 2021
06abb91
refactor : try to reload each section
1song2 May 2, 2021
586cedc
refactor : move network related code from cell to data source
1song2 May 2, 2021
f6ecc57
refactor : move price related logic from cell to view model
1song2 May 2, 2021
313df74
Merge branch 'dev-iOS' of https://github.com/rla36/sidedish into dev-iOS
1song2 May 2, 2021
f42f46f
chore : replace URL address with mockup URL
1song2 May 4, 2021
85e76b4
fix: change order of lines
1song2 May 16, 2021
c22330b
refactor: add queue as argument to method
1song2 May 16, 2021
b02bd0c
fix: remove unnecessary code from methods
1song2 May 16, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified .DS_Store
Binary file not shown.
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Banchan-Code

- ์šฐ๋ฆฌ์˜ ํŒ€๋ช…์€ `๋ฐ˜์ฐฌ์ฝ”๋“œ`(Banchan-Code)์ž…๋‹ˆ๋‹ค~


## ๋ฐฑ๊น€์น˜๐Ÿฅฌ(BE) : ์ •๐Ÿงšโ€โ™€๏ธ, ์—ฐ๐Ÿ‘ฉ๐Ÿป
## ์˜ค์ด์†Œ๋ฐ•์ด๐Ÿฅ’(iOS) : ์ญ๐Ÿฅฒ, ์žญ์Šจ๐Ÿ™‰
15 changes: 14 additions & 1 deletion iOS/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ playground.xcworkspace
# you should judge for yourself, the pros and cons are mentioned at:
# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
#
# Pods/
Pods/
#
# Add this line if you want to avoid checking in source code from the Xcode workspace
# *.xcworkspace
Expand Down Expand Up @@ -89,4 +89,17 @@ fastlane/test_output

iOSInjectionProject/

# Created by https://www.toptal.com/developers/gitignore/api/swiftpackagemanager
# Edit at https://www.toptal.com/developers/gitignore?templates=swiftpackagemanager

### SwiftPackageManager ###
Packages
.build/
xcuserdata
DerivedData/
*.xcodeproj


# End of https://www.toptal.com/developers/gitignore/api/swiftpackagemanager

**/.DS_Store
60 changes: 60 additions & 0 deletions iOS/BanchanCode/BanchanCode.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,15 @@
E46342EA2631199B0001D87A /* DishesResponseDTO+Mapping.swift in Sources */ = {isa = PBXBuildFile; fileRef = E46342E92631199B0001D87A /* DishesResponseDTO+Mapping.swift */; };
E463431E263155C00001D87A /* NetworkManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = E463431D263155C00001D87A /* NetworkManager.swift */; };
E463432D263178E10001D87A /* String+StrikeThrough.swift in Sources */ = {isa = PBXBuildFile; fileRef = E463432C263178E10001D87A /* String+StrikeThrough.swift */; };
E49F172F2638CF39006C2108 /* DetailPageViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = E49F172E2638CF39006C2108 /* DetailPageViewController.swift */; };
E49F173526390170006C2108 /* DishDetail.swift in Sources */ = {isa = PBXBuildFile; fileRef = E49F173426390170006C2108 /* DishDetail.swift */; };
E49F173726390185006C2108 /* DishDetailResponseDTO.swift in Sources */ = {isa = PBXBuildFile; fileRef = E49F173626390185006C2108 /* DishDetailResponseDTO.swift */; };
E49F173D26393964006C2108 /* FetchDishDetailsUseCase.swift in Sources */ = {isa = PBXBuildFile; fileRef = E49F173C26393963006C2108 /* FetchDishDetailsUseCase.swift */; };
E4B254A12639544B00F522A6 /* UseCase.swift in Sources */ = {isa = PBXBuildFile; fileRef = E4B254A02639544B00F522A6 /* UseCase.swift */; };
E4B254A526397CEF00F522A6 /* DishDetailsViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = E4B254A426397CEF00F522A6 /* DishDetailsViewModel.swift */; };
E4BD2E6D263A9E0E008E9404 /* String+FormattingPrice.swift in Sources */ = {isa = PBXBuildFile; fileRef = E4BD2E6C263A9E0E008E9404 /* String+FormattingPrice.swift */; };
E4BD2E71263ACC54008E9404 /* BadgeView.swift in Sources */ = {isa = PBXBuildFile; fileRef = E4BD2E70263ACC54008E9404 /* BadgeView.swift */; };
E4BD2E73263B72DF008E9404 /* NSAttributedString+PartiallyBoldText.swift in Sources */ = {isa = PBXBuildFile; fileRef = E4BD2E72263B72DF008E9404 /* NSAttributedString+PartiallyBoldText.swift */; };
E4D5D7F7263276120077DF97 /* DishesItemViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = E4D5D7F6263276120077DF97 /* DishesItemViewModel.swift */; };
E4D5D8342632ECFF0077DF97 /* DishesViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = E4D5D8332632ECFF0077DF97 /* DishesViewModel.swift */; };
E4D5D83C2632ED5C0077DF97 /* Observable.swift in Sources */ = {isa = PBXBuildFile; fileRef = E4D5D83B2632ED5C0077DF97 /* Observable.swift */; };
Expand All @@ -23,6 +32,8 @@
E4FC9C8E262EA2E000BEAAE4 /* DishCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = E4FC9C8C262EA2E000BEAAE4 /* DishCell.swift */; };
E4FC9C8F262EA2E000BEAAE4 /* DishCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = E4FC9C8D262EA2E000BEAAE4 /* DishCell.xib */; };
E4FC9CBB26300D5800BEAAE4 /* Dish.swift in Sources */ = {isa = PBXBuildFile; fileRef = E4FC9CBA26300D5800BEAAE4 /* Dish.swift */; };
FA74E4B6263880B100F1CC7B /* DishDB.swift in Sources */ = {isa = PBXBuildFile; fileRef = FA74E4B5263880B100F1CC7B /* DishDB.swift */; };
FA74E4BE2638880A00F1CC7B /* RealmManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = FA74E4BD2638880A00F1CC7B /* RealmManager.swift */; };
FA864A792630030600A3C429 /* SectionHeaderView.swift in Sources */ = {isa = PBXBuildFile; fileRef = FA864A772630030500A3C429 /* SectionHeaderView.swift */; };
FA864A7A2630030600A3C429 /* SectionHeaderView.xib in Resources */ = {isa = PBXBuildFile; fileRef = FA864A782630030600A3C429 /* SectionHeaderView.xib */; };
FA88E9DF262E7F50001C3E53 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = FA88E9DE262E7F50001C3E53 /* AppDelegate.swift */; };
Expand Down Expand Up @@ -65,6 +76,15 @@
E46342E92631199B0001D87A /* DishesResponseDTO+Mapping.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "DishesResponseDTO+Mapping.swift"; sourceTree = "<group>"; };
E463431D263155C00001D87A /* NetworkManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NetworkManager.swift; sourceTree = "<group>"; };
E463432C263178E10001D87A /* String+StrikeThrough.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "String+StrikeThrough.swift"; sourceTree = "<group>"; };
E49F172E2638CF39006C2108 /* DetailPageViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DetailPageViewController.swift; sourceTree = "<group>"; };
E49F173426390170006C2108 /* DishDetail.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DishDetail.swift; sourceTree = "<group>"; };
E49F173626390185006C2108 /* DishDetailResponseDTO.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DishDetailResponseDTO.swift; sourceTree = "<group>"; };
E49F173C26393963006C2108 /* FetchDishDetailsUseCase.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FetchDishDetailsUseCase.swift; sourceTree = "<group>"; };
E4B254A02639544B00F522A6 /* UseCase.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UseCase.swift; sourceTree = "<group>"; };
E4B254A426397CEF00F522A6 /* DishDetailsViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DishDetailsViewModel.swift; sourceTree = "<group>"; };
E4BD2E6C263A9E0E008E9404 /* String+FormattingPrice.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "String+FormattingPrice.swift"; sourceTree = "<group>"; };
E4BD2E70263ACC54008E9404 /* BadgeView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BadgeView.swift; sourceTree = "<group>"; };
E4BD2E72263B72DF008E9404 /* NSAttributedString+PartiallyBoldText.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "NSAttributedString+PartiallyBoldText.swift"; sourceTree = "<group>"; };
E4D5D7F6263276120077DF97 /* DishesItemViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DishesItemViewModel.swift; sourceTree = "<group>"; };
E4D5D8332632ECFF0077DF97 /* DishesViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DishesViewModel.swift; sourceTree = "<group>"; };
E4D5D83B2632ED5C0077DF97 /* Observable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Observable.swift; sourceTree = "<group>"; };
Expand All @@ -75,6 +95,8 @@
E4FC9C8C262EA2E000BEAAE4 /* DishCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DishCell.swift; sourceTree = "<group>"; };
E4FC9C8D262EA2E000BEAAE4 /* DishCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = DishCell.xib; sourceTree = "<group>"; };
E4FC9CBA26300D5800BEAAE4 /* Dish.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Dish.swift; sourceTree = "<group>"; };
FA74E4B5263880B100F1CC7B /* DishDB.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DishDB.swift; sourceTree = "<group>"; };
FA74E4BD2638880A00F1CC7B /* RealmManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RealmManager.swift; sourceTree = "<group>"; };
FA864A772630030500A3C429 /* SectionHeaderView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SectionHeaderView.swift; sourceTree = "<group>"; };
FA864A782630030600A3C429 /* SectionHeaderView.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = SectionHeaderView.xib; sourceTree = "<group>"; };
FA88E9DB262E7F50001C3E53 /* BanchanCode.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = BanchanCode.app; sourceTree = BUILT_PRODUCTS_DIR; };
Expand Down Expand Up @@ -147,7 +169,9 @@
E46342EE2631199F0001D87A /* Data */ = {
isa = PBXGroup;
children = (
FA74E4AE263879E100F1CC7B /* PersistentStorage */,
E46342E92631199B0001D87A /* DishesResponseDTO+Mapping.swift */,
E49F173626390185006C2108 /* DishDetailResponseDTO.swift */,
);
path = Data;
sourceTree = "<group>";
Expand All @@ -158,6 +182,7 @@
E4D5D8332632ECFF0077DF97 /* DishesViewModel.swift */,
E4D5D7F6263276120077DF97 /* DishesItemViewModel.swift */,
E4E3BF672636A53A0041BA5B /* Categorizable.swift */,
E4B254A426397CEF00F522A6 /* DishDetailsViewModel.swift */,
);
path = ViewModel;
sourceTree = "<group>";
Expand All @@ -177,6 +202,7 @@
E4D5D7FB2632767C0077DF97 /* ViewModel */,
FA864A73262FFB6600A3C429 /* Views */,
FA88E9E2262E7F50001C3E53 /* MainPageViewController.swift */,
E49F172E2638CF39006C2108 /* DetailPageViewController.swift */,
E4D5D83B2632ED5C0077DF97 /* Observable.swift */,
);
path = Presentation;
Expand All @@ -186,6 +212,8 @@
isa = PBXGroup;
children = (
E4E3BF4A26354F6E0041BA5B /* FetchDishesUseCase.swift */,
E49F173C26393963006C2108 /* FetchDishDetailsUseCase.swift */,
E4B254A02639544B00F522A6 /* UseCase.swift */,
);
path = UseCases;
sourceTree = "<group>";
Expand Down Expand Up @@ -213,6 +241,8 @@
isa = PBXGroup;
children = (
E463432C263178E10001D87A /* String+StrikeThrough.swift */,
E4BD2E6C263A9E0E008E9404 /* String+FormattingPrice.swift */,
E4BD2E72263B72DF008E9404 /* NSAttributedString+PartiallyBoldText.swift */,
);
path = Utility;
sourceTree = "<group>";
Expand All @@ -230,6 +260,7 @@
isa = PBXGroup;
children = (
E4FC9CBA26300D5800BEAAE4 /* Dish.swift */,
E49F173426390170006C2108 /* DishDetail.swift */,
);
path = Entities;
sourceTree = "<group>";
Expand All @@ -242,6 +273,23 @@
path = Network;
sourceTree = "<group>";
};
FA74E4AE263879E100F1CC7B /* PersistentStorage */ = {
isa = PBXGroup;
children = (
FA74E4B42638806600F1CC7B /* RealmStorage */,
);
path = PersistentStorage;
sourceTree = "<group>";
};
FA74E4B42638806600F1CC7B /* RealmStorage */ = {
isa = PBXGroup;
children = (
FA74E4B5263880B100F1CC7B /* DishDB.swift */,
FA74E4BD2638880A00F1CC7B /* RealmManager.swift */,
);
name = RealmStorage;
sourceTree = "<group>";
};
FA864A73262FFB6600A3C429 /* Views */ = {
isa = PBXGroup;
children = (
Expand All @@ -250,6 +298,7 @@
E4FC9C8D262EA2E000BEAAE4 /* DishCell.xib */,
FA864A772630030500A3C429 /* SectionHeaderView.swift */,
FA864A782630030600A3C429 /* SectionHeaderView.xib */,
E4BD2E70263ACC54008E9404 /* BadgeView.swift */,
);
path = Views;
sourceTree = "<group>";
Expand Down Expand Up @@ -551,19 +600,30 @@
files = (
E4D5D83C2632ED5C0077DF97 /* Observable.swift in Sources */,
E4FC9C7F262E9ED800BEAAE4 /* MainPageCollectionViewDataSource.swift in Sources */,
E49F172F2638CF39006C2108 /* DetailPageViewController.swift in Sources */,
E4E3BF4B26354F6E0041BA5B /* FetchDishesUseCase.swift in Sources */,
E4D5D7F7263276120077DF97 /* DishesItemViewModel.swift in Sources */,
E4BD2E73263B72DF008E9404 /* NSAttributedString+PartiallyBoldText.swift in Sources */,
E4B254A12639544B00F522A6 /* UseCase.swift in Sources */,
E49F173D26393964006C2108 /* FetchDishDetailsUseCase.swift in Sources */,
FA88E9E3262E7F50001C3E53 /* MainPageViewController.swift in Sources */,
FA74E4BE2638880A00F1CC7B /* RealmManager.swift in Sources */,
E463431E263155C00001D87A /* NetworkManager.swift in Sources */,
E4B254A526397CEF00F522A6 /* DishDetailsViewModel.swift in Sources */,
E4FC9C79262E9E5800BEAAE4 /* MainPageCollectionViewDelegate.swift in Sources */,
E4BD2E6D263A9E0E008E9404 /* String+FormattingPrice.swift in Sources */,
E4D5D8342632ECFF0077DF97 /* DishesViewModel.swift in Sources */,
E49F173726390185006C2108 /* DishDetailResponseDTO.swift in Sources */,
E4E3BF682636A53A0041BA5B /* Categorizable.swift in Sources */,
FA864A792630030600A3C429 /* SectionHeaderView.swift in Sources */,
E463432D263178E10001D87A /* String+StrikeThrough.swift in Sources */,
E46342EA2631199B0001D87A /* DishesResponseDTO+Mapping.swift in Sources */,
FA88E9DF262E7F50001C3E53 /* AppDelegate.swift in Sources */,
FA74E4B6263880B100F1CC7B /* DishDB.swift in Sources */,
E4FC9CBB26300D5800BEAAE4 /* Dish.swift in Sources */,
E4FC9C8E262EA2E000BEAAE4 /* DishCell.swift in Sources */,
E49F173526390170006C2108 /* DishDetail.swift in Sources */,
E4BD2E71263ACC54008E9404 /* BadgeView.swift in Sources */,
FA88E9E1262E7F50001C3E53 /* SceneDelegate.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand Down
2 changes: 1 addition & 1 deletion iOS/BanchanCode/BanchanCode/Application/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ import UIKit

@main
class AppDelegate: UIResponder, UIApplicationDelegate {

}

Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,5 @@
import UIKit

class SceneDelegate: UIResponder, UIWindowSceneDelegate {

var window: UIWindow?
}
50 changes: 50 additions & 0 deletions iOS/BanchanCode/BanchanCode/Data/DishDetailResponseDTO.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
//
// DishDetailResponseDTO.swift
// BanchanCode
//
// Created by Song on 2021/04/28.
//

import Foundation

struct DishDetailResponseDTO: Decodable {
private enum CodingKeys: String, CodingKey {
case id
case name
case description
case prices
case badges
case stock
case point
case deliveryInfo = "delivery_info"
case thumbImages = "thumb_images"
case detailImages = "detail_images"
}
let id: Int
let name: String
let description: String
let prices: [Int]
let badges: [String]
let stock: Int
let point: Int
let deliveryInfo: String
let thumbImages: [String]
let detailImages: [String]
}

extension DishDetailResponseDTO {
func toDomain() -> DishDetail {
return .init(basicInformation: BasicInformation(
id: id,
name: name,
description: description,
prices: prices,
badges: badges,
stock: stock,
point: point,
deliveryInfo: deliveryInfo
),
thumbImages: thumbImages,
detailImages: detailImages)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,11 @@ import Foundation

struct DishesResponseDTO: Decodable {
private enum CodingKeys: String, CodingKey {
case category = "title"
case dishes
}
let dishes: [DishDTO]
let category: String
let dishes: [DishDTO]
}

extension DishesResponseDTO {
Expand All @@ -35,7 +37,7 @@ extension DishesResponseDTO {

extension DishesResponseDTO {
func toDomain() -> Dishes {
return .init(dishes: dishes.map { $0.toDomain() })
return .init(category: nil, dishes: dishes.map { $0.toDomain() })
}
}

Expand Down
33 changes: 33 additions & 0 deletions iOS/BanchanCode/BanchanCode/Data/PersistentStorage/DishDB.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
//
// DishEntitiy.swift
// BanchanCode
//
// Created by jinseo park on 4/28/21.
//

import Foundation
import RealmSwift

class DishDB: Object {

@objc dynamic var id: Int = -1
@objc dynamic var name: String = ""
@objc dynamic var contents: String = ""
@objc dynamic var imageURL: String = ""
@objc dynamic var categoryName: String = ""
let prices = List<Int>()
let badges = List<String>()

convenience init(id: Int, name: String, contents: String, imageURL: String, categoryName: String) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

covenience init์„ ์“ฐ์‹  ์ด์œ ๊ฐ€ ๋”ฐ๋กœ ์žˆ์„๊นŒ์š”? ํŠน๋ณ„ํ•œ ์ด์œ ๊ฐ€ ์—†์œผ์‹œ๋‹ค๋ฉด ๊ทธ๋ƒฅ init์„ ์จ๋„ ๋  ๊ฒƒ ๊ฐ™์Šต๋‹ˆ๋‹ค.

self.init()
self.id = id
self.name = name
self.contents = contents
self.imageURL = imageURL
self.categoryName = categoryName
}
Comment on lines +22 to +28

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

์ด ๋ถ€๋ถ„์—์„œ prices ์™€ badges๋ฅผ ์ถ”๊ฐ€ํ•˜๋Š”๊ฒŒ ๊น”๋”ํ•˜๊ฒ ๋„ค์š”. ๊ทธ๋ฆฌ๊ณ  ์ฐพ์•„๋ณด๋‹ˆ append(objectsIn:) ๋ผ๋Š” ๊ฒƒ๋„ ์žˆ๋Š”๋ฐ ์จ๋ณด์‹œ๋Š” ๊ฒŒ ์–ด๋–จ๊นŒ์š”?


override class func primaryKey() -> String? {
return "id"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
//
// RealmManager.swift
// BanchanCode
//
// Created by jinseo park on 4/28/21.
//

import RealmSwift
import Foundation

private protocol RealmOperations {
func addDishes(items: [DishesItemViewModel], categoryName: String)
func getDishes(categryName: String) -> Dishes
}

class RealmManager: RealmOperations {
let realm = try! Realm()

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

forcedunwrapping ์€ ์ข‹์ง€ ์•Š์•„์š”. ์•„์˜ˆ ์‚ฌ์šฉ ์•ˆํ•˜์‹œ๋Š” ๊ฑธ ๊ถŒ์žฅํ•ฉ๋‹ˆ๋‹ค.
try? ์„ ์‚ฌ์šฉํ•˜๊ฑฐ๋‚˜ do-try-catch ๊ตฌ๋ฌธ์œผ๋กœ ์—๋Ÿฌ๋ฅผ ์žก๋Š” ๊ฒƒ์ด ์ข‹์Šต๋‹ˆ๋‹ค

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

๊ฐ์‚ฌํ•ฉ๋‹ˆ๋‹ค. ํŠœํ† ๋ฆฌ์–ผ๋Œ€๋กœ ๋”ฐ๋ผ๋งŒ ํ•˜๋‹ค๋ณด๋‹ˆ force๋ฅผ ์ด์šฉํ–ˆ์Šต๋‹ˆ๋‹ค. ์•ž์œผ๋กœ๋Š” try catch๋กœ ๊ตฌํ˜„ํ•ด๋ณด๋Š” ์Šต๊ด€์„ ํ‚ค์šฐ๋„๋ก ํ•˜๊ฒ ์Šต๋‹ˆ๋‹ค!


func addDishes(items: [DishesItemViewModel], categoryName: String) {
items.forEach { item in
if (realm.object(ofType: DishDB.self, forPrimaryKey: item.dish.id) == nil) {
let dishDB = DishDB(id: item.dish.id, name: item.dish.name, contents: item.dish.description, imageURL: item.dish.imageURL, categoryName: categoryName)
item.dish.prices.forEach {
dishDB.prices.append($0)
}
item.dish.badges.forEach {
dishDB.badges.append($0)
}
try! realm.write {
realm.add(dishDB)
}
Comment on lines +29 to +31

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • ๋งˆ์ฐฌ๊ฐ€์ง€๋กœ try? ์„ ์‚ฌ์šฉํ•˜๊ฑฐ๋‚˜ do-try-catch ๊ตฌ๋ฌธ์œผ๋กœ ์—๋Ÿฌ๋ฅผ ์žก๋Š” ๊ฒƒ์ด ์ข‹์Šต๋‹ˆ๋‹ค.
  • ๋˜ ์Šค์œ„ํ”„ํŠธ์—์„œ Error๋ž€ ์ฒ˜๋ฆฌ๊ฐ€๋Šฅํ•œ ์—๋Ÿฌ๋ฅผ ๋งํ•ฉ๋‹ˆ๋‹ค. ์Šค์œ„ํ”„ํŠธ์˜ Error๋Š” ์ž๋ฐ”, ์˜ค๋ธŒ์ ํ‹ฐ๋ธŒ์”จ์˜ Error ๋ฐ Exception์™€๋Š” ๋˜ ์–ด๋–ป๊ฒŒ ๋‹ค๋ฅธ์ง€ ๊ณต๋ถ€ํ•˜์‹œ๋ฉด Swift๋ฅผ ๋ณด๋‹ค ๊นŠ๊ฒŒ ์ดํ•ดํ•˜์‹ค ์ˆ˜ ์žˆ์„ ๊ฒƒ ๊ฐ™์•„์š”.
    • ์ด ๋ถ€๋ถ„์— ๋Œ€ํ•ด์„œ๋Š” ์ œ๊ฐ€ ์Šคํ„ฐ๋””ํ•˜๋ฉด์„œ ์ž‘์„ฑํ•œ ๊ธ€์ด ์žˆ๋Š”๋ฐ ํ•œ๋ฒˆ ๋ณด์‹œ๋Š” ๊ฒƒ๋„ ์ข‹์„๊ฒƒ ๊ฐ™์•„์š” ใ…‹ใ…‹ใ…‹ ใ…Žใ…Ž. ๋น„ํŒ์€ ํ™˜์˜์ž…๋‹ˆ๋‹ค!!

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

๊ฐ์‚ฌํ•ฉ๋‹ˆ๋‹ค. ์ด๋ฒˆ ๊ธฐํšŒ์— ์ €๋„ Result<T,Error> ์— ๋Œ€ํ•œ ๊ฐœ๋…์„ ์‚ด์ง ๋ง›๋ณด์•˜๋Š”๋ฐ( ๋„คํŠธ์›Œํฌ ์—ฐ๊ฒฐ์ด ์•ˆ๋์„ ๋•Œ ์—๋Ÿฌ ์ฒ˜๋ฆฌ๋ฅผ ์ด์šฉํ•ด์„œ DB์˜ ์•„์ดํ…œ์„ ๋ถˆ๋Ÿฌ์˜ค๋Š” ๋ฐฉ์‹์œผ๋กœ ๊ตฌํ˜„ํ•˜๊ธฐ ์œ„ํ•ด์„œ) ์ œ์ด์Šจ์ด ์จ์ฃผ์‹  ๊ธ€์„ ํ•œ๋ฒˆ ์ฝ์–ด๋ณด๊ณ  ์ดํ•ดํ•ด๋ณด๊ฒ ์Šต๋‹ˆ๋‹ค!

Copy link

@ehgud0670 ehgud0670 May 9, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

์•„ ๋„ต, ๊ธ€์ด ์ข€ ์ •์ œ๋˜์–ด ์žˆ์ง„ ์•Š์•„์š” ใ…‹ใ…‹ใ…‹

}
}
}

func getDishes(categryName: String) -> Dishes {

var dishItems = Dishes(dishes: [])
let dishes = realm.objects(DishDB.self).filter("categoryName == %@", categryName)

dishes.forEach{ dishDB in
let dish = Dish(id: dishDB.id, name: dishDB.name, description: dishDB.contents, imageURL: dishDB.imageURL, prices: Array(dishDB.prices), badges: Array(dishDB.badges))
dishItems.dishes.append(dish)
}
return dishItems
}
}
Loading