Skip to content

Commit 444c20f

Browse files
authored
Merge pull request #186 from EAT-SSU/feat/#185
[#185] 15+์˜ ๋ชจ๋‹ฌ Sheet UI ์ž‘์—… ์™„๋ฃŒ
2 parents b5e1a5a + 1b7e47b commit 444c20f

File tree

6 files changed

+176
-59
lines changed

6 files changed

+176
-59
lines changed

โ€ŽEATSSU_MVC/EATSSU_MVC/Sources/Presentation/Auth/View/LoginView.swift

-37
Original file line numberDiff line numberDiff line change
@@ -72,40 +72,3 @@ final class LoginView: BaseUIView {
7272
}
7373
}
7474
}
75-
76-
/*
77-
@objc
78-
private func rightBarButtonTapped() {
79-
if RealmService.shared.isAccessTokenPresent() {
80-
let nextVC = MyPageViewController()
81-
self.navigationController?.pushViewController(nextVC, animated: true)
82-
} else {
83-
// showAlertControllerWithCancel(title: "๋กœ๊ทธ์ธ์ด ํ•„์š”ํ•œ ์„œ๋น„์Šค์ž…๋‹ˆ๋‹ค", message: "๋กœ๊ทธ์ธ ํ•˜์‹œ๊ฒ ์Šต๋‹ˆ๊นŒ?", confirmStyle: .default) {
84-
// self.changeIntoLoginViewController()
85-
// }
86-
87-
let modalVC = LoginPromptViewController()
88-
modalVC.modalPresentationStyle = .pageSheet
89-
90-
// Check if UISheetPresentationController is available (iOS 15+)
91-
if let sheet = modalVC.sheetPresentationController {
92-
let small = UISheetPresentationController.Detent.Identifier("small")
93-
// let smallDetent = UISheetPresentationController.Detent.custom(identifier: smallId) { context in
94-
// return 270
95-
// }
96-
// sheet.detents = [smallDetent]
97-
sheet.detents = [
98-
.custom(identifier: small) { context in
99-
0.3 * context.maximumDetentValue
100-
}
101-
]
102-
103-
// sheet.prefersGrabberVisible = true
104-
sheet.prefersScrollingExpandsWhenScrolledToEdge = false
105-
sheet.preferredCornerRadius = 30
106-
}
107-
present(modalVC, animated: true, completion: nil)
108-
109-
}
110-
}
111-
*/
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
//
2+
// ios15LoginPromptView.swift
3+
// EATSSU
4+
//
5+
// Created by ์ตœ์ง€์šฐ on 11/28/24.
6+
//
7+
8+
import UIKit
9+
10+
final class ios15LoginPromptView: BaseUIView {
11+
12+
// MARK: - UI Components
13+
14+
private let loginAlertLabel = UILabel()
15+
private let appleLoginButton = UIButton()
16+
private let kakaoLoginButton = UIButton()
17+
private let logoImage = UIImageView()
18+
private let logoSubTitleImage = UIImageView()
19+
private let logoStackView = UIStackView()
20+
private let buttonStackView = UIStackView()
21+
private let loginPromptStackView = UIStackView()
22+
23+
24+
// MARK: - Intializer
25+
26+
override init(frame: CGRect) {
27+
super.init(frame: frame)
28+
29+
setViewProperties()
30+
}
31+
32+
// MARK: - Functions
33+
34+
private func setViewProperties() {
35+
loginAlertLabel.do {
36+
$0.text = TextLiteral.SignIn.loginPrompt
37+
$0.textAlignment = .left
38+
$0.numberOfLines = 0
39+
$0.font = EATSSUFontFamily.Pretendard.bold.font(size: 18)
40+
$0.setContentHuggingPriority(.defaultHigh, for: .vertical)
41+
}
42+
43+
appleLoginButton.do {
44+
$0.setImage(EATSSUAsset.Images.Version2.appleLoginButton.image, for: .normal)
45+
}
46+
47+
kakaoLoginButton.do {
48+
$0.setImage(EATSSUAsset.Images.Version2.kakaoLoginButton.image, for: .normal)
49+
}
50+
51+
logoImage.do {
52+
$0.image = EATSSUAsset.Images.Version2.authLogo.image
53+
}
54+
55+
logoSubTitleImage.do {
56+
$0.image = EATSSUAsset.Images.Version2.authSubTitle.image
57+
}
58+
59+
buttonStackView.do {
60+
$0.spacing = 8
61+
}
62+
63+
logoStackView.do {
64+
$0.alignment = .center
65+
}
66+
67+
loginPromptStackView.do {
68+
$0.distribution = .equalSpacing
69+
}
70+
71+
[buttonStackView,logoStackView,loginPromptStackView].forEach {
72+
$0.axis = .vertical
73+
}
74+
}
75+
76+
override func configureUI() {
77+
addSubview(loginPromptStackView)
78+
79+
logoStackView.addArrangedSubviews([logoImage,
80+
logoSubTitleImage])
81+
buttonStackView.addArrangedSubviews([appleLoginButton,
82+
kakaoLoginButton])
83+
loginPromptStackView.addArrangedSubviews([loginAlertLabel,
84+
logoStackView,
85+
buttonStackView])
86+
87+
// loginPromptStackView.backgroundColor = .yellow
88+
// logoStackView.backgroundColor = .gray
89+
// buttonStackView.backgroundColor = .green
90+
// logoImage.backgroundColor = .blue
91+
// logoSubTitleImage.backgroundColor = .red
92+
93+
}
94+
95+
override func setLayout() {
96+
loginAlertLabel.snp.makeConstraints {
97+
$0.top.equalToSuperview()
98+
}
99+
100+
logoImage.snp.makeConstraints {
101+
$0.horizontalEdges.equalToSuperview().inset(100)
102+
$0.height.equalTo(46)
103+
}
104+
105+
logoSubTitleImage.snp.makeConstraints {
106+
$0.width.equalTo(70)
107+
$0.height.equalTo(10)
108+
}
109+
110+
loginPromptStackView.snp.makeConstraints {
111+
$0.horizontalEdges.equalToSuperview().inset(30)
112+
$0.height.equalToSuperview().multipliedBy(0.75)
113+
$0.bottom.equalToSuperview().multipliedBy(0.85)
114+
}
115+
}
116+
}
117+
+8-7
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
//
2-
// LoginPromptViewController.swift
2+
// ios16LoginPromptView.swift
33
// EATSSU
44
//
5-
// Created by ์ตœ์ง€์šฐ on 11/26/24.
5+
// Created by ์ตœ์ง€์šฐ on 11/28/24.
66
//
77

88
import UIKit
99

10-
final class LoginPromptViewController: BaseViewController {
10+
final class ios16LoginPromptView: BaseUIView {
1111

1212
// MARK: - UI Components
1313

@@ -18,10 +18,10 @@ final class LoginPromptViewController: BaseViewController {
1818
private let loginPromptStackView = UIStackView()
1919
private let buttonView = UIView()
2020

21-
// MARK: - Life Cycles
21+
// MARK: - Intializer
2222

23-
override func viewDidLoad() {
24-
super.viewDidLoad()
23+
override init(frame: CGRect) {
24+
super.init(frame: frame)
2525

2626
setViewProperties()
2727
}
@@ -56,7 +56,7 @@ final class LoginPromptViewController: BaseViewController {
5656
}
5757

5858
override func configureUI() {
59-
view.addSubview(loginPromptStackView)
59+
addSubview(loginPromptStackView)
6060
buttonView.addSubview(buttonStackView)
6161

6262
buttonStackView.addArrangedSubviews([appleLoginButton,
@@ -81,3 +81,4 @@ final class LoginPromptViewController: BaseViewController {
8181
}
8282
}
8383
}
84+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
//
2+
// LoginPromptViewController.swift
3+
// EATSSU
4+
//
5+
// Created by ์ตœ์ง€์šฐ on 11/26/24.
6+
//
7+
8+
import UIKit
9+
10+
final class LoginPromptViewController: BaseViewController {
11+
12+
// MARK: - UI Components
13+
14+
private let loginPromptView = ios15LoginPromptView()
15+
16+
// MARK: - Functions
17+
18+
override func configureUI() {
19+
view.addSubview(loginPromptView)
20+
}
21+
22+
override func setLayout() {
23+
loginPromptView.snp.makeConstraints {
24+
$0.edges.equalToSuperview()
25+
}
26+
}
27+
}

โ€ŽEATSSU_MVC/EATSSU_MVC/Sources/Presentation/Home/ViewController/HomeViewController.swift

+22-13
Original file line numberDiff line numberDiff line change
@@ -112,20 +112,29 @@ final class HomeViewController: BaseViewController {
112112
loginPromptVC.modalPresentationStyle = .pageSheet
113113

114114
// Check if iOS 16+
115-
if #available(iOS 16.0, *) {
116-
if let sheet = loginPromptVC.sheetPresentationController {
117-
let small = UISheetPresentationController.Detent.Identifier("small")
118-
sheet.detents = [
119-
.custom(identifier: small) { context in
120-
0.34 * context.maximumDetentValue
121-
}
122-
]
123-
124-
sheet.prefersScrollingExpandsWhenScrolledToEdge = false
125-
sheet.preferredCornerRadius = 30
126-
}
127-
present(loginPromptVC, animated: true, completion: nil)
115+
// if #available(iOS 16.0, *) {
116+
// if let sheet = loginPromptVC.sheetPresentationController {
117+
// let small = UISheetPresentationController.Detent.Identifier("small")
118+
// sheet.detents = [
119+
// .custom(identifier: small) { context in
120+
// 0.34 * context.maximumDetentValue
121+
// }
122+
// ]
123+
//
124+
// sheet.prefersScrollingExpandsWhenScrolledToEdge = false
125+
// sheet.preferredCornerRadius = 30
126+
// }
127+
// present(loginPromptVC, animated: true, completion: nil)
128+
// }
129+
130+
if let sheet = loginPromptVC.sheetPresentationController {
131+
sheet.detents = [.medium()]
132+
133+
sheet.prefersScrollingExpandsWhenScrolledToEdge = false
134+
sheet.preferredCornerRadius = 30
128135
}
136+
present(loginPromptVC, animated: true, completion: nil)
137+
129138

130139
// showAlertControllerWithCancel(title: "๋กœ๊ทธ์ธ์ด ํ•„์š”ํ•œ ์„œ๋น„์Šค์ž…๋‹ˆ๋‹ค", message: "๋กœ๊ทธ์ธ ํ•˜์‹œ๊ฒ ์Šต๋‹ˆ๊นŒ?", confirmStyle: .default) {
131140
// self.changeIntoLoginViewController()

โ€ŽEATSSU_MVC/EATSSU_MVC/Sources/Utility/Literal/TextLiteral.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ enum TextLiteral {
3838

3939
enum SignIn {
4040

41-
/// 3์ดˆ๋งŒ์— ๋กœ๊ทธ์ธํ•˜๊ณ  ๋ฆฌ๋ทฐ๋ฅผ ๋‹ฌ์•„๋ณด์„ธ์š”!
42-
static let loginPrompt: String = "3์ดˆ๋งŒ์— ๋กœ๊ทธ์ธํ•˜๊ณ \n๋ฆฌ๋ทฐ๋ฅผ ๋‹ฌ์•„๋ณด์„ธ์š”!"
41+
/// ๋กœ๊ทธ์ธ์ด ํ•„์š”ํ•œ ์„œ๋น„์Šค์˜ˆ์š”. 3์ดˆ๋งŒ์— ๋กœ๊ทธ์ธํ•˜๊ณ  ๊ธฐ๋Šฅ์„ ์‚ฌ์šฉํ•ด๋ณด์„ธ์š”!
42+
static let loginPrompt: String = "๋กœ๊ทธ์ธ์ด ํ•„์š”ํ•œ ์„œ๋น„์Šค์˜ˆ์š”\n3์ดˆ๋งŒ์— ๋กœ๊ทธ์ธํ•˜๊ณ  ๊ธฐ๋Šฅ์„ ์‚ฌ์šฉํ•ด๋ณด์„ธ์š”!"
4343
}
4444

4545
static let signInWithApple: String = "Apple๋กœ ๋กœ๊ทธ์ธ"

0 commit comments

Comments
ย (0)