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

일기장 [STEP 2] Zion, Serena #136

Open
wants to merge 36 commits into
base: ic_9_serena
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 21 commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
f14e295
feat: CoreData과 DiaryCoreData 생성 및 CRUD 구현
serena0720 Sep 11, 2023
f586ac6
feat: ActivityViewControllerShowable, AlertControllerShowable 타입 구현완료
LeeZion94 Sep 11, 2023
8536d5c
feat: ViewController에 Showable Type 적용
LeeZion94 Sep 11, 2023
359557c
refactor: AppManager에 DiaryDataManager 주입
serena0720 Sep 11, 2023
165c338
refactor: DiarySample 삭제 및 DiaryEntity 타입 적용
serena0720 Sep 11, 2023
0759a83
refactor: DiaryEntity 변수 타입 수정 및 컨벤션 수정
serena0720 Sep 11, 2023
8195eef
refactor: DiaryDetailViewController 파라미터 수정
serena0720 Sep 11, 2023
39faa79
feat: createDiaryData 생성
serena0720 Sep 12, 2023
c5c5b60
feat: viewWillAppear 시 dataFetch
LeeZion94 Sep 12, 2023
469ba3a
feat: DiaryDetailViewController Update 기능 연결
LeeZion94 Sep 12, 2023
723ae29
refactor: 불필요 커밋 삭제
LeeZion94 Sep 12, 2023
701dba8
feat: deleteAction 구현
serena0720 Sep 12, 2023
f5dee66
feat: DiaryDetailViewController Delete 메소드
serena0720 Sep 12, 2023
500f635
feat: Update, Create 예외처리 추가
LeeZion94 Sep 12, 2023
9fcf716
feat: TextView EndEditing시 Save로직 추가
LeeZion94 Sep 12, 2023
6c34cff
feat: NotificationCenter Observer 등록
serena0720 Sep 12, 2023
97bb291
feat: background 시 create 로직 추가 및 예외처리
LeeZion94 Sep 12, 2023
9974d9a
feat: Activity Share Action 생성
serena0720 Sep 12, 2023
9269899
feat: date 출력 추가 및 becomeResponder 추가
LeeZion94 Sep 12, 2023
bc89e58
feat: diffableDataSource delete시 bottom Constraint 충돌해결
LeeZion94 Sep 12, 2023
b5ae868
refactor: 사용하지 않는 model 삭제
LeeZion94 Sep 12, 2023
021fc0f
refactor: private 누락 수정
serena0720 Sep 14, 2023
7125c8a
fix: title만 존재할경우 body도 title처럼 나오는 이슈 수정
LeeZion94 Sep 14, 2023
9cce9b2
Merge remote-tracking branch 'origin/Step2' into Step2
LeeZion94 Sep 14, 2023
21cc6ff
fix: insertData로직 추가 및 data Create반환 값 삭제, DiaryCoreDataManager 삭제
LeeZion94 Sep 14, 2023
678318f
refactor: 불필요한 메소드 삭제
serena0720 Sep 14, 2023
d97d383
refactor: insertData 에러 수정
serena0720 Sep 14, 2023
c41d293
feat: CoreData 수정 및 DiaryContentsDTO 생성
LeeZion94 Sep 14, 2023
575b0cd
feat: DiaryDetailViewController UseCase 생성 및 적용
LeeZion94 Sep 14, 2023
258deca
feat: 누락 수정사항 추가
LeeZion94 Sep 14, 2023
12cccf3
feat: CoreDataManagerType 생성 및 적용
LeeZion94 Sep 14, 2023
0d8b23d
fix: Save 시 Fetch 타이밍 수정
LeeZion94 Sep 14, 2023
ed70720
fix: Delete가 되지 않는 문제 수정
LeeZion94 Sep 14, 2023
c5a27c2
docs: Step2 README 작성
serena0720 Sep 15, 2023
b3a7146
chore: 컨벤션 통일
serena0720 Sep 17, 2023
8fc9f0e
Merge branch 'Step2' of https://github.com/serena0720/ios-diary into …
serena0720 Sep 17, 2023
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
50 changes: 37 additions & 13 deletions Diary.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,29 @@

/* Begin PBXBuildFile section */
5BBC44392A9F036000C528DD /* MainTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5BBC44382A9F036000C528DD /* MainTableViewCell.swift */; };
5BBC443B2A9F276100C528DD /* DiarySample.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5BBC443A2A9F276100C528DD /* DiarySample.swift */; };
5BBC443D2A9F30ED00C528DD /* .swiftlint.yml in Resources */ = {isa = PBXBuildFile; fileRef = 5BBC443C2A9F30ED00C528DD /* .swiftlint.yml */; };
5BF1B2D22AAF422300FDC1A5 /* AlertControllerShowable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5BF1B2D12AAF422300FDC1A5 /* AlertControllerShowable.swift */; };
5BF1B2D42AAF42FB00FDC1A5 /* ActivityViewControllerShowable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5BF1B2D32AAF42FB00FDC1A5 /* ActivityViewControllerShowable.swift */; };
C739AE25284DF28600741E8F /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = C739AE24284DF28600741E8F /* AppDelegate.swift */; };
C739AE27284DF28600741E8F /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = C739AE26284DF28600741E8F /* SceneDelegate.swift */; };
C739AE29284DF28600741E8F /* MainViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = C739AE28284DF28600741E8F /* MainViewController.swift */; };
C739AE2F284DF28600741E8F /* Diary.xcdatamodeld in Sources */ = {isa = PBXBuildFile; fileRef = C739AE2D284DF28600741E8F /* Diary.xcdatamodeld */; };
C739AE31284DF28600741E8F /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = C739AE30284DF28600741E8F /* Assets.xcassets */; };
C739AE34284DF28600741E8F /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = C739AE32284DF28600741E8F /* LaunchScreen.storyboard */; };
D2C1FBEF2A9F058000526DA5 /* DiaryContent.swift in Sources */ = {isa = PBXBuildFile; fileRef = D2C1FBEE2A9F058000526DA5 /* DiaryContent.swift */; };
D2C1FBF32A9F0A0900526DA5 /* AddDiaryViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D2C1FBF22A9F0A0900526DA5 /* AddDiaryViewController.swift */; };
D2BCA2B02AAF3A7900D55F4C /* DiaryEntity+CoreDataClass.swift in Sources */ = {isa = PBXBuildFile; fileRef = D2BCA2AE2AAF3A7900D55F4C /* DiaryEntity+CoreDataClass.swift */; };
D2BCA2B12AAF3A7900D55F4C /* DiaryEntity+CoreDataProperties.swift in Sources */ = {isa = PBXBuildFile; fileRef = D2BCA2AF2AAF3A7900D55F4C /* DiaryEntity+CoreDataProperties.swift */; };
D2BCA2B52AAF3B1500D55F4C /* CoreDataManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = D2BCA2B42AAF3B1500D55F4C /* CoreDataManager.swift */; };
D2BCA2B72AAF3B2300D55F4C /* DiaryCoreDataManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = D2BCA2B62AAF3B2300D55F4C /* DiaryCoreDataManager.swift */; };
D2C1FBF32A9F0A0900526DA5 /* DiaryDetailViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D2C1FBF22A9F0A0900526DA5 /* DiaryDetailViewController.swift */; };
D2C1FBF62A9F1EC100526DA5 /* AppManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = D2C1FBF52A9F1EC100526DA5 /* AppManager.swift */; };
D2DB46872AA1A83B009D1926 /* ReuseIdentifiable.swift in Sources */ = {isa = PBXBuildFile; fileRef = D2DB46862AA1A83B009D1926 /* ReuseIdentifiable.swift */; };
/* End PBXBuildFile section */

/* Begin PBXFileReference section */
5BBC44382A9F036000C528DD /* MainTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MainTableViewCell.swift; sourceTree = "<group>"; };
5BBC443A2A9F276100C528DD /* DiarySample.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DiarySample.swift; sourceTree = "<group>"; };
5BBC443C2A9F30ED00C528DD /* .swiftlint.yml */ = {isa = PBXFileReference; lastKnownFileType = text.yaml; path = .swiftlint.yml; sourceTree = "<group>"; };
5BF1B2D12AAF422300FDC1A5 /* AlertControllerShowable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AlertControllerShowable.swift; sourceTree = "<group>"; };
5BF1B2D32AAF42FB00FDC1A5 /* ActivityViewControllerShowable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ActivityViewControllerShowable.swift; sourceTree = "<group>"; };
C739AE21284DF28600741E8F /* Diary.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Diary.app; sourceTree = BUILT_PRODUCTS_DIR; };
C739AE24284DF28600741E8F /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
C739AE26284DF28600741E8F /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = "<group>"; };
Expand All @@ -34,8 +39,11 @@
C739AE30284DF28600741E8F /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
C739AE33284DF28600741E8F /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
C739AE35284DF28600741E8F /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
D2C1FBEE2A9F058000526DA5 /* DiaryContent.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DiaryContent.swift; sourceTree = "<group>"; };
D2C1FBF22A9F0A0900526DA5 /* AddDiaryViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AddDiaryViewController.swift; sourceTree = "<group>"; };
D2BCA2AE2AAF3A7900D55F4C /* DiaryEntity+CoreDataClass.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "DiaryEntity+CoreDataClass.swift"; sourceTree = "<group>"; };
D2BCA2AF2AAF3A7900D55F4C /* DiaryEntity+CoreDataProperties.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "DiaryEntity+CoreDataProperties.swift"; sourceTree = "<group>"; };
D2BCA2B42AAF3B1500D55F4C /* CoreDataManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CoreDataManager.swift; sourceTree = "<group>"; };
D2BCA2B62AAF3B2300D55F4C /* DiaryCoreDataManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DiaryCoreDataManager.swift; sourceTree = "<group>"; };
D2C1FBF22A9F0A0900526DA5 /* DiaryDetailViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DiaryDetailViewController.swift; sourceTree = "<group>"; };
D2C1FBF52A9F1EC100526DA5 /* AppManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppManager.swift; sourceTree = "<group>"; };
D2DB46862AA1A83B009D1926 /* ReuseIdentifiable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ReuseIdentifiable.swift; sourceTree = "<group>"; };
/* End PBXFileReference section */
Expand Down Expand Up @@ -64,7 +72,7 @@
isa = PBXGroup;
children = (
C739AE28284DF28600741E8F /* MainViewController.swift */,
D2C1FBF22A9F0A0900526DA5 /* AddDiaryViewController.swift */,
D2C1FBF22A9F0A0900526DA5 /* DiaryDetailViewController.swift */,
);
path = Controller;
sourceTree = "<group>";
Expand All @@ -81,9 +89,7 @@
5BBC44362A9F025500C528DD /* Model */ = {
isa = PBXGroup;
children = (
C739AE2D284DF28600741E8F /* Diary.xcdatamodeld */,
D2C1FBEE2A9F058000526DA5 /* DiaryContent.swift */,
5BBC443A2A9F276100C528DD /* DiarySample.swift */,
D2BCA2B22AAF3A8700D55F4C /* CoreData */,
);
path = Model;
sourceTree = "<group>";
Expand Down Expand Up @@ -128,10 +134,22 @@
path = Diary;
sourceTree = "<group>";
};
D2BCA2B22AAF3A8700D55F4C /* CoreData */ = {
isa = PBXGroup;
children = (
C739AE2D284DF28600741E8F /* Diary.xcdatamodeld */,
D2BCA2AE2AAF3A7900D55F4C /* DiaryEntity+CoreDataClass.swift */,
D2BCA2AF2AAF3A7900D55F4C /* DiaryEntity+CoreDataProperties.swift */,
);
path = CoreData;
sourceTree = "<group>";
};
D2C1FBF42A9F1EA400526DA5 /* Manager */ = {
isa = PBXGroup;
children = (
D2C1FBF52A9F1EC100526DA5 /* AppManager.swift */,
D2BCA2B42AAF3B1500D55F4C /* CoreDataManager.swift */,
D2BCA2B62AAF3B2300D55F4C /* DiaryCoreDataManager.swift */,
);
path = Manager;
sourceTree = "<group>";
Expand All @@ -140,6 +158,8 @@
isa = PBXGroup;
children = (
D2DB46862AA1A83B009D1926 /* ReuseIdentifiable.swift */,
5BF1B2D12AAF422300FDC1A5 /* AlertControllerShowable.swift */,
5BF1B2D32AAF42FB00FDC1A5 /* ActivityViewControllerShowable.swift */,
);
path = Protocol;
sourceTree = "<group>";
Expand Down Expand Up @@ -237,15 +257,19 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
5BF1B2D42AAF42FB00FDC1A5 /* ActivityViewControllerShowable.swift in Sources */,
5BF1B2D22AAF422300FDC1A5 /* AlertControllerShowable.swift in Sources */,
C739AE29284DF28600741E8F /* MainViewController.swift in Sources */,
C739AE25284DF28600741E8F /* AppDelegate.swift in Sources */,
C739AE27284DF28600741E8F /* SceneDelegate.swift in Sources */,
D2C1FBF32A9F0A0900526DA5 /* AddDiaryViewController.swift in Sources */,
D2C1FBEF2A9F058000526DA5 /* DiaryContent.swift in Sources */,
D2C1FBF32A9F0A0900526DA5 /* DiaryDetailViewController.swift in Sources */,
D2BCA2B12AAF3A7900D55F4C /* DiaryEntity+CoreDataProperties.swift in Sources */,
C739AE2F284DF28600741E8F /* Diary.xcdatamodeld in Sources */,
D2BCA2B52AAF3B1500D55F4C /* CoreDataManager.swift in Sources */,
5BBC44392A9F036000C528DD /* MainTableViewCell.swift in Sources */,
D2C1FBF62A9F1EC100526DA5 /* AppManager.swift in Sources */,
5BBC443B2A9F276100C528DD /* DiarySample.swift in Sources */,
D2BCA2B72AAF3B2300D55F4C /* DiaryCoreDataManager.swift in Sources */,
D2BCA2B02AAF3A7900D55F4C /* DiaryEntity+CoreDataClass.swift in Sources */,
D2DB46872AA1A83B009D1926 /* ReuseIdentifiable.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand Down
77 changes: 77 additions & 0 deletions Diary.xcodeproj/xcshareddata/xcschemes/Diary.xcscheme
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1430"
version = "1.7">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "C739AE20284DF28600741E8F"
BuildableName = "Diary.app"
BlueprintName = "Diary"
ReferencedContainer = "container:Diary.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES"
shouldAutocreateTestPlan = "YES">
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "C739AE20284DF28600741E8F"
BuildableName = "Diary.app"
BlueprintName = "Diary"
ReferencedContainer = "container:Diary.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "C739AE20284DF28600741E8F"
BuildableName = "Diary.app"
BlueprintName = "Diary"
ReferencedContainer = "container:Diary.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
51 changes: 1 addition & 50 deletions Diary/App/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,12 @@ import CoreData

@main
class AppDelegate: UIResponder, UIApplicationDelegate {



func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
return true
}

// MARK: UISceneSession Lifecycle

func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration {
// Called when a new scene session is being created.
// Use this method to select a configuration to create the new scene with.
Expand All @@ -30,49 +26,4 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
// If any sessions were discarded while the application was not running, this will be called shortly after application:didFinishLaunchingWithOptions.
// Use this method to release any resources that were specific to the discarded scenes, as they will not return.
}

// MARK: - Core Data stack

lazy var persistentContainer: NSPersistentContainer = {
/*
The persistent container for the application. This implementation
creates and returns a container, having loaded the store for the
application to it. This property is optional since there are legitimate
error conditions that could cause the creation of the store to fail.
*/
let container = NSPersistentContainer(name: "Diary")
container.loadPersistentStores(completionHandler: { (storeDescription, error) in
if let error = error as NSError? {
// Replace this implementation with code to handle the error appropriately.
// fatalError() causes the application to generate a crash log and terminate. You should not use this function in a shipping application, although it may be useful during development.

/*
Typical reasons for an error here include:
* The parent directory does not exist, cannot be created, or disallows writing.
* The persistent store is not accessible, due to permissions or data protection when the device is locked.
* The device is out of space.
* The store could not be migrated to the current model version.
Check the error message to determine what the actual problem was.
*/
fatalError("Unresolved error \(error), \(error.userInfo)")
}
})
return container
}()

// MARK: - Core Data Saving support

func saveContext () {
let context = persistentContainer.viewContext
if context.hasChanges {
do {
try context.save()
} catch {
// Replace this implementation with code to handle the error appropriately.
// fatalError() causes the application to generate a crash log and terminate. You should not use this function in a shipping application, although it may be useful during development.
let nserror = error as NSError
fatalError("Unresolved error \(nserror), \(nserror.userInfo)")
}
}
}
}
9 changes: 2 additions & 7 deletions Diary/App/SceneDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate {
guard let windowScene = (scene as? UIWindowScene) else { return }

let navigationController = UINavigationController()
appManager = AppManager(navigationController: navigationController)
let diaryDataManager = DiaryCoreDataManager(name: "Diary")

appManager = AppManager(navigationController: navigationController, diaryDataManager: diaryDataManager)
appManager?.start()
window = UIWindow(windowScene: windowScene)
window?.rootViewController = navigationController
Expand Down Expand Up @@ -45,11 +46,5 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate {
}

func sceneDidEnterBackground(_ scene: UIScene) {
// Called as the scene transitions from the foreground to the background.
// Use this method to save data, release shared resources, and store enough scene-specific state information
// to restore the scene back to its current state.

// Save changes in the application's managed object context when the application transitions to the background.
(UIApplication.shared.delegate as? AppDelegate)?.saveContext()
}
}
60 changes: 0 additions & 60 deletions Diary/Controller/AddDiaryViewController.swift

This file was deleted.

Loading