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

HomeViewController 연결 & 네비게이션 바 구현 & CTFontManagerRegisterFontsForURL로 폰트 적용 #38

Merged
merged 14 commits into from
Nov 9, 2024
Merged
Show file tree
Hide file tree
Changes from 9 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
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import UIKit
import MHPresentation

final class SceneDelegate: UIResponder, UIWindowSceneDelegate {
var window: UIWindow?
Expand All @@ -11,7 +12,7 @@ final class SceneDelegate: UIResponder, UIWindowSceneDelegate {
guard let windowScene = (scene as? UIWindowScene) else { return }

window = UIWindow(windowScene: windowScene)
window?.rootViewController = ViewController()
window?.rootViewController = HomeViewController()
window?.makeKeyAndVisible()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
DYLIB_INSTALL_NAME_BASE = "@rpath";
ENABLE_MODULE_VERIFIER = YES;
ENABLE_MODULE_VERIFIER = NO;
ENABLE_USER_SCRIPT_SANDBOXING = NO;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_KEY_NSHumanReadableCopyright = "";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@

/* Begin PBXBuildFile section */
0E5C13C62CDE8D1D005406B3 /* UIView+Anchor.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0E5C13C52CDE8D19005406B3 /* UIView+Anchor.swift */; };
0E5C147D2CDF47B2005406B3 /* HomeViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0E5C147C2CDF47B2005406B3 /* HomeViewController.swift */; };
0E5C147F2CDF47D4005406B3 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 0E5C147E2CDF47D4005406B3 /* Images.xcassets */; };
0E5C14842CDF47FF005406B3 /* MHNavigationBar.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0E5C14832CDF47FF005406B3 /* MHNavigationBar.swift */; };
0E7F29192CDB52DE007D4F2B /* UIFont+Ownglyph.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0E7F29182CDB52D4007D4F2B /* UIFont+Ownglyph.swift */; };
0E7F291B2CDB530E007D4F2B /* UILabel+Style.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0E7F291A2CDB5302007D4F2B /* UILabel+Style.swift */; };
0E7F291D2CDB53B5007D4F2B /* Colors.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 0E7F291C2CDB53B5007D4F2B /* Colors.xcassets */; };
Expand All @@ -24,6 +27,9 @@

/* Begin PBXFileReference section */
0E5C13C52CDE8D19005406B3 /* UIView+Anchor.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIView+Anchor.swift"; sourceTree = "<group>"; };
0E5C147C2CDF47B2005406B3 /* HomeViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HomeViewController.swift; sourceTree = "<group>"; };
0E5C147E2CDF47D4005406B3 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = "<group>"; };
0E5C14832CDF47FF005406B3 /* MHNavigationBar.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MHNavigationBar.swift; sourceTree = "<group>"; };
0E7F28EC2CDA6C06007D4F2B /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
0E7F29182CDB52D4007D4F2B /* UIFont+Ownglyph.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIFont+Ownglyph.swift"; sourceTree = "<group>"; };
0E7F291A2CDB5302007D4F2B /* UILabel+Style.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UILabel+Style.swift"; sourceTree = "<group>"; };
Expand Down Expand Up @@ -52,19 +58,38 @@
/* End PBXFrameworksBuildPhase section */

/* Begin PBXGroup section */
0E5C147B2CDF4797005406B3 /* Home */ = {
isa = PBXGroup;
children = (
0E5C147C2CDF47B2005406B3 /* HomeViewController.swift */,
);
path = Home;
sourceTree = "<group>";
};
0E5C14802CDF47EE005406B3 /* Design */ = {
isa = PBXGroup;
children = (
0E5C14832CDF47FF005406B3 /* MHNavigationBar.swift */,
);
path = Design;
sourceTree = "<group>";
};
0E7F28E52CDA6B5E007D4F2B /* Resource */ = {
isa = PBXGroup;
children = (
0E7F28E92CDA6B92007D4F2B /* Fonts */,
0E7F28EC2CDA6C06007D4F2B /* Info.plist */,
0E7F291C2CDB53B5007D4F2B /* Colors.xcassets */,
0E5C147E2CDF47D4005406B3 /* Images.xcassets */,
);
path = Resource;
sourceTree = "<group>";
};
0E7F28E62CDA6B63007D4F2B /* Source */ = {
isa = PBXGroup;
children = (
0E5C14802CDF47EE005406B3 /* Design */,
0E5C147B2CDF4797005406B3 /* Home */,
A8A32C5C2CDCEBD60078B4F6 /* CustomAlbum */,
0E7F29172CDB52CC007D4F2B /* Extensions */,
);
Expand Down Expand Up @@ -213,6 +238,7 @@
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
0E5C147F2CDF47D4005406B3 /* Images.xcassets in Resources */,
0E7F291D2CDB53B5007D4F2B /* Colors.xcassets in Resources */,
A8A32C592CDC98D40078B4F6 /* OwnglyphBerry.ttf in Resources */,
);
Expand Down Expand Up @@ -247,9 +273,11 @@
files = (
0E7F29192CDB52DE007D4F2B /* UIFont+Ownglyph.swift in Sources */,
A8A32C572CDBBB500078B4F6 /* CustomAlbumCollectionViewCell.swift in Sources */,
0E5C14842CDF47FF005406B3 /* MHNavigationBar.swift in Sources */,
A8A32C532CDBB9980078B4F6 /* CustomAlbumViewController.swift in Sources */,
A840E5932CDE266F002A1C94 /* UICollectionViewCell+Identifier.swift in Sources */,
0E7F291B2CDB530E007D4F2B /* UILabel+Style.swift in Sources */,
0E5C147D2CDF47B2005406B3 /* HomeViewController.swift in Sources */,
0E5C13C62CDE8D1D005406B3 /* UIView+Anchor.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"colors" : [
{
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0xF3",
"green" : "0xFC",
"red" : "0xFE"
}
},
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"info" : {
"author" : "xcode",
"version" : 1
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"images" : [
{
"filename" : "Setting_line_light.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "[email protected]",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "[email protected]",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import UIKit

final class MHNavigationBar: UIView {
// MARK: - Property
private let titleLabel = UILabel(style: .header)
private let settingImageView = UIImageView(image: .settingLight)
Copy link
Collaborator

Choose a reason for hiding this comment

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

P1: 해당 ImageView는 설정 버튼을 나타내는 것으로 보입니다. 그렇다면 UIButton이 아닌 UIImageView여야할 이유가 있을까요??

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

인정합니다 !
수정해서 반영하겠습니다


// MARK: - Initializer
init(title: String) {
super.init(frame: .zero)

setup(with: title)
configureConstraints()
}

required init?(coder: NSCoder) {
super.init(coder: coder)

setup(with: "")
configureConstraints()
}

// MARK: - Setup & Configuration
func setup(with title: String) {
titleLabel.text = "\(title) 기록소"
backgroundColor = .baseBackground
addSubview(titleLabel)
addSubview(settingImageView)
Copy link
Collaborator

Choose a reason for hiding this comment

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

P2: 컨벤션 관련 내용인데 제 이전 PR의 경우 addSubView를 configureConstraints 함수에 위치시켰습니다.. 통일하면 더 좋지 않을까요??

추가로 저희가 초반에 정한 컨벤션에선 configureAddSubView라는 함수를 따로 분리하는 것으로 정하긴 했었는데 addSubView가 그렇게 많지 않은 상황에서 함수를 분리하는 것은 오히려 가독성을 해칠 것 같다는 생각으로 일단 전 configureConsratints에 위치시켰습니다...ᐟ.ᐟ (setup에 들어가는게 더 적절한 것 같기도 하네용..)

Copy link
Collaborator

Choose a reason for hiding this comment

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

저는 회의록에 기록된 컨벤션처럼 configureAddSubView에 subview함수를 넣는 것도 좋아보입니다!

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

저도 영현님 코드보면서 저 부분 고민되더라구요,
윤철님 의견대로 기존에 컨벤션 정한 대로 처리하겠습니다 !!

}

func configureConstraints() {
titleLabel.setTop(anchor: topAnchor)
titleLabel.setLeading(anchor: leadingAnchor)
titleLabel.setBottom(anchor: bottomAnchor)
titleLabel.setCenterY(view: settingImageView)

settingImageView.setTop(anchor: topAnchor)
settingImageView.setTrailing(anchor: trailingAnchor)
settingImageView.setCenterY(view: self)
settingImageView.setWidth(30)
settingImageView.setHeight(30)
Copy link
Collaborator

Choose a reason for hiding this comment

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

P3: 현재 코드의 경우 navigationBar 뷰의 양 끝에 딱 붙게 titleLabel과 settingView를 위치시키고 있는데, navigationBar가 view(네비바가 들어가는 view)와 width가 같다고 가정하고 padding을 여기서 넣어주는 방식에 대해선 어떻게 생각하시나요??

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -39,22 +39,22 @@ extension UIView {
}
}

func setTop(anchor: NSLayoutYAxisAnchor, constant: CGFloat) {
func setTop(anchor: NSLayoutYAxisAnchor, constant: CGFloat = 0) {
self.translatesAutoresizingMaskIntoConstraints = false
self.topAnchor.constraint(equalTo: anchor, constant: constant).isActive = true
}

func setLeading(anchor: NSLayoutXAxisAnchor, constant: CGFloat) {
func setLeading(anchor: NSLayoutXAxisAnchor, constant: CGFloat = 0) {
self.translatesAutoresizingMaskIntoConstraints = false
self.leadingAnchor.constraint(equalTo: anchor, constant: constant).isActive = true
}

func setBottom(anchor: NSLayoutYAxisAnchor, constant: CGFloat) {
func setBottom(anchor: NSLayoutYAxisAnchor, constant: CGFloat = 0) {
self.translatesAutoresizingMaskIntoConstraints = false
self.bottomAnchor.constraint(equalTo: anchor, constant: -constant).isActive = true
}

func setTrailing(anchor: NSLayoutXAxisAnchor, constant: CGFloat) {
func setTrailing(anchor: NSLayoutXAxisAnchor, constant: CGFloat = 0) {
self.translatesAutoresizingMaskIntoConstraints = false
self.trailingAnchor.constraint(equalTo: anchor, constant: -constant).isActive = true
}
Expand All @@ -65,25 +65,25 @@ extension UIView {
self.centerYAnchor.constraint(equalTo: view.centerYAnchor, constant: offset.y).isActive = true
}

func setHorizontal(view: UIView, constant: CGFloat) {
func setHorizontal(view: UIView, constant: CGFloat = 0) {
self.translatesAutoresizingMaskIntoConstraints = false
self.setLeading(anchor: view.leadingAnchor, constant: constant)
self.setTrailing(anchor: view.trailingAnchor, constant: constant)
}

func setHorizontal(layoutGuide: UILayoutGuide, constant: CGFloat) {
func setHorizontal(layoutGuide: UILayoutGuide, constant: CGFloat = 0) {
self.translatesAutoresizingMaskIntoConstraints = false
self.setLeading(anchor: layoutGuide.leadingAnchor, constant: constant)
self.setTrailing(anchor: layoutGuide.trailingAnchor, constant: constant)
}

func setVertical(view: UIView, constant: CGFloat) {
func setVertical(view: UIView, constant: CGFloat = 0) {
self.translatesAutoresizingMaskIntoConstraints = false
self.setTop(anchor: view.topAnchor, constant: constant)
self.setBottom(anchor: view.bottomAnchor, constant: constant)
}

func setVertical(layoutGuide: UILayoutGuide, constant: CGFloat) {
func setVertical(layoutGuide: UILayoutGuide, constant: CGFloat = 0) {
self.translatesAutoresizingMaskIntoConstraints = false
self.setTop(anchor: layoutGuide.topAnchor, constant: constant)
self.setBottom(anchor: layoutGuide.bottomAnchor, constant: constant)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import UIKit

public final class HomeViewController: UIViewController {
// MARK: - Property
private let navigationBar = MHNavigationBar(title: "효준")
Copy link
Collaborator

Choose a reason for hiding this comment

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

P2: 추후 바뀌어야할 임시적인 String 값이니 TODO를 추가해주면 좋을 것 같습니다 .ᐟ.ᐟ

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

좋습니다 !


// MARK: - Initializer
public init() {
super.init(nibName: nil, bundle: nil)
}

required init?(coder: NSCoder) {
super.init(coder: coder)
}

// MARK: - View LifeCycle
override public func viewDidLoad() {
super.viewDidLoad()

setup()
configureConstraints()
}

private func setup() {
view.backgroundColor = .baseBackground
view.addSubview(navigationBar)
Copy link
Collaborator

Choose a reason for hiding this comment

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

P3
addSubview 관련해서 수정하실 예정이라면 여기도 수정하시면 좋을 것 같아요!

}

private func configureConstraints() {
navigationBar.setTop(anchor: view.safeAreaLayoutGuide.topAnchor, constant: 20)
navigationBar.setLeading(anchor: view.leadingAnchor, constant: 24)
navigationBar.setTrailing(anchor: view.trailingAnchor, constant: 24)
Comment on lines +35 to +37
Copy link
Collaborator

Choose a reason for hiding this comment

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

P1: 저희 컨벤션에 따라 magic number는 상단에 constant로 만들어주시면 좋을 것 같습니다 .ᐟ.ᐟ

Copy link
Collaborator

Choose a reason for hiding this comment

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

P1: 저희 컨벤션에 따라 magic number는 상단에 constant로 만들어주시면 좋을 것 같습니다 .ᐟ.ᐟ

앗, magic number는 의미상 알아보기 힘들거나 재사용시 변수처리하는 것아니었나요?

Copy link
Collaborator

Choose a reason for hiding this comment

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

P1: 저희 컨벤션에 따라 magic number는 상단에 constant로 만들어주시면 좋을 것 같습니다 .ᐟ.ᐟ

앗, magic number는 의미상 알아보기 힘들거나 재사용시 변수처리하는 것아니었나요?

엇 다시 확인해보니 그런 것 같네요 ...ᐟ.ᐟ 제가 잘못알고 있었던 것 같습니다 .. 혼동을 드려 죄송합니다 .ᐟ.ᐟ

}
}
Loading