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

Feature/week3 과제 구현 중 .. #6

Open
wants to merge 9 commits into
base: dev
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
Binary file modified .DS_Store
Binary file not shown.
28 changes: 28 additions & 0 deletions 35-Seminar-hee1/35-Seminar-hee1.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@
objectVersion = 77;
objects = {

/* Begin PBXBuildFile section */
970061E52CBA452E002DA8BD /* SnapKit in Frameworks */ = {isa = PBXBuildFile; productRef = 970061E42CBA452E002DA8BD /* SnapKit */; };
/* End PBXBuildFile section */

/* Begin PBXFileReference section */
9742D52B2CB108C70011D0A4 /* 35-Seminar-hee1.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "35-Seminar-hee1.app"; sourceTree = BUILT_PRODUCTS_DIR; };
/* End PBXFileReference section */
Expand Down Expand Up @@ -36,6 +40,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
970061E52CBA452E002DA8BD /* SnapKit in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -78,6 +83,7 @@
);
name = "35-Seminar-hee1";
packageProductDependencies = (
970061E42CBA452E002DA8BD /* SnapKit */,
);
productName = "35-Seminar-hee1";
productReference = 9742D52B2CB108C70011D0A4 /* 35-Seminar-hee1.app */;
Expand Down Expand Up @@ -107,6 +113,9 @@
);
mainGroup = 9742D5222CB108C70011D0A4;
minimizedProjectReferenceProxies = 1;
packageReferences = (
970061E32CBA452E002DA8BD /* XCRemoteSwiftPackageReference "SnapKit" */,
);
preferredProjectObjectVersion = 77;
productRefGroup = 9742D52C2CB108C70011D0A4 /* Products */;
projectDirPath = "";
Expand Down Expand Up @@ -333,6 +342,25 @@
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */

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

/* Begin XCSwiftPackageProductDependency section */
970061E42CBA452E002DA8BD /* SnapKit */ = {
isa = XCSwiftPackageProductDependency;
package = 970061E32CBA452E002DA8BD /* XCRemoteSwiftPackageReference "SnapKit" */;
productName = SnapKit;
};
/* End XCSwiftPackageProductDependency section */
};
rootObject = 9742D5232CB108C70011D0A4 /* Project object */;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"originHash" : "dd27728c8848101841bd8d45243ef43144e233aa3767c82656934b73447347b8",
"pins" : [
{
"identity" : "snapkit",
"kind" : "remoteSourceControl",
"location" : "https://github.com/SnapKit/SnapKit.git",
"state" : {
"revision" : "2842e6e84e82eb9a8dac0100ca90d9444b0307f4",
"version" : "5.7.1"
}
}
],
"version" : 3
}
Binary file not shown.
2 changes: 1 addition & 1 deletion 35-Seminar-hee1/35-Seminar-hee1/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
//

import UIKit

//$0, $1, $2 ... - param을 축약
@main
class AppDelegate: UIResponder, UIApplicationDelegate {

Expand Down
90 changes: 0 additions & 90 deletions 35-Seminar-hee1/35-Seminar-hee1/DetailViewController.swift

This file was deleted.

40 changes: 31 additions & 9 deletions 35-Seminar-hee1/35-Seminar-hee1/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
//

import UIKit

import SnapKit

class ViewController: UIViewController {
private let titleLabel: UILabel = {
Expand Down Expand Up @@ -43,6 +43,12 @@ class ViewController: UIViewController {
return textView
}()

public let nickNameLabel: UILabel = {
let label = UILabel()
label.text = " "
return label
}()

private lazy var nextButton: UIButton = {
let button = UIButton()
button.setTitle("다음", for: .normal)
Expand All @@ -64,11 +70,10 @@ class ViewController: UIViewController {

private var pushMode = true {
didSet {
updateUI() // pushMode 변경 시마다 updateUI()호출
updateUI()
}
}


override func viewDidLoad() {
super.viewDidLoad()
setStyle()
Expand All @@ -83,13 +88,14 @@ class ViewController: UIViewController {
}

private func setUI() {
[titleLabel, imageView, subTitleLabel,feedbackTextView, nextButton, pushModeToggleButton].forEach {
[titleLabel, imageView, subTitleLabel,feedbackTextView, nickNameLabel, nextButton, pushModeToggleButton].forEach {
$0.translatesAutoresizingMaskIntoConstraints = false
self.view.addSubview($0)
}
}

private func setLayout() {
// - Todo : SnapKit통해 오토레이아웃 다시 잡기 - //
NSLayoutConstraint.activate(
[
titleLabel.topAnchor.constraint(
Expand Down Expand Up @@ -122,9 +128,13 @@ class ViewController: UIViewController {
constant: -20
),
feedbackTextView.bottomAnchor.constraint(
equalTo: nextButton.topAnchor, constant: -20
equalTo: nickNameLabel.topAnchor, constant: -20
),

nickNameLabel.topAnchor.constraint(equalTo: feedbackTextView.bottomAnchor, constant: 20),
nickNameLabel.centerXAnchor.constraint(equalTo: view.centerXAnchor),
nickNameLabel.bottomAnchor.constraint(equalTo: nextButton.topAnchor, constant: -20),

nextButton.bottomAnchor.constraint(equalTo: pushModeToggleButton.topAnchor, constant: -20),
nextButton.centerXAnchor.constraint(equalTo: view.centerXAnchor),
nextButton.heightAnchor.constraint(equalToConstant: 50),
Expand Down Expand Up @@ -156,13 +166,19 @@ class ViewController: UIViewController {
transitionToNextViewController()
}
private func transitionToNextViewController() {
let nextViewController = DetailViewController()
let nextViewController = DetailViewController_Closer()

guard let title = feedbackTextView.text else {
return
nextViewController.completionHandler = { [weak self] nickname in
guard let self else { return }
self.nickNameLabel.text = nickname
}

nextViewController.dataBine(title: title)
//nextViewController.delegate = self
// guard let title = feedbackTextView.text else {
// return
// }

//nextViewController.dataBine(title: title)

if pushMode {
self.navigationController?.pushViewController(
Expand All @@ -183,3 +199,9 @@ class ViewController: UIViewController {
}

}

extension ViewController: NicknameDelegate {
func dataBind(nickname: String) {
self.nickNameLabel.text = nickname
}
}
Loading