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

2주차 기본,도전,심화과제 PR #19

Merged
merged 6 commits into from
Apr 29, 2022
Merged
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
100 changes: 100 additions & 0 deletions assignment/assignment.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,19 @@
986168C72805B29600A8859F /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 986168C62805B29600A8859F /* ViewController.swift */; };
98967EF927FD5EB60031138C /* JoinNameViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 98967EF827FD5EB60031138C /* JoinNameViewController.swift */; };
98967EFB27FD5ECE0031138C /* JoinPasswordViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 98967EFA27FD5ECE0031138C /* JoinPasswordViewController.swift */; };
98A0CD8428097694009609C1 /* UILabel+.swift in Sources */ = {isa = PBXBuildFile; fileRef = 98A0CD8328097694009609C1 /* UILabel+.swift */; };
98BE769C2809D37C0067D688 /* UIViewController+.swift in Sources */ = {isa = PBXBuildFile; fileRef = 98BE769B2809D37C0067D688 /* UIViewController+.swift */; };
98FAA817280934B5000749D2 /* Home.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 98FAA816280934B5000749D2 /* Home.storyboard */; };
98FAA819280934C2000749D2 /* Search.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 98FAA818280934C2000749D2 /* Search.storyboard */; };
98FAA81B2809351D000749D2 /* Reels.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 98FAA81A2809351D000749D2 /* Reels.storyboard */; };
98FAA81D28093528000749D2 /* Shop.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 98FAA81C28093528000749D2 /* Shop.storyboard */; };
98FAA81F28093531000749D2 /* MyPage.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 98FAA81E28093531000749D2 /* MyPage.storyboard */; };
98FAA821280935F0000749D2 /* MainTabbarController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 98FAA820280935F0000749D2 /* MainTabbarController.swift */; };
98FAA82328093696000749D2 /* HomeViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 98FAA82228093696000749D2 /* HomeViewController.swift */; };
98FAA825280936B0000749D2 /* SearchViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 98FAA824280936B0000749D2 /* SearchViewController.swift */; };
98FAA827280936BF000749D2 /* ReelsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 98FAA826280936BF000749D2 /* ReelsViewController.swift */; };
98FAA829280936CC000749D2 /* ShopViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 98FAA828280936CC000749D2 /* ShopViewController.swift */; };
98FAA82B280936E5000749D2 /* MyPageViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 98FAA82A280936E5000749D2 /* MyPageViewController.swift */; };
/* End PBXBuildFile section */

/* Begin PBXFileReference section */
Expand All @@ -44,6 +57,19 @@
986168C62805B29600A8859F /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = "<group>"; };
98967EF827FD5EB60031138C /* JoinNameViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = JoinNameViewController.swift; sourceTree = "<group>"; };
98967EFA27FD5ECE0031138C /* JoinPasswordViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = JoinPasswordViewController.swift; sourceTree = "<group>"; };
98A0CD8328097694009609C1 /* UILabel+.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UILabel+.swift"; sourceTree = "<group>"; };
98BE769B2809D37C0067D688 /* UIViewController+.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIViewController+.swift"; sourceTree = "<group>"; };
98FAA816280934B5000749D2 /* Home.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = Home.storyboard; sourceTree = "<group>"; };
98FAA818280934C2000749D2 /* Search.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = Search.storyboard; sourceTree = "<group>"; };
98FAA81A2809351D000749D2 /* Reels.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = Reels.storyboard; sourceTree = "<group>"; };
98FAA81C28093528000749D2 /* Shop.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = Shop.storyboard; sourceTree = "<group>"; };
98FAA81E28093531000749D2 /* MyPage.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = MyPage.storyboard; sourceTree = "<group>"; };
98FAA820280935F0000749D2 /* MainTabbarController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MainTabbarController.swift; sourceTree = "<group>"; };
98FAA82228093696000749D2 /* HomeViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HomeViewController.swift; sourceTree = "<group>"; };
98FAA824280936B0000749D2 /* SearchViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SearchViewController.swift; sourceTree = "<group>"; };
98FAA826280936BF000749D2 /* ReelsViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ReelsViewController.swift; sourceTree = "<group>"; };
98FAA828280936CC000749D2 /* ShopViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ShopViewController.swift; sourceTree = "<group>"; };
98FAA82A280936E5000749D2 /* MyPageViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MyPageViewController.swift; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
Expand Down Expand Up @@ -73,7 +99,13 @@
980D11D127FD56700009F772 /* Login */,
980D11D627FD56890009F772 /* Join */,
980D11DB27FD57C90009F772 /* Complete */,
98FAA8112809347B000749D2 /* Home */,
98FAA8122809347F000749D2 /* Search */,
98FAA81328093483000749D2 /* Reels */,
98FAA81428093489000749D2 /* Shop */,
98FAA8152809348D000749D2 /* MyPage */,
985946AA27FA7E5C00F7610D /* Main.storyboard */,
98FAA820280935F0000749D2 /* MainTabbarController.swift */,
);
path = Scene;
sourceTree = "<group>";
Expand Down Expand Up @@ -138,6 +170,7 @@
980D11CA27FD55130009F772 /* Supports */,
986168BF2805B26800A8859F /* Resources */,
986168BE2805B25500A8859F /* Const */,
98A0CD8228097455009609C1 /* AppExtension */,
);
path = Configuration;
sourceTree = "<group>";
Expand All @@ -161,6 +194,60 @@
path = Resources;
sourceTree = "<group>";
};
98A0CD8228097455009609C1 /* AppExtension */ = {
isa = PBXGroup;
children = (
98A0CD8328097694009609C1 /* UILabel+.swift */,
98BE769B2809D37C0067D688 /* UIViewController+.swift */,
);
path = AppExtension;
sourceTree = "<group>";
};
98FAA8112809347B000749D2 /* Home */ = {
isa = PBXGroup;
children = (
98FAA816280934B5000749D2 /* Home.storyboard */,
98FAA82228093696000749D2 /* HomeViewController.swift */,
);
path = Home;
sourceTree = "<group>";
};
98FAA8122809347F000749D2 /* Search */ = {
isa = PBXGroup;
children = (
98FAA818280934C2000749D2 /* Search.storyboard */,
98FAA824280936B0000749D2 /* SearchViewController.swift */,
);
path = Search;
sourceTree = "<group>";
};
98FAA81328093483000749D2 /* Reels */ = {
isa = PBXGroup;
children = (
98FAA81A2809351D000749D2 /* Reels.storyboard */,
98FAA826280936BF000749D2 /* ReelsViewController.swift */,
);
path = Reels;
sourceTree = "<group>";
};
98FAA81428093489000749D2 /* Shop */ = {
isa = PBXGroup;
children = (
98FAA81C28093528000749D2 /* Shop.storyboard */,
98FAA828280936CC000749D2 /* ShopViewController.swift */,
);
path = Shop;
sourceTree = "<group>";
};
98FAA8152809348D000749D2 /* MyPage */ = {
isa = PBXGroup;
children = (
98FAA81E28093531000749D2 /* MyPage.storyboard */,
98FAA82A280936E5000749D2 /* MyPageViewController.swift */,
);
path = MyPage;
sourceTree = "<group>";
};
/* End PBXGroup section */

/* Begin PBXNativeTarget section */
Expand Down Expand Up @@ -219,11 +306,16 @@
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
98FAA81D28093528000749D2 /* Shop.storyboard in Resources */,
98FAA817280934B5000749D2 /* Home.storyboard in Resources */,
980D11D327FD56770009F772 /* Login.storyboard in Resources */,
980D11DD27FD57D30009F772 /* Complete.storyboard in Resources */,
985946B127FA7E5C00F7610D /* LaunchScreen.storyboard in Resources */,
985946AE27FA7E5C00F7610D /* Assets.xcassets in Resources */,
98FAA81F28093531000749D2 /* MyPage.storyboard in Resources */,
985946AC27FA7E5C00F7610D /* Main.storyboard in Resources */,
98FAA819280934C2000749D2 /* Search.storyboard in Resources */,
98FAA81B2809351D000749D2 /* Reels.storyboard in Resources */,
980D11D827FD56910009F772 /* Join.storyboard in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand All @@ -237,14 +329,22 @@
files = (
980D11D527FD567D0009F772 /* LoginViewController.swift in Sources */,
986168C32805B28A00A8859F /* Image.swift in Sources */,
98FAA829280936CC000749D2 /* ShopViewController.swift in Sources */,
98967EFB27FD5ECE0031138C /* JoinPasswordViewController.swift in Sources */,
986168C72805B29600A8859F /* ViewController.swift in Sources */,
98FAA827280936BF000749D2 /* ReelsViewController.swift in Sources */,
98A0CD8428097694009609C1 /* UILabel+.swift in Sources */,
985946A527FA7E5C00F7610D /* AppDelegate.swift in Sources */,
98FAA82B280936E5000749D2 /* MyPageViewController.swift in Sources */,
985946A727FA7E5C00F7610D /* SceneDelegate.swift in Sources */,
98FAA821280935F0000749D2 /* MainTabbarController.swift in Sources */,
986168C52805B29100A8859F /* Storyboard.swift in Sources */,
98FAA825280936B0000749D2 /* SearchViewController.swift in Sources */,
986168C12805B27D00A8859F /* Const.swift in Sources */,
98BE769C2809D37C0067D688 /* UIViewController+.swift in Sources */,
980D11DF27FD57DA0009F772 /* CompleteViewController.swift in Sources */,
98967EF927FD5EB60031138C /* JoinNameViewController.swift in Sources */,
98FAA82328093696000749D2 /* HomeViewController.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down
21 changes: 21 additions & 0 deletions assignment/assignment/Configuration/AppExtension/UILabel+.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
//
// UILabel+.swift
// assignment
//
// Created by 이경민 on 2022/04/15.
//

import UIKit

extension UILabel {
///Label의 일부만 색을 바꿀 수 있는 익스텐션
func setPartialLabelColor(targetStringList: [String], color: UIColor?) {
Comment on lines +11 to +12

Choose a reason for hiding this comment

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

이런 기능 필요할때가 종종있는데, extension으로 빼놓은거 좋네요

let fullText = text ?? ""
let attributedString = NSMutableAttributedString(string: fullText)
targetStringList.forEach {

Choose a reason for hiding this comment

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

targetStringList.forEach문이
fullText 중 targetString 원소에 해당하는 단어들만 속성을 바꿔주는 내용 맞나요?
제대로 이해했는지 궁금해요!!!

let range = (fullText as NSString).range(of: $0)
attributedString.addAttributes([.font: font as Any, .foregroundColor: color as Any], range: range)
}
attributedText = attributedString
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
//
// UIViewController+.swift
// assignment
//
// Created by 이경민 on 2022/04/16.
//

import UIKit

extension UIViewController {
func changeRootViewController(_ viewControllerToPresent: UIViewController) {
if let window = UIApplication.shared.windows.first {

Choose a reason for hiding this comment

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

UIApplication.shared.windows. 요거 iOS 15에서도 가능한가여 ?? (just 궁금)

Choose a reason for hiding this comment

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

저도 궁금합니다!!

window.rootViewController = viewControllerToPresent
UIView.transition(with: window, duration: 0.5, options: .transitionCrossDissolve, animations: nil)
} else {
viewControllerToPresent.modalPresentationStyle = .overFullScreen
self.present(viewControllerToPresent, animated: true, completion: nil)
}
}
}
12 changes: 11 additions & 1 deletion assignment/assignment/Configuration/Const/Storyboard.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ extension Const {

// MARK: - Tabbar

static let Tabbar = "Main"
static let Main = "Main"

// MARK: - Auth

Expand All @@ -22,12 +22,22 @@ extension Const {

// MARK: - Home

static let Home = "Home"

// MARK: - Search

static let Search = "Search"

// MARK: - Reels

static let Reels = "Reels"

// MARK: - Shop

static let Shop = "Shop"

// MARK: - MyPage

static let MyPage = "MyPage"
}
}
10 changes: 10 additions & 0 deletions assignment/assignment/Configuration/Const/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,23 @@ extension Const {

// MARK: - Home

static let HomeVC = "HomeViewController"

Choose a reason for hiding this comment

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

Const에 대해 설명해줄 수 있나요..😂
검색해보니깐 Constant, 상수를 정리할 때 사용하는 것 같은데,, 잘 모르겠어요,,
뷰 컨트롤러 구조체를 만드는데 주로 사용하는 걸까요??


// MARK: - Search

static let SearchVC = "SearchViewController"

// MARK: - Reels

static let ReelsVC = "ReelsViewController"

// MARK: - Shop

static let ShopVC = "ShopViewController"

// MARK: - MyPage

static let MyPageVC = "MyPageViewController"

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,8 @@
"info" : {
"author" : "xcode",
"version" : 1
},
"properties" : {
"template-rendering-intent" : "template"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,8 @@
"info" : {
"author" : "xcode",
"version" : 1
},
"properties" : {
"template-rendering-intent" : "template"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,8 @@
"info" : {
"author" : "xcode",
"version" : 1
},
"properties" : {
"template-rendering-intent" : "original"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,8 @@
"info" : {
"author" : "xcode",
"version" : 1
},
"properties" : {
"template-rendering-intent" : "original"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,8 @@
"info" : {
"author" : "xcode",
"version" : 1
},
"properties" : {
"template-rendering-intent" : "original"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,8 @@
"info" : {
"author" : "xcode",
"version" : 1
},
"properties" : {
"template-rendering-intent" : "original"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,8 @@
"info" : {
"author" : "xcode",
"version" : 1
},
"properties" : {
"template-rendering-intent" : "template"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,8 @@
"info" : {
"author" : "xcode",
"version" : 1
},
"properties" : {
"template-rendering-intent" : "template"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,8 @@
"info" : {
"author" : "xcode",
"version" : 1
},
"properties" : {
"template-rendering-intent" : "template"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,8 @@
"info" : {
"author" : "xcode",
"version" : 1
},
"properties" : {
"template-rendering-intent" : "template"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,8 @@
"info" : {
"author" : "xcode",
"version" : 1
},
"properties" : {
"template-rendering-intent" : "template"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,8 @@
"info" : {
"author" : "xcode",
"version" : 1
},
"properties" : {
"template-rendering-intent" : "template"
}
}
Loading