Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
Empty file added Icon
Empty file.
57 changes: 43 additions & 14 deletions iOS_Study_B.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,27 +10,35 @@
954B6B812AC57DAA00FDCFAB /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 954B6B802AC57DAA00FDCFAB /* AppDelegate.swift */; };
954B6B832AC57DAA00FDCFAB /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 954B6B822AC57DAA00FDCFAB /* SceneDelegate.swift */; };
954B6B852AC57DAA00FDCFAB /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 954B6B842AC57DAA00FDCFAB /* ViewController.swift */; };
954B6B882AC57DAA00FDCFAB /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 954B6B862AC57DAA00FDCFAB /* Main.storyboard */; };
954B6B8A2AC57DAB00FDCFAB /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 954B6B892AC57DAB00FDCFAB /* Assets.xcassets */; };
954B6B8D2AC57DAB00FDCFAB /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 954B6B8B2AC57DAB00FDCFAB /* LaunchScreen.storyboard */; };
CC3EE7BB2B073A56009C5287 /* MemoDetailViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = CC3EE7BA2B073A56009C5287 /* MemoDetailViewController.swift */; };
CC3EE7BD2B073DF9009C5287 /* MemoEditViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = CC3EE7BC2B073DF9009C5287 /* MemoEditViewController.swift */; };
CC72E1FD2B16185400353D28 /* SnapKit in Frameworks */ = {isa = PBXBuildFile; productRef = CC72E1FC2B16185400353D28 /* SnapKit */; };
CC7D36DE2B04E1380069F109 /* MemoTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = CC7D36DD2B04E1380069F109 /* MemoTableViewCell.swift */; };
CC7D36E42B05A0D60069F109 /* MemoViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = CC7D36E32B05A0D60069F109 /* MemoViewController.swift */; };
/* End PBXBuildFile section */

/* Begin PBXFileReference section */
954B6B7D2AC57DAA00FDCFAB /* iOS_Study_B.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = iOS_Study_B.app; sourceTree = BUILT_PRODUCTS_DIR; };
954B6B802AC57DAA00FDCFAB /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
954B6B822AC57DAA00FDCFAB /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = "<group>"; };
954B6B842AC57DAA00FDCFAB /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = "<group>"; };
954B6B872AC57DAA00FDCFAB /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
954B6B892AC57DAB00FDCFAB /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
954B6B8C2AC57DAB00FDCFAB /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
954B6B8E2AC57DAB00FDCFAB /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
CC3EE7BA2B073A56009C5287 /* MemoDetailViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MemoDetailViewController.swift; sourceTree = "<group>"; };
CC3EE7BC2B073DF9009C5287 /* MemoEditViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MemoEditViewController.swift; sourceTree = "<group>"; };
CC7D36DD2B04E1380069F109 /* MemoTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MemoTableViewCell.swift; sourceTree = "<group>"; };
CC7D36E32B05A0D60069F109 /* MemoViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MemoViewController.swift; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
954B6B7A2AC57DAA00FDCFAB /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
CC72E1FD2B16185400353D28 /* SnapKit in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand All @@ -56,13 +64,16 @@
954B6B7F2AC57DAA00FDCFAB /* iOS_Study_B */ = {
isa = PBXGroup;
children = (
CC7D36DD2B04E1380069F109 /* MemoTableViewCell.swift */,
954B6B802AC57DAA00FDCFAB /* AppDelegate.swift */,
954B6B822AC57DAA00FDCFAB /* SceneDelegate.swift */,
954B6B842AC57DAA00FDCFAB /* ViewController.swift */,
954B6B862AC57DAA00FDCFAB /* Main.storyboard */,
CC7D36E32B05A0D60069F109 /* MemoViewController.swift */,
954B6B892AC57DAB00FDCFAB /* Assets.xcassets */,
954B6B8B2AC57DAB00FDCFAB /* LaunchScreen.storyboard */,
954B6B8E2AC57DAB00FDCFAB /* Info.plist */,
CC3EE7BA2B073A56009C5287 /* MemoDetailViewController.swift */,
CC3EE7BC2B073DF9009C5287 /* MemoEditViewController.swift */,
);
path = iOS_Study_B;
sourceTree = "<group>";
Expand All @@ -83,6 +94,9 @@
dependencies = (
);
name = iOS_Study_B;
packageProductDependencies = (
CC72E1FC2B16185400353D28 /* SnapKit */,
);
productName = iOS_Study_B;
productReference = 954B6B7D2AC57DAA00FDCFAB /* iOS_Study_B.app */;
productType = "com.apple.product-type.application";
Expand Down Expand Up @@ -111,6 +125,9 @@
Base,
);
mainGroup = 954B6B742AC57DAA00FDCFAB;
packageReferences = (
CC72E1FB2B16185400353D28 /* XCRemoteSwiftPackageReference "SnapKit" */,
);
productRefGroup = 954B6B7E2AC57DAA00FDCFAB /* Products */;
projectDirPath = "";
projectRoot = "";
Expand All @@ -127,7 +144,6 @@
files = (
954B6B8D2AC57DAB00FDCFAB /* LaunchScreen.storyboard in Resources */,
954B6B8A2AC57DAB00FDCFAB /* Assets.xcassets in Resources */,
954B6B882AC57DAA00FDCFAB /* Main.storyboard in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand All @@ -139,22 +155,18 @@
buildActionMask = 2147483647;
files = (
954B6B852AC57DAA00FDCFAB /* ViewController.swift in Sources */,
CC3EE7BB2B073A56009C5287 /* MemoDetailViewController.swift in Sources */,
954B6B812AC57DAA00FDCFAB /* AppDelegate.swift in Sources */,
CC7D36E42B05A0D60069F109 /* MemoViewController.swift in Sources */,
954B6B832AC57DAA00FDCFAB /* SceneDelegate.swift in Sources */,
CC7D36DE2B04E1380069F109 /* MemoTableViewCell.swift in Sources */,
CC3EE7BD2B073DF9009C5287 /* MemoEditViewController.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */

/* Begin PBXVariantGroup section */
954B6B862AC57DAA00FDCFAB /* Main.storyboard */ = {
isa = PBXVariantGroup;
children = (
954B6B872AC57DAA00FDCFAB /* Base */,
);
name = Main.storyboard;
sourceTree = "<group>";
};
954B6B8B2AC57DAB00FDCFAB /* LaunchScreen.storyboard */ = {
isa = PBXVariantGroup;
children = (
Expand Down Expand Up @@ -291,7 +303,6 @@
INFOPLIST_FILE = iOS_Study_B/Info.plist;
INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES;
INFOPLIST_KEY_UILaunchStoryboardName = LaunchScreen;
INFOPLIST_KEY_UIMainStoryboardFile = Main;
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
LD_RUNPATH_SEARCH_PATHS = (
Expand All @@ -318,7 +329,6 @@
INFOPLIST_FILE = iOS_Study_B/Info.plist;
INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES;
INFOPLIST_KEY_UILaunchStoryboardName = LaunchScreen;
INFOPLIST_KEY_UIMainStoryboardFile = Main;
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
LD_RUNPATH_SEARCH_PATHS = (
Expand Down Expand Up @@ -356,6 +366,25 @@
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */

/* Begin XCRemoteSwiftPackageReference section */
CC72E1FB2B16185400353D28 /* XCRemoteSwiftPackageReference "SnapKit" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/SnapKit/SnapKit.git";
requirement = {
kind = upToNextMajorVersion;
minimumVersion = 5.6.0;
};
};
/* End XCRemoteSwiftPackageReference section */

/* Begin XCSwiftPackageProductDependency section */
CC72E1FC2B16185400353D28 /* SnapKit */ = {
isa = XCSwiftPackageProductDependency;
package = CC72E1FB2B16185400353D28 /* XCRemoteSwiftPackageReference "SnapKit" */;
productName = SnapKit;
};
/* End XCSwiftPackageProductDependency section */
};
rootObject = 954B6B752AC57DAA00FDCFAB /* Project object */;
}
Original file line number Diff line number Diff line change
@@ -1,14 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>SchemeUserState</key>
<dict>
<key>iOS_Study_B.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>0</integer>
</dict>
</dict>
</dict>
<dict/>
</plist>

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 0 additions & 24 deletions iOS_Study_B/Base.lproj/Main.storyboard

This file was deleted.

2 changes: 0 additions & 2 deletions iOS_Study_B/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
<string>Default Configuration</string>
<key>UISceneDelegateClassName</key>
<string>$(PRODUCT_MODULE_NAME).SceneDelegate</string>
<key>UISceneStoryboardFile</key>
<string>Main</string>
</dict>
</array>
</dict>
Expand Down
119 changes: 119 additions & 0 deletions iOS_Study_B/MemoDetailViewController.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
//
// MemoDetailViewController.swift
// iOS_Study_B
//
// Created by 임아영 on 11/17/23.
//


import UIKit
import SnapKit

class MemoDetailViewController: UIViewController {

var memo: Memo?
var index: Int?
weak var delegate: MemoEditDelegate?

let Label1: UILabel = {
let label = UILabel()
label.font = UIFont.boldSystemFont(ofSize: 18)
return label
}()

let Label2: UILabel = {
let label = UILabel()
label.font = UIFont.systemFont(ofSize: 16)
label.numberOfLines = 0
return label
}()

override func viewDidLoad() {
super.viewDidLoad()
view.backgroundColor = .white

navigationItem.title = "메모 상세"

configureSubviews()
makeConstraints()
setNavigationBar()

if let memo = memo {
displayMemo(memo)
}
}

override func viewWillDisappear(_ animated: Bool) {
super.viewWillDisappear(animated)

if isMovingFromParent {
backButtonTapped()
}
}

func configureSubviews() {
view.addSubview(Label1)
view.addSubview(Label2)

}

func makeConstraints() {
Label1.snp.makeConstraints { make in
make.top.equalTo(view.safeAreaLayoutGuide.snp.top).offset(20)
make.leading.equalTo(view.safeAreaLayoutGuide.snp.leading).offset(20)
make.trailing.equalTo(view.safeAreaLayoutGuide.snp.trailing).offset(-20)
Comment on lines +63 to +64
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

make.leading.trailing.equalTo(view.safeAreaLayoutGuide.snp.leading).inset(20) 한 줄로 가능합니다

}
Label2.snp.makeConstraints { make in
make.top.equalTo(Label1.snp.bottom).offset(20)
make.leading.equalTo(view.safeAreaLayoutGuide.snp.leading).offset(20)
make.trailing.equalTo(view.safeAreaLayoutGuide.snp.trailing).offset(-20)
}
}

func setNavigationBar() {
let editButton = UIBarButtonItem(title: "수정하기", style: .plain, target: self, action: #selector(editButtonTapped))
navigationItem.rightBarButtonItem = editButton
}

@objc func editButtonTapped() {
let MemoEditViewController = MemoEditViewController()

MemoEditViewController.memo = memo
MemoEditViewController.index = index
MemoEditViewController.delegate = self
self.navigationController?.pushViewController(MemoEditViewController, animated: true)
}

@objc func backButtonTapped() {
guard let updatedMemo = createUpdatedMemo() else {
return
}

delegate?.didUpdateMemo(updatedMemo, atIndex: index!)
self.navigationController?.popViewController(animated: true)
}

func createUpdatedMemo() -> Memo? {
guard let updatedLabel1 = Label1.text,
let updatedLabel2 = Label2.text else {
return nil
}

return Memo(id: memo?.id, title: updatedLabel1, content: updatedLabel2)
}

func displayMemo(_ memo: Memo) {
Label1.text = memo.title
Label2.text = memo.content
}
}

protocol MemoEditDelegate: AnyObject {
func didUpdateMemo(_ memo: Memo, atIndex: Int)
}

extension MemoDetailViewController: MemoEditDelegate {
func didUpdateMemo(_ memo: Memo, atIndex: Int) {
displayMemo(memo)
}
}
Loading