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

박스오피스 앱 [STEP 3] Jin #61

Open
wants to merge 22 commits into
base: d_Sam
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 13 commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
6dd7f22
feat: collection view 화면 배치
wlsdud-dev Mar 19, 2024
fe7cdf2
feat: collection view cell 화면 레이아웃 구현
wlsdud-dev Mar 20, 2024
67147c9
refactor: 박스오피스 개체 수정
wlsdud-dev Mar 20, 2024
6e8d689
refactor: 네트워크 수정
wlsdud-dev Mar 20, 2024
19f2139
feat: collection view 데이터 연결
wlsdud-dev Mar 20, 2024
9cda8d9
feat: 네비게이션바 타이틀 날짜 연결
wlsdud-dev Mar 20, 2024
26a0a51
feat: uilabel extension 텍스트 색상 변경 기능 구현
wlsdud-dev Mar 20, 2024
a622e0e
feat: string 익스텐션 숫자 세자리 , 추가 기능 구현
wlsdud-dev Mar 20, 2024
15e82f1
영화 랭크 변경 라벨 기능 추가
wlsdud-dev Mar 20, 2024
5709ee7
feat: 로딩 뷰 구현
wlsdud-dev Mar 20, 2024
ec8f920
feat: 로딩 뷰 구현
wlsdud-dev Mar 20, 2024
8429e7d
feat: 박스오피스컨트롤러 시작 로딩뷰 적용
wlsdud-dev Mar 20, 2024
d405c19
refactor: 코드 컨벤션 수정
wlsdud-dev Mar 20, 2024
37db680
refactor: 숫자 변환 string 익스텐션 수정
wlsdud-dev Mar 25, 2024
9d3620f
refacotor: UIlabel 익스텐션 주석 제거
wlsdud-dev Mar 25, 2024
827fe1a
refactor: 상속이 불필요한 클래스 final 키워드 추가
wlsdud-dev Mar 25, 2024
9d9af8a
refactor: BoxOfficeListCell 수정
wlsdud-dev Mar 25, 2024
be26a51
refactor: BoxOfficeListCell formatMovieLabel 메서드 수정
wlsdud-dev Mar 25, 2024
6b4e3bc
불필요한 주석 제거
wlsdud-dev Mar 25, 2024
0c52589
refactor: BoxOfficeController 로딩뷰 호출 방식 수정
wlsdud-dev Mar 25, 2024
c57f80e
refactor: 로딩뷰 수정
wlsdud-dev Mar 25, 2024
d9e129d
refactor: BoxiofficeViewController 데이터 요청 메서드 수정
wlsdud-dev Mar 26, 2024
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
70 changes: 53 additions & 17 deletions BoxOffice.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,22 @@
1D313A7C2B8498740088297F /* BoxOfficeMovieDTO.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1D313A7B2B8498740088297F /* BoxOfficeMovieDTO.swift */; };
1D313A7F2B8499840088297F /* NetworkManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1D313A7E2B8499840088297F /* NetworkManager.swift */; };
1D313A812B849ABF0088297F /* NetworkError.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1D313A802B849ABF0088297F /* NetworkError.swift */; };
1D7A8E072B89C76000ACCDC7 /* Date+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1D7A8E062B89C76000ACCDC7 /* Date+Extensions.swift */; };
1D7A8E072B89C76000ACCDC7 /* Date+.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1D7A8E062B89C76000ACCDC7 /* Date+.swift */; };
1DF9F8872B7C819700458068 /* box_office.json in Resources */ = {isa = PBXBuildFile; fileRef = 1DF9F8862B7C819700458068 /* box_office.json */; };
1DF9F88F2B7C81B000458068 /* BoxOfficeJsonDataTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1DF9F88E2B7C81B000458068 /* BoxOfficeJsonDataTests.swift */; };
63DF20EF2970E1A0005DF7D1 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 63DF20EE2970E1A0005DF7D1 /* AppDelegate.swift */; };
63DF20F12970E1A0005DF7D1 /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 63DF20F02970E1A0005DF7D1 /* SceneDelegate.swift */; };
63DF20F32970E1A0005DF7D1 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 63DF20F22970E1A0005DF7D1 /* ViewController.swift */; };
63DF20F32970E1A0005DF7D1 /* BoxOfficeViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 63DF20F22970E1A0005DF7D1 /* BoxOfficeViewController.swift */; };
63DF20F62970E1A0005DF7D1 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 63DF20F42970E1A0005DF7D1 /* Main.storyboard */; };
63DF20F82970E1A1005DF7D1 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 63DF20F72970E1A1005DF7D1 /* Assets.xcassets */; };
63DF20FB2970E1A1005DF7D1 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 63DF20F92970E1A1005DF7D1 /* LaunchScreen.storyboard */; };
F32E6F032B84861D0000A504 /* MovieInfoResponse.swift in Sources */ = {isa = PBXBuildFile; fileRef = F32E6F022B84861D0000A504 /* MovieInfoResponse.swift */; };
F39648222B7C6178002DCB96 /* BoxOfficeData.swift in Sources */ = {isa = PBXBuildFile; fileRef = F39648212B7C6178002DCB96 /* BoxOfficeData.swift */; };
F3446EB32BAA7873007A4430 /* BoxOfficeCollectionViewListCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = F3446EB22BAA7873007A4430 /* BoxOfficeCollectionViewListCell.swift */; };
F3446EB52BAA84C2007A4430 /* UIViewController+.swift in Sources */ = {isa = PBXBuildFile; fileRef = F3446EB42BAA84C2007A4430 /* UIViewController+.swift */; };
F3446EB72BAAC729007A4430 /* UILabel+.swift in Sources */ = {isa = PBXBuildFile; fileRef = F3446EB62BAAC729007A4430 /* UILabel+.swift */; };
F3446EB92BAACAE6007A4430 /* String+.swift in Sources */ = {isa = PBXBuildFile; fileRef = F3446EB82BAACAE6007A4430 /* String+.swift */; };
F3446EBD2BAACF06007A4430 /* LoadingView.swift in Sources */ = {isa = PBXBuildFile; fileRef = F3446EBC2BAACF06007A4430 /* LoadingView.swift */; };
F39648222B7C6178002DCB96 /* BoxOfficeDTO.swift in Sources */ = {isa = PBXBuildFile; fileRef = F39648212B7C6178002DCB96 /* BoxOfficeDTO.swift */; };
/* End PBXBuildFile section */

/* Begin PBXContainerItemProxy section */
Expand All @@ -39,20 +44,25 @@
1D313A7B2B8498740088297F /* BoxOfficeMovieDTO.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BoxOfficeMovieDTO.swift; sourceTree = "<group>"; };
1D313A7E2B8499840088297F /* NetworkManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NetworkManager.swift; sourceTree = "<group>"; };
1D313A802B849ABF0088297F /* NetworkError.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NetworkError.swift; sourceTree = "<group>"; };
1D7A8E062B89C76000ACCDC7 /* Date+Extensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Date+Extensions.swift"; sourceTree = "<group>"; };
1D7A8E062B89C76000ACCDC7 /* Date+.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Date+.swift"; sourceTree = "<group>"; };
1DF9F8862B7C819700458068 /* box_office.json */ = {isa = PBXFileReference; lastKnownFileType = text.json; path = box_office.json; sourceTree = "<group>"; };
1DF9F88C2B7C81B000458068 /* BoxOfficeTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = BoxOfficeTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
1DF9F88E2B7C81B000458068 /* BoxOfficeJsonDataTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BoxOfficeJsonDataTests.swift; sourceTree = "<group>"; };
63DF20EB2970E1A0005DF7D1 /* BoxOffice.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = BoxOffice.app; sourceTree = BUILT_PRODUCTS_DIR; };
63DF20EE2970E1A0005DF7D1 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
63DF20F02970E1A0005DF7D1 /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = "<group>"; };
63DF20F22970E1A0005DF7D1 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = "<group>"; };
63DF20F22970E1A0005DF7D1 /* BoxOfficeViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BoxOfficeViewController.swift; sourceTree = "<group>"; };
63DF20F52970E1A0005DF7D1 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
63DF20F72970E1A1005DF7D1 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
63DF20FA2970E1A1005DF7D1 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
63DF20FC2970E1A1005DF7D1 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
F32E6F022B84861D0000A504 /* MovieInfoResponse.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MovieInfoResponse.swift; sourceTree = "<group>"; };
F39648212B7C6178002DCB96 /* BoxOfficeData.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BoxOfficeData.swift; sourceTree = "<group>"; };
F3446EB22BAA7873007A4430 /* BoxOfficeCollectionViewListCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BoxOfficeCollectionViewListCell.swift; sourceTree = "<group>"; };
F3446EB42BAA84C2007A4430 /* UIViewController+.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIViewController+.swift"; sourceTree = "<group>"; };
F3446EB62BAAC729007A4430 /* UILabel+.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UILabel+.swift"; sourceTree = "<group>"; };
F3446EB82BAACAE6007A4430 /* String+.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "String+.swift"; sourceTree = "<group>"; };
F3446EBC2BAACF06007A4430 /* LoadingView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LoadingView.swift; sourceTree = "<group>"; };
F39648212B7C6178002DCB96 /* BoxOfficeDTO.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BoxOfficeDTO.swift; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
Expand Down Expand Up @@ -111,12 +121,12 @@
63DF20ED2970E1A0005DF7D1 /* BoxOffice */ = {
isa = PBXGroup;
children = (
1D7A8E062B89C76000ACCDC7 /* Date+Extensions.swift */,
1D313A7D2B8499640088297F /* Network */,
F396481E2B7C6138002DCB96 /* Model */,
63DF20EE2970E1A0005DF7D1 /* AppDelegate.swift */,
63DF20F02970E1A0005DF7D1 /* SceneDelegate.swift */,
63DF20F22970E1A0005DF7D1 /* ViewController.swift */,
F3446EBA2BAACE63007A4430 /* Extensions */,
1D313A7D2B8499640088297F /* Network */,
F396481E2B7C6138002DCB96 /* Model */,
F3446EBB2BAACEE3007A4430 /* Present */,
63DF20F42970E1A0005DF7D1 /* Main.storyboard */,
63DF20F72970E1A1005DF7D1 /* Assets.xcassets */,
63DF20F92970E1A1005DF7D1 /* LaunchScreen.storyboard */,
Expand All @@ -125,10 +135,31 @@
path = BoxOffice;
sourceTree = "<group>";
};
F3446EBA2BAACE63007A4430 /* Extensions */ = {
isa = PBXGroup;
children = (
F3446EB82BAACAE6007A4430 /* String+.swift */,
F3446EB62BAAC729007A4430 /* UILabel+.swift */,
1D7A8E062B89C76000ACCDC7 /* Date+.swift */,
F3446EB42BAA84C2007A4430 /* UIViewController+.swift */,
);
path = Extensions;
sourceTree = "<group>";
};
F3446EBB2BAACEE3007A4430 /* Present */ = {
isa = PBXGroup;
children = (
F3446EBC2BAACF06007A4430 /* LoadingView.swift */,
F3446EB22BAA7873007A4430 /* BoxOfficeCollectionViewListCell.swift */,
63DF20F22970E1A0005DF7D1 /* BoxOfficeViewController.swift */,
);
path = Present;
sourceTree = "<group>";
};
F396481E2B7C6138002DCB96 /* Model */ = {
isa = PBXGroup;
children = (
F39648212B7C6178002DCB96 /* BoxOfficeData.swift */,
F39648212B7C6178002DCB96 /* BoxOfficeDTO.swift */,
1D313A7B2B8498740088297F /* BoxOfficeMovieDTO.swift */,
F32E6F022B84861D0000A504 /* MovieInfoResponse.swift */,
1D313A792B8498200088297F /* MovieDetailDTO.swift */,
Expand Down Expand Up @@ -191,7 +222,7 @@
attributes = {
BuildIndependentTargetsInParallel = 1;
LastSwiftUpdateCheck = 1500;
LastUpgradeCheck = 1500;
LastUpgradeCheck = 1530;
TargetAttributes = {
1DF9F88B2B7C81B000458068 = {
CreatedOnToolsVersion = 15.0.1;
Expand Down Expand Up @@ -255,16 +286,21 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
63DF20F32970E1A0005DF7D1 /* ViewController.swift in Sources */,
63DF20F32970E1A0005DF7D1 /* BoxOfficeViewController.swift in Sources */,
1D313A7A2B8498200088297F /* MovieDetailDTO.swift in Sources */,
F3446EB52BAA84C2007A4430 /* UIViewController+.swift in Sources */,
F3446EB72BAAC729007A4430 /* UILabel+.swift in Sources */,
F3446EB32BAA7873007A4430 /* BoxOfficeCollectionViewListCell.swift in Sources */,
63DF20EF2970E1A0005DF7D1 /* AppDelegate.swift in Sources */,
1D7A8E072B89C76000ACCDC7 /* Date+Extensions.swift in Sources */,
1D7A8E072B89C76000ACCDC7 /* Date+.swift in Sources */,
63DF20F12970E1A0005DF7D1 /* SceneDelegate.swift in Sources */,
F3446EBD2BAACF06007A4430 /* LoadingView.swift in Sources */,
1D313A7F2B8499840088297F /* NetworkManager.swift in Sources */,
F32E6F032B84861D0000A504 /* MovieInfoResponse.swift in Sources */,
1D313A812B849ABF0088297F /* NetworkError.swift in Sources */,
1D313A7C2B8498740088297F /* BoxOfficeMovieDTO.swift in Sources */,
F39648222B7C6178002DCB96 /* BoxOfficeData.swift in Sources */,
F3446EB92BAACAE6007A4430 /* String+.swift in Sources */,
F39648222B7C6178002DCB96 /* BoxOfficeDTO.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -482,7 +518,7 @@
INFOPLIST_KEY_UIMainStoryboardFile = Main;
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
IPHONEOS_DEPLOYMENT_TARGET = 14.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
Expand Down Expand Up @@ -511,7 +547,7 @@
INFOPLIST_KEY_UIMainStoryboardFile = Main;
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
IPHONEOS_DEPLOYMENT_TARGET = 14.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
Expand Down
40 changes: 34 additions & 6 deletions BoxOffice/Base.lproj/Main.storyboard
Original file line number Diff line number Diff line change
@@ -1,24 +1,52 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="13122.16" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="BYZ-38-t0r">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="32700.99.1234" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="g4C-0s-Sww">
<device id="retina6_12" orientation="portrait" appearance="light"/>
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13104.12"/>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="22684"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="System colors in document resources" minToolsVersion="11.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
<!--View Controller-->
<!--Box Office View Controller-->
<scene sceneID="tne-QT-ifu">
<objects>
<viewController id="BYZ-38-t0r" customClass="ViewController" customModuleProvider="target" sceneMemberID="viewController">
<viewController id="BYZ-38-t0r" customClass="BoxOfficeViewController" customModule="BoxOffice" customModuleProvider="target" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="8bC-Xf-vdC">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<rect key="frame" x="0.0" y="0.0" width="393" height="852"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" xcode11CocoaTouchSystemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/>
<viewLayoutGuide key="safeArea" id="6Tk-OE-BBY"/>
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
</view>
<navigationItem key="navigationItem" id="hpq-z3-vqG"/>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="942.74809160305335" y="-34.507042253521128"/>
</scene>
<!--Navigation Controller-->
<scene sceneID="SIH-9C-ylN">
<objects>
<navigationController automaticallyAdjustsScrollViewInsets="NO" id="g4C-0s-Sww" sceneMemberID="viewController">
<toolbarItems/>
<navigationBar key="navigationBar" contentMode="scaleToFill" id="4ZQ-WP-c2h">
<rect key="frame" x="0.0" y="59" width="393" height="44"/>
<autoresizingMask key="autoresizingMask"/>
</navigationBar>
<nil name="viewControllers"/>
<connections>
<segue destination="BYZ-38-t0r" kind="relationship" relationship="rootViewController" id="Qgx-b8-odc"/>
</connections>
</navigationController>
<placeholder placeholderIdentifier="IBFirstResponder" id="zEL-Of-r7N" userLabel="First Responder" customClass="UIResponder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="16.030534351145036" y="-34.507042253521128"/>
</scene>
</scenes>
<resources>
<systemColor name="systemBackgroundColor">
<color white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</systemColor>
</resources>
</document>
File renamed without changes.
22 changes: 22 additions & 0 deletions BoxOffice/Extensions/String+.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
//
// String+.swift
// BoxOffice
//
// Created by Jin-Mac on 3/20/24.
//

import Foundation

extension String {

/// 숫자가 세 자리 이상 넘어가면 ,를 활용하는 메서드
func formatNumberString() -> String {

Choose a reason for hiding this comment

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

물론 주석이 필요한 경우도 있지만, 메서드명을 통해서 표현을 해보는건 어떨까요?

Copy link
Author

Choose a reason for hiding this comment

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

메서드 명을 변경해 수정했습니다.
아직은 익숙하지 않아서 그런지 모르겠지만 주석을 추가하는 것이 메서드의 기능을 이해하는데 더 명확하다고 생각하는데
알라딘 의견은 어떤지 궁금합니다.

Copy link

Choose a reason for hiding this comment

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

주석 없이 자체로 충분히 설명이 될만큼 읽기 좋은 코드를 추구하긴 합니다 개인적으로는!
하지만 필요에 따라서 충분히 주석이 필요한 경우도 있더라고요~

  • 테스트 코드 설명
  • TODO/ FIX-ME 주석
  • 코드만으로는 작성 의도가 파악이 도저히 안되는 코드에 대한 부연 설명..!

이정도일것 같아요~ 근데 충분히 메서드나 변수명으로 목적이 표현 가능한 코드에 대해서는 네이밍과 단일책임원칙으로 충분히 가독성을 높일 수 있다고 생각합니다!

let formatter = NumberFormatter()
formatter.numberStyle = .decimal
formatter.locale = Locale.current
if let number = Double(self) {
return formatter.string(from: NSNumber(value: number)) ?? self

Choose a reason for hiding this comment

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

여기도 옵셔널 처리를 하고있네요?? 17째줄에서 함께 언래핑 하는건 어떨까요?

Copy link
Author

Choose a reason for hiding this comment

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

같이 수정 했습니다.

}
return self
junbangg marked this conversation as resolved.
Show resolved Hide resolved
}
}
34 changes: 34 additions & 0 deletions BoxOffice/Extensions/UILabel+.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
//
// UILabel+.swift
// BoxOffice
//
// Created by Jin-Mac on 3/20/24.
//

import UIKit

extension UILabel {

/* 텍스트 구간 색상 변경 */
func setTextColor(_ color: UIColor, range: NSRange) {

Choose a reason for hiding this comment

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

setTextColor <- 이미 메서드명을 충분히 잘 지어주셔서, 주석은 없애도 되겠는데요?!👍👍

guard let attributedString = self.mutableAttributedString() else { return }

attributedString.addAttribute(NSAttributedString.Key.foregroundColor, value: color, range: range)
self.attributedText = attributedString
}

/* AttributedString이 설정되어있지 않으면 생성하여 반환한다. */
private func mutableAttributedString() -> NSMutableAttributedString? {

Choose a reason for hiding this comment

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

요 주석 또한 최대한 코드로 읽히게 하면 좋을것 같습니다~

Copy link
Author

Choose a reason for hiding this comment

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

주석은 제가 했지만, 메서드명을 어떤 식으로 바꿔야 적절한지 찾지 못했습니다.

guard let labelText = self.text, let labelFont = self.font else { return nil }

var attributedString: NSMutableAttributedString?
if let attributedText = self.attributedText {
attributedString = attributedText.mutableCopy() as? NSMutableAttributedString
} else {
attributedString = NSMutableAttributedString(string: labelText,
attributes: [NSAttributedString.Key.font :labelFont])
}

return attributedString
}
}
24 changes: 24 additions & 0 deletions BoxOffice/Extensions/UIViewController+.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
//
// UIViewController+.swift
// BoxOffice
//
// Created by Jin-Mac on 3/20/24.
//

import UIKit

extension UIViewController {

func presentAlert(title: String,
message: String? = nil,
junbangg marked this conversation as resolved.
Show resolved Hide resolved
confirmTitle: String = "확인",
confirmAction: ((UIAlertAction) -> Void)? = nil,
completion: (() -> Void)? = nil) {
let alertViewController = UIAlertController(title: title, message: message, preferredStyle: .alert)

let confirmAction = UIAlertAction(title: confirmTitle, style: .default)
alertViewController.addAction(confirmAction)

self.present(alertViewController, animated: true, completion: completion)
}
}
Loading