-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b201259
commit 5e801f9
Showing
3 changed files
with
77 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
} |