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

[전얀] 메모장 앱 만들기 #14

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
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
73 changes: 55 additions & 18 deletions iOS_Study_B.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,28 @@
objects = {

/* Begin PBXBuildFile section */
2D55A19F2B04DE94005EDF94 /* SnapKit in Frameworks */ = {isa = PBXBuildFile; productRef = 2D55A19E2B04DE94005EDF94 /* SnapKit */; };
2D55A1A12B04DE94005EDF94 /* SnapKit-Dynamic in Frameworks */ = {isa = PBXBuildFile; productRef = 2D55A1A02B04DE94005EDF94 /* SnapKit-Dynamic */; };
2D55A1A32B04E143005EDF94 /* MemoTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2D55A1A22B04E143005EDF94 /* MemoTableViewCell.swift */; };
2D55A1A52B04E699005EDF94 /* AddMemoViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2D55A1A42B04E699005EDF94 /* AddMemoViewController.swift */; };
2DE266212B0B1AC0006E53CE /* DetailMemoViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2DE266202B0B1AC0006E53CE /* DetailMemoViewController.swift */; };
2DE266232B0B333A006E53CE /* EditMemoViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2DE266222B0B333A006E53CE /* EditMemoViewController.swift */; };
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 */; };
954B6B852AC57DAA00FDCFAB /* MainViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 954B6B842AC57DAA00FDCFAB /* MainViewController.swift */; };
954B6B8A2AC57DAB00FDCFAB /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 954B6B892AC57DAB00FDCFAB /* Assets.xcassets */; };
954B6B8D2AC57DAB00FDCFAB /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 954B6B8B2AC57DAB00FDCFAB /* LaunchScreen.storyboard */; };
/* End PBXBuildFile section */

/* Begin PBXFileReference section */
2D55A1A22B04E143005EDF94 /* MemoTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MemoTableViewCell.swift; sourceTree = "<group>"; };
2D55A1A42B04E699005EDF94 /* AddMemoViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AddMemoViewController.swift; sourceTree = "<group>"; };
2DE266202B0B1AC0006E53CE /* DetailMemoViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DetailMemoViewController.swift; sourceTree = "<group>"; };
2DE266222B0B333A006E53CE /* EditMemoViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EditMemoViewController.swift; sourceTree = "<group>"; };
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>"; };
954B6B842AC57DAA00FDCFAB /* MainViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MainViewController.swift; 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>"; };
Expand All @@ -31,6 +39,8 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
2D55A19F2B04DE94005EDF94 /* SnapKit in Frameworks */,
2D55A1A12B04DE94005EDF94 /* SnapKit-Dynamic in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -58,8 +68,11 @@
children = (
954B6B802AC57DAA00FDCFAB /* AppDelegate.swift */,
954B6B822AC57DAA00FDCFAB /* SceneDelegate.swift */,
954B6B842AC57DAA00FDCFAB /* ViewController.swift */,
954B6B862AC57DAA00FDCFAB /* Main.storyboard */,
954B6B842AC57DAA00FDCFAB /* MainViewController.swift */,
2D55A1A42B04E699005EDF94 /* AddMemoViewController.swift */,
2D55A1A22B04E143005EDF94 /* MemoTableViewCell.swift */,
2DE266202B0B1AC0006E53CE /* DetailMemoViewController.swift */,
2DE266222B0B333A006E53CE /* EditMemoViewController.swift */,
954B6B892AC57DAB00FDCFAB /* Assets.xcassets */,
954B6B8B2AC57DAB00FDCFAB /* LaunchScreen.storyboard */,
954B6B8E2AC57DAB00FDCFAB /* Info.plist */,
Expand All @@ -83,6 +96,10 @@
dependencies = (
);
name = iOS_Study_B;
packageProductDependencies = (
2D55A19E2B04DE94005EDF94 /* SnapKit */,
2D55A1A02B04DE94005EDF94 /* SnapKit-Dynamic */,
);
productName = iOS_Study_B;
productReference = 954B6B7D2AC57DAA00FDCFAB /* iOS_Study_B.app */;
productType = "com.apple.product-type.application";
Expand Down Expand Up @@ -111,6 +128,9 @@
Base,
);
mainGroup = 954B6B742AC57DAA00FDCFAB;
packageReferences = (
2D55A19D2B04DE94005EDF94 /* XCRemoteSwiftPackageReference "SnapKit" */,
);
productRefGroup = 954B6B7E2AC57DAA00FDCFAB /* Products */;
projectDirPath = "";
projectRoot = "";
Expand All @@ -127,7 +147,6 @@
files = (
954B6B8D2AC57DAB00FDCFAB /* LaunchScreen.storyboard in Resources */,
954B6B8A2AC57DAB00FDCFAB /* Assets.xcassets in Resources */,
954B6B882AC57DAA00FDCFAB /* Main.storyboard in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand All @@ -138,23 +157,19 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
954B6B852AC57DAA00FDCFAB /* ViewController.swift in Sources */,
954B6B852AC57DAA00FDCFAB /* MainViewController.swift in Sources */,
2DE266232B0B333A006E53CE /* EditMemoViewController.swift in Sources */,
2D55A1A52B04E699005EDF94 /* AddMemoViewController.swift in Sources */,
954B6B812AC57DAA00FDCFAB /* AppDelegate.swift in Sources */,
954B6B832AC57DAA00FDCFAB /* SceneDelegate.swift in Sources */,
2D55A1A32B04E143005EDF94 /* MemoTableViewCell.swift in Sources */,
2DE266212B0B1AC0006E53CE /* DetailMemoViewController.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 +306,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 +332,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 +369,30 @@
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */

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

/* Begin XCSwiftPackageProductDependency section */
2D55A19E2B04DE94005EDF94 /* SnapKit */ = {
isa = XCSwiftPackageProductDependency;
package = 2D55A19D2B04DE94005EDF94 /* XCRemoteSwiftPackageReference "SnapKit" */;
productName = SnapKit;
};
2D55A1A02B04DE94005EDF94 /* SnapKit-Dynamic */ = {
isa = XCSwiftPackageProductDependency;
package = 2D55A19D2B04DE94005EDF94 /* XCRemoteSwiftPackageReference "SnapKit" */;
productName = "SnapKit-Dynamic";
};
/* End XCSwiftPackageProductDependency section */
};
rootObject = 954B6B752AC57DAA00FDCFAB /* Project object */;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"pins" : [
{
"identity" : "snapkit",
"kind" : "remoteSourceControl",
"location" : "https://github.com/SnapKit/SnapKit.git",
"state" : {
"revision" : "f222cbdf325885926566172f6f5f06af95473158",
"version" : "5.6.0"
}
}
],
"version" : 2
}
79 changes: 79 additions & 0 deletions iOS_Study_B/AddMemoViewController.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
//
// AddMemoViewController.swift
// iOS_Study_B
//
// Created by 정민지 on 11/15/23.
//

import UIKit
import SnapKit

struct MemoInformation: Identifiable {
var id: ObjectIdentifier?
var title: String?
var content: String?
}

class AddMemoViewController: UIViewController {
let TitleTextField: UITextField = {
let textField = UITextField()
textField.placeholder = "제목 입력"
textField.borderStyle = .roundedRect
return textField
}()
let ContentTextField: UITextField = {
let textField = UITextField()
textField.placeholder = "내용 입력"
textField.borderStyle = .roundedRect
return textField
}()
Comment on lines +18 to +29
Copy link
Member

Choose a reason for hiding this comment

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

변수명은 카멜 케이스 사용부탁드려요!


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

configureSubviews()
makeConstraints()

navigationItem.title = "메모 작성"
setNavigationBar()
}

func configureSubviews() {
view.addSubview(TitleTextField)
view.addSubview(ContentTextField)

}

func makeConstraints() {
TitleTextField.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 +51 to +52
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) 한 줄로 가능해요

ContentTextField.snp.makeConstraints{make in
make.top.equalTo(TitleTextField.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 addButton = UIBarButtonItem(title: "작성하기" , style: .plain, target: self, action: #selector(addButtonTapped))
navigationItem.rightBarButtonItem = addButton
}
@objc func addButtonTapped() {
guard let title = TitleTextField.text, let content = ContentTextField.text else {
// 제목 또는 내용이 nil일 경우 처리
return
}
Comment on lines +64 to +67
Copy link
Member

Choose a reason for hiding this comment

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

제목, 내용이 없어도 메모가 작성되는 이슈가 있어요!


// 입력된 값으로 Memo 객체 생성
let newMemo = MemoInformation(id: ObjectIdentifier(self), title: title, content: content)

// ViewController에 대한 참조를 가져와 새로운 메모를 추가
if let viewController = navigationController?.viewControllers.first as? MainViewController {
viewController.addMemo(newMemo)
}

self.navigationController?.popViewController(animated: true)
}
}
24 changes: 0 additions & 24 deletions iOS_Study_B/Base.lproj/Main.storyboard

This file was deleted.

Loading