Skip to content

Commit

Permalink
[Feat/#45] 날짜 데이터 저장
Browse files Browse the repository at this point in the history
  • Loading branch information
Zoe0929 committed Jun 16, 2024
1 parent 04a142e commit aa86569
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 0 deletions.
8 changes: 8 additions & 0 deletions HMH_iOS/HMH_iOS.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,8 @@
368780E12C01EF7400454827 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 365CD6C02B7E4C5100245CDD /* Assets.xcassets */; };
368780E32C024DAD00454827 /* CustomButtonModifer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 368780E22C024DAD00454827 /* CustomButtonModifer.swift */; };
368833862C1F4004000F3A45 /* UserChallenge.xcdatamodeld in Sources */ = {isa = PBXBuildFile; fileRef = 368833842C1F4004000F3A45 /* UserChallenge.xcdatamodeld */; };
3688339C2C1F5931000F3A45 /* UserDefaultsManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3688339B2C1F5931000F3A45 /* UserDefaultsManager.swift */; };
368833A02C1F5B39000F3A45 /* Date+.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3688339F2C1F5B39000F3A45 /* Date+.swift */; };
368C5D972BCC41990035A1AC /* HMHDeviceActivityReport.swift in Sources */ = {isa = PBXBuildFile; fileRef = 368C5D962BCC41990035A1AC /* HMHDeviceActivityReport.swift */; };
368C5D992BCC41990035A1AC /* TotalActivityReport.swift in Sources */ = {isa = PBXBuildFile; fileRef = 368C5D982BCC41990035A1AC /* TotalActivityReport.swift */; };
368C5D9B2BCC41990035A1AC /* TotalActivityView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 368C5D9A2BCC41990035A1AC /* TotalActivityView.swift */; };
Expand Down Expand Up @@ -385,6 +387,8 @@
368780DA2C01ED4E00454827 /* ShieldConfigureExtension.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = ShieldConfigureExtension.entitlements; sourceTree = "<group>"; };
368780E22C024DAD00454827 /* CustomButtonModifer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CustomButtonModifer.swift; sourceTree = "<group>"; };
368833852C1F4004000F3A45 /* UserChallenge.xcdatamodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcdatamodel; path = UserChallenge.xcdatamodel; sourceTree = "<group>"; };
3688339B2C1F5931000F3A45 /* UserDefaultsManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UserDefaultsManager.swift; sourceTree = "<group>"; };
3688339F2C1F5B39000F3A45 /* Date+.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Date+.swift"; sourceTree = "<group>"; };
368C5D942BCC41990035A1AC /* HMHDeviceActivityReport.appex */ = {isa = PBXFileReference; explicitFileType = "wrapper.extensionkit-extension"; includeInIndex = 0; path = HMHDeviceActivityReport.appex; sourceTree = BUILT_PRODUCTS_DIR; };
368C5D962BCC41990035A1AC /* HMHDeviceActivityReport.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HMHDeviceActivityReport.swift; sourceTree = "<group>"; };
368C5D982BCC41990035A1AC /* TotalActivityReport.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TotalActivityReport.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -783,13 +787,15 @@
367244E82BF3D770007A5A7B /* AppStorageKey.swift */,
367244EC2BF3E778007A5A7B /* NotificationManager.swift */,
0BDDA0132C005A25001BD43E /* KeyChainStorage.swift */,
3688339B2C1F5931000F3A45 /* UserDefaultsManager.swift */,
);
path = Manager;
sourceTree = "<group>";
};
365CD6E62B7E4FB700245CDD /* Extension */ = {
isa = PBXGroup;
children = (
3688339F2C1F5B39000F3A45 /* Date+.swift */,
);
path = Extension;
sourceTree = "<group>";
Expand Down Expand Up @@ -1262,6 +1268,7 @@
367243D32BEDE9F6007A5A7B /* ResponseData.swift in Sources */,
0B6A835C2C085EFD0095060C /* PointRouter.swift in Sources */,
367244132BF086A7007A5A7B /* AuthInterceptor.swift in Sources */,
368833A02C1F5B39000F3A45 /* Date+.swift in Sources */,
367243F62BEDEB32007A5A7B /* DeleteAppRequestDTO.swift in Sources */,
368CAADF2BB9975C00FA83B3 /* NavigationBarView.swift in Sources */,
0B6A835F2C0861B20095060C /* PointRequestDTO.swift in Sources */,
Expand All @@ -1284,6 +1291,7 @@
367244062BEDEC4A007A5A7B /* ChallengeRouter.swift in Sources */,
0BD2D67C2B9F5A7B00733843 /* String.swift in Sources */,
367244112BF08684007A5A7B /* BaseModel.swift in Sources */,
3688339C2C1F5931000F3A45 /* UserDefaultsManager.swift in Sources */,
0BC0E5BD2BB0571E00FB0330 /* NextButtonView.swift in Sources */,
367244ED2BF3E778007A5A7B /* NotificationManager.swift in Sources */,
367244152BF0956B007A5A7B /* PointView.swift in Sources */,
Expand Down
24 changes: 24 additions & 0 deletions HMH_iOS/HMH_iOS/Global/Extension/Date+.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
//
// Date+.swift
// HMH_iOS
//
// Created by 이지희 on 6/17/24.
//

import Foundation

extension Date {
func formattedString(format: String = "yyyy-MM-dd") -> String {
let formatter = DateFormatter()
formatter.dateFormat = format
return formatter.string(from: self)
}
}

extension String {
func toDate(format: String = "yyyy-MM-dd") -> Date? {
let formatter = DateFormatter()
formatter.dateFormat = format
return formatter.date(from: self)
}
}
23 changes: 23 additions & 0 deletions HMH_iOS/HMH_iOS/Global/Manager/UserDefaultsManager.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
//
// UserDefaultsManager.swift
// HMH_iOS
//
// Created by 이지희 on 6/17/24.
//

import Foundation

extension UserDefaults {
private enum Keys {
static let lastSentDate = "lastSentDate"
}

var lastSentDate: String? {
get {
return string(forKey: Keys.lastSentDate)
}
set {
set(newValue, forKey: Keys.lastSentDate)
}
}
}

0 comments on commit aa86569

Please sign in to comment.