Skip to content

Commit 4bf3500

Browse files
authored
[#144] 리팩토링
[#144] 리팩토링
2 parents 8261ed9 + 06e0275 commit 4bf3500

File tree

7 files changed

+147
-81
lines changed

7 files changed

+147
-81
lines changed

Deartoday/Deartoday/Global/Extension/UIFont+.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,4 +109,8 @@ extension UIFont {
109109
class var caption1: UIFont {
110110
return UIFont(name: "Pretendard-Regular", size: 12.0)!
111111
}
112+
113+
class var p8: UIFont {
114+
return UIFont(name: "Pretendard-SemiBold", size: 16.0)!
115+
}
112116
}
Lines changed: 41 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,56 @@
11
{
22
"images" : [
33
{
4-
"idiom" : "universal",
54
"filename" : "soundon.png",
5+
"idiom" : "universal",
6+
"resizing" : {
7+
"cap-insets" : {
8+
"left" : 30,
9+
"right" : 28
10+
},
11+
"center" : {
12+
"mode" : "tile",
13+
"width" : 1
14+
},
15+
"mode" : "3-part-horizontal"
16+
},
617
"scale" : "1x"
718
},
819
{
920
"filename" : "[email protected]",
10-
"scale" : "2x",
11-
"idiom" : "universal"
21+
"idiom" : "universal",
22+
"resizing" : {
23+
"cap-insets" : {
24+
"left" : 57,
25+
"right" : 57
26+
},
27+
"center" : {
28+
"mode" : "tile",
29+
"width" : 1
30+
},
31+
"mode" : "3-part-horizontal"
32+
},
33+
"scale" : "2x"
1234
},
1335
{
36+
"filename" : "[email protected]",
1437
"idiom" : "universal",
15-
"scale" : "3x",
16-
"filename" : "[email protected]"
38+
"resizing" : {
39+
"cap-insets" : {
40+
"left" : 89,
41+
"right" : 88
42+
},
43+
"center" : {
44+
"mode" : "tile",
45+
"width" : 1
46+
},
47+
"mode" : "3-part-horizontal"
48+
},
49+
"scale" : "3x"
1750
}
1851
],
1952
"info" : {
20-
"version" : 1,
21-
"author" : "xcode"
53+
"author" : "xcode",
54+
"version" : 1
2255
}
23-
}
56+
}

Deartoday/Deartoday/Screen/Initial/Controller/InitialViewContoller.swift

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import SnapKit
1212
import Then
1313

1414
final class InitialViewController: UIViewController {
15-
// MARK: - Property
1615

1716
// MARK: - UI Property
1817

@@ -25,7 +24,7 @@ final class InitialViewController: UIViewController {
2524
}
2625

2726
var appleLoginButton = UIButton().then {
28-
$0.setBackgroundImage(Constant.Image.btnApple, for: .normal)
27+
$0.setImage(Constant.Image.btnApple, for: .normal)
2928
$0.addTarget(self, action: #selector(appleSignInButtonDidTap), for: .touchUpInside)
3029
}
3130

@@ -51,18 +50,29 @@ final class InitialViewController: UIViewController {
5150

5251
// MARK: - Custom Method
5352

53+
private func presentMainView() {
54+
guard let mainViewController = UIStoryboard(name: Constant.Storyboard.Main, bundle: nil).instantiateViewController(withIdentifier: "MainNavigationController") as? MainNavigationController else { return }
55+
mainViewController.modalPresentationStyle = .fullScreen
56+
mainViewController.modalTransitionStyle = .crossDissolve
57+
present(mainViewController, animated: true)
58+
}
59+
5460
private func setLayout() {
55-
view.addSubviews([backgroundView, logoImageView, appleLoginButton])
61+
view.addSubviews([backgroundView,
62+
logoImageView,
63+
appleLoginButton])
5664

5765
backgroundView.snp.makeConstraints {
5866
$0.edges.equalToSuperview()
5967
}
68+
6069
logoImageView.snp.makeConstraints {
6170
$0.centerX.equalToSuperview()
62-
$0.top.equalToSuperview().inset(getDeviceHeight() == 667 ? 190 : 258)
71+
$0.centerY.equalToSuperview().multipliedBy(0.9)
6372
}
73+
6474
appleLoginButton.snp.makeConstraints {
65-
$0.leading.trailing.equalToSuperview().inset(16)
75+
$0.centerX.equalTo(logoImageView)
6676
$0.top.equalTo(logoImageView.snp.bottom).offset(10)
6777
}
6878
}
@@ -85,12 +95,9 @@ extension InitialViewController: ASAuthorizationControllerDelegate, ASAuthorizat
8595
guard let accessToken = appleLoginData?.data?.accessToken else { return }
8696
print("accessToken:\(accessToken)")
8797
// UserDefaults.standard.set("\(accessToken)", forKey: "hasToken")
98+
self.presentMainView()
8899
}
89100
}
90-
guard let mainViewController = UIStoryboard(name: Constant.Storyboard.Main, bundle: nil).instantiateViewController(withIdentifier: "MainNavigationController") as? MainNavigationController else { return }
91-
mainViewController.modalPresentationStyle = .fullScreen
92-
mainViewController.modalTransitionStyle = .crossDissolve
93-
present(mainViewController, animated: true)
94101
}
95102

96103
// Apple ID 연동 실패

Deartoday/Deartoday/Screen/Onboarding/Controller/OnboardingViewController.swift

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,13 @@ final class OnboardingViewController: UIViewController {
1818

1919
// MARK: - UI Property
2020

21-
@IBOutlet var labelCollection: [UILabel]!
2221
@IBOutlet weak var nextButton: UIButton!
2322
@IBOutlet weak var boxButton: UIButton!
2423
@IBOutlet weak var circleImageView: UIImageView!
25-
@IBOutlet weak var labelBottomConstraint: NSLayoutConstraint!
26-
@IBOutlet weak var circleButtonTopConstraint: NSLayoutConstraint!
27-
@IBOutlet weak var circleButtonLeadingConstraint: NSLayoutConstraint!
24+
@IBOutlet var labelCollection: [UILabel]!
2825
@IBOutlet var circleCollection: [UIView]!
26+
@IBOutlet weak var labelBottomConstraint: NSLayoutConstraint!
27+
@IBOutlet weak var boxButtonWidthConstraint: NSLayoutConstraint!
2928

3029
// MARK: - Life Cycle
3130

@@ -130,8 +129,7 @@ final class OnboardingViewController: UIViewController {
130129

131130
private func setLayout() {
132131
labelBottomConstraint.constant = (getDeviceHeight() == 667) ? 45 : 69
133-
circleButtonTopConstraint.constant = (getDeviceHeight() == 844) ? 188 : (getDeviceHeight() == 667) ? 135 : 176
134-
circleButtonLeadingConstraint.constant = (getDeviceHeight() == 844) ? 168 : 158
132+
boxButtonWidthConstraint.constant = getDeviceWidth() * (boxButtonWidthConstraint.constant / 375)
135133
}
136134

137135
// MARK: - IBAction

Deartoday/Deartoday/Screen/Onboarding/Controller/PlayTapeOnboardingViewController.swift

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ final class PlayTapeOnboardingViewController: UIViewController {
2525
@IBOutlet weak var circleImageView: UIImageView!
2626
@IBOutlet weak var tapeButton: UIButton!
2727
@IBOutlet var circleCollection: [UIView]!
28-
@IBOutlet weak var circleButtonTopConstraint: NSLayoutConstraint!
29-
@IBOutlet weak var circleButtonLeadingConstraint: NSLayoutConstraint!
28+
@IBOutlet weak var tapeButtonWidthConstraint: NSLayoutConstraint!
29+
3030

3131
var startPlayerButton = DDSButton().then {
3232
$0.text = "플레이어 작동하기"
@@ -130,8 +130,7 @@ final class PlayTapeOnboardingViewController: UIViewController {
130130
$0.leading.trailing.equalToSuperview().inset(6)
131131
$0.bottom.equalToSuperview().inset(36)
132132
}
133-
circleButtonTopConstraint.constant = ((getDeviceHeight() == 667) ? 140 : (getDeviceHeight() == 844) ? 195 : 185)
134-
circleButtonLeadingConstraint.constant = (getDeviceHeight() == 884) ? 168 : 158
133+
tapeButtonWidthConstraint.constant = getDeviceWidth() * (tapeButtonWidthConstraint.constant / 375)
135134
}
136135

137136
// MARK: - IBAction

0 commit comments

Comments
 (0)