From 5e801f99e277beeb3357cf96489d0325f0c24de7 Mon Sep 17 00:00:00 2001 From: jjinwoong Date: Mon, 14 Nov 2022 15:39:27 +0900 Subject: [PATCH] =?UTF-8?q?[feat]=20=ED=80=98=EC=8A=A4=ED=8A=B8=EC=99=80?= =?UTF-8?q?=20=EC=9C=A0=EC=A0=80=20=EC=97=94=ED=8B=B0=ED=8B=B0=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DailyQuest.xcodeproj/project.pbxproj | 24 ++++++++++++ .../DailyQuest/Domain/Entities/Quest.swift | 37 +++++++++++++++++++ .../DailyQuest/Domain/Entities/User.swift | 16 ++++++++ 3 files changed, 77 insertions(+) create mode 100644 DailyQuest/DailyQuest/Domain/Entities/Quest.swift create mode 100644 DailyQuest/DailyQuest/Domain/Entities/User.swift diff --git a/DailyQuest/DailyQuest.xcodeproj/project.pbxproj b/DailyQuest/DailyQuest.xcodeproj/project.pbxproj index 7d8a67b..0bc5520 100644 --- a/DailyQuest/DailyQuest.xcodeproj/project.pbxproj +++ b/DailyQuest/DailyQuest.xcodeproj/project.pbxproj @@ -11,6 +11,8 @@ 34131399291E47D300E607E1 /* RxSwift in Frameworks */ = {isa = PBXBuildFile; productRef = 34131398291E47D300E607E1 /* RxSwift */; }; 3413139C291E480500E607E1 /* SnapKit in Frameworks */ = {isa = PBXBuildFile; productRef = 3413139B291E480500E607E1 /* SnapKit */; }; 3413139F291E48A100E607E1 /* Realm in Frameworks */ = {isa = PBXBuildFile; productRef = 3413139E291E48A100E607E1 /* Realm */; }; + 3449AD5B2922164B00B87619 /* Quest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3449AD5A2922164B00B87619 /* Quest.swift */; }; + 3449AD5D2922197000B87619 /* User.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3449AD5C2922197000B87619 /* User.swift */; }; 34ACC32D291DE9C000741371 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 34ACC32C291DE9C000741371 /* AppDelegate.swift */; }; 34ACC32F291DE9C000741371 /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 34ACC32E291DE9C000741371 /* SceneDelegate.swift */; }; 34ACC336291DE9C100741371 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 34ACC335291DE9C100741371 /* Assets.xcassets */; }; @@ -43,6 +45,8 @@ /* End PBXContainerItemProxy section */ /* Begin PBXFileReference section */ + 3449AD5A2922164B00B87619 /* Quest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Quest.swift; sourceTree = ""; }; + 3449AD5C2922197000B87619 /* User.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = User.swift; sourceTree = ""; }; 34ACC329291DE9C000741371 /* DailyQuest.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = DailyQuest.app; sourceTree = BUILT_PRODUCTS_DIR; }; 34ACC32C291DE9C000741371 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 34ACC32E291DE9C000741371 /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = ""; }; @@ -90,6 +94,22 @@ /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ + 3449AD592922162E00B87619 /* Entities */ = { + isa = PBXGroup; + children = ( + 3449AD5A2922164B00B87619 /* Quest.swift */, + 3449AD5C2922197000B87619 /* User.swift */, + ); + path = Entities; + sourceTree = ""; + }; + 3449AD5E292219D600B87619 /* Common */ = { + isa = PBXGroup; + children = ( + ); + path = Common; + sourceTree = ""; + }; 34ACC320291DE9C000741371 = { isa = PBXGroup; children = ( @@ -154,6 +174,7 @@ 34ACC368291DF02500741371 /* Presentaion */ = { isa = PBXGroup; children = ( + 3449AD5E292219D600B87619 /* Common */, ); path = Presentaion; sourceTree = ""; @@ -161,6 +182,7 @@ 34ACC369291DF03600741371 /* Domain */ = { isa = PBXGroup; children = ( + 3449AD592922162E00B87619 /* Entities */, ); path = Domain; sourceTree = ""; @@ -319,7 +341,9 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + 3449AD5D2922197000B87619 /* User.swift in Sources */, 34ACC32D291DE9C000741371 /* AppDelegate.swift in Sources */, + 3449AD5B2922164B00B87619 /* Quest.swift in Sources */, 34ACC32F291DE9C000741371 /* SceneDelegate.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; diff --git a/DailyQuest/DailyQuest/Domain/Entities/Quest.swift b/DailyQuest/DailyQuest/Domain/Entities/Quest.swift new file mode 100644 index 0000000..081ac7b --- /dev/null +++ b/DailyQuest/DailyQuest/Domain/Entities/Quest.swift @@ -0,0 +1,37 @@ +// +// Quest.swift +// DailyQuest +// +// Created by jinwoong Kim on 2022/11/14. +// + +import Foundation + +struct Quest { + let title: String + let startDay: Date + let endDay: Date + let `repeat`: Int + var currentCount: Int + let totalCount: Int + + var state: Bool { + return currentCount == totalCount + } + + mutating func increaseCount(with value: Int=1) { + guard currentCount + value <= totalCount else { + self.currentCount = totalCount + return + } + self.currentCount += value + } + + mutating func decreaseCount(with value: Int=1) { + guard currentCount - value >= 0 else { + self.currentCount = 0 + return + } + self.currentCount -= value + } +} diff --git a/DailyQuest/DailyQuest/Domain/Entities/User.swift b/DailyQuest/DailyQuest/Domain/Entities/User.swift new file mode 100644 index 0000000..e59f3c8 --- /dev/null +++ b/DailyQuest/DailyQuest/Domain/Entities/User.swift @@ -0,0 +1,16 @@ +// +// User.swift +// DailyQuest +// +// Created by jinwoong Kim on 2022/11/14. +// + +import Foundation + +struct User { + let uuid: UUID + let nickName: String + let profile: Data + let backgroundImage: Data + let description: String +}