Skip to content

Commit

Permalink
[feat] 퀘스트와 유저 엔티티 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
jinwoong16 committed Nov 14, 2022
1 parent b201259 commit 5e801f9
Show file tree
Hide file tree
Showing 3 changed files with 77 additions and 0 deletions.
24 changes: 24 additions & 0 deletions DailyQuest/DailyQuest.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -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 */; };
Expand Down Expand Up @@ -43,6 +45,8 @@
/* End PBXContainerItemProxy section */

/* Begin PBXFileReference section */
3449AD5A2922164B00B87619 /* Quest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Quest.swift; sourceTree = "<group>"; };
3449AD5C2922197000B87619 /* User.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = User.swift; sourceTree = "<group>"; };
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 = "<group>"; };
34ACC32E291DE9C000741371 /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -90,6 +94,22 @@
/* End PBXFrameworksBuildPhase section */

/* Begin PBXGroup section */
3449AD592922162E00B87619 /* Entities */ = {
isa = PBXGroup;
children = (
3449AD5A2922164B00B87619 /* Quest.swift */,
3449AD5C2922197000B87619 /* User.swift */,
);
path = Entities;
sourceTree = "<group>";
};
3449AD5E292219D600B87619 /* Common */ = {
isa = PBXGroup;
children = (
);
path = Common;
sourceTree = "<group>";
};
34ACC320291DE9C000741371 = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -154,13 +174,15 @@
34ACC368291DF02500741371 /* Presentaion */ = {
isa = PBXGroup;
children = (
3449AD5E292219D600B87619 /* Common */,
);
path = Presentaion;
sourceTree = "<group>";
};
34ACC369291DF03600741371 /* Domain */ = {
isa = PBXGroup;
children = (
3449AD592922162E00B87619 /* Entities */,
);
path = Domain;
sourceTree = "<group>";
Expand Down Expand Up @@ -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;
Expand Down
37 changes: 37 additions & 0 deletions DailyQuest/DailyQuest/Domain/Entities/Quest.swift
Original file line number Diff line number Diff line change
@@ -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
}
}
16 changes: 16 additions & 0 deletions DailyQuest/DailyQuest/Domain/Entities/User.swift
Original file line number Diff line number Diff line change
@@ -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
}

0 comments on commit 5e801f9

Please sign in to comment.