-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
328 additions
and
0 deletions.
There are no files selected for viewing
Empty file.
41 changes: 41 additions & 0 deletions
41
WithSuhyeon-iOS/WithSuhyeon-iOS/Presentation/SignUp/SignUpContent.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
// | ||
// SignUpContent.swift | ||
// WithSuhyeon-iOS | ||
// | ||
// Created by 김예지 on 1/15/25. | ||
// | ||
|
||
import SwiftUI | ||
|
||
struct SignUpContent: View { | ||
@Binding var selectedTab: SignUpContentCase | ||
init(selectedTab: Binding<SignUpContentCase>) { | ||
self._selectedTab = selectedTab | ||
UITabBar.appearance().isHidden = true | ||
} | ||
|
||
var body: some View { | ||
HStack(spacing: 0) { | ||
TabView(selection: $selectedTab) { | ||
TermsOfServiceView() | ||
.tag(SignUpContentCase.termsOfServiceView) | ||
PhoneAuthenticationView() | ||
.tag(SignUpContentCase.authenticationView) | ||
WriteNickNameView() | ||
.tag(SignUpContentCase.nickNameView) | ||
SelectBirthYearView() | ||
.tag(SignUpContentCase.birthYearView) | ||
SelectGenderView() | ||
.tag(SignUpContentCase.genderView) | ||
ProfileImageView() | ||
.tag(SignUpContentCase.profileImageView) | ||
ActiveAreaView() | ||
.tag(SignUpContentCase.activeAreaView) | ||
} | ||
.tabViewStyle(PageTabViewStyle()) | ||
.onAppear { | ||
UIScrollView.appearance().isScrollEnabled = false | ||
} | ||
} | ||
} | ||
} |
37 changes: 37 additions & 0 deletions
37
WithSuhyeon-iOS/WithSuhyeon-iOS/Presentation/SignUp/SignUpContentCase.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
// | ||
// SignUpContentCase.swift | ||
// WithSuhyeon-iOS | ||
// | ||
// Created by 김예지 on 1/15/25. | ||
// | ||
|
||
import Foundation | ||
|
||
public enum SignUpContentCase: CaseIterable { | ||
case termsOfServiceView | ||
case authenticationView | ||
case nickNameView | ||
case birthYearView | ||
case genderView | ||
case profileImageView | ||
case activeAreaView | ||
|
||
var title: String { | ||
switch self { | ||
case .termsOfServiceView: | ||
return "수현이랑\n서비스 이용약관" | ||
case .authenticationView: | ||
return "본인인증을 위한\n휴대폰 번호 인증이 필요해요" | ||
case .nickNameView: | ||
return "수현이랑에서 사용할\n닉네임을 입력해주세요" | ||
case .birthYearView: | ||
return "태어난 년도를\n선택해주세요" | ||
case .genderView: | ||
return "성별을\n선택해주세요" | ||
case .profileImageView: | ||
return "프로필 이미지를\n등록해주세요" | ||
case .activeAreaView: | ||
return "자주 활동하는\n지역을 선택해주세요" | ||
} | ||
} | ||
} |
86 changes: 86 additions & 0 deletions
86
WithSuhyeon-iOS/WithSuhyeon-iOS/Presentation/SignUp/SignUpFeature.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
// | ||
// SignUpFeature.swift | ||
// WithSuhyeon-iOS | ||
// | ||
// Created by 김예지 on 1/15/25. | ||
// | ||
|
||
import Foundation | ||
import Combine | ||
|
||
class SignUpFeature: Feature { | ||
struct State { | ||
var progress: Double = 0.0 | ||
var isAgree: Bool = false // 약관 동의 | ||
|
||
} | ||
|
||
enum Intent { | ||
case nextStep | ||
case previousStep | ||
} | ||
|
||
enum SideEffect { | ||
|
||
} | ||
|
||
@Published private(set) var state = State() | ||
@Published var currentContent: SignUpContentCase = .termsOfServiceView | ||
private var cancellables = Set<AnyCancellable>() | ||
private let intentSubject = PassthroughSubject<Intent, Never>() | ||
let sideEffectSubject = PassthroughSubject<SideEffect, Never>() | ||
|
||
init() { | ||
bindIntents() | ||
updateProgress() | ||
} | ||
|
||
private func bindIntents() { | ||
intentSubject.sink { [weak self] intent in | ||
self?.handleIntent(intent) | ||
}.store(in: &cancellables) | ||
} | ||
|
||
func send(_ intent: Intent) { | ||
intentSubject.send(intent) | ||
} | ||
|
||
func handleIntent(_ intent: Intent) { | ||
switch intent { | ||
case .nextStep: | ||
moveToNextStep() | ||
case .previousStep: | ||
moveToPreviousStep() | ||
} | ||
} | ||
|
||
private func moveToNextStep() { | ||
if let currentIndex = SignUpContentCase.allCases.firstIndex(of: currentContent), | ||
currentIndex < SignUpContentCase.allCases.count - 1 { | ||
print(currentIndex, "-" , currentContent) | ||
currentContent = SignUpContentCase.allCases[currentIndex + 1] | ||
updateProgress() | ||
} | ||
} | ||
|
||
private func moveToPreviousStep() { | ||
if let currentIndex = SignUpContentCase.allCases.firstIndex(of: currentContent), | ||
currentIndex > 0 { | ||
currentContent = SignUpContentCase.allCases[currentIndex - 1] | ||
updateProgress() | ||
} | ||
} | ||
|
||
private func updateProgress() { | ||
if let currentIndex = SignUpContentCase.allCases.firstIndex(of: currentContent) { | ||
state.progress = Double(currentIndex + 1) / Double(SignUpContentCase.allCases.count) * 100 | ||
} | ||
} | ||
|
||
|
||
func changeSelectedContent(signUpContentCase: SignUpContentCase) { | ||
currentContent = signUpContentCase | ||
} | ||
} | ||
|
||
|
37 changes: 37 additions & 0 deletions
37
WithSuhyeon-iOS/WithSuhyeon-iOS/Presentation/SignUp/SignUpView.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
// | ||
// SignUpView.swift | ||
// WithSuhyeon-iOS | ||
// | ||
// Created by 김예지 on 1/15/25. | ||
// | ||
|
||
import SwiftUI | ||
|
||
struct SignUpView: View { | ||
@EnvironmentObject private var router: RouterRegistry | ||
@StateObject private var signUpFeature = SignUpFeature() | ||
|
||
var body: some View { | ||
VStack(alignment: .leading) { | ||
WithSuhyeonTopNavigationBar(title: "", onTapLeft: {}) | ||
|
||
WithSuhyeonProgressBar(progress: signUpFeature.state.progress) | ||
|
||
Text(signUpFeature.currentContent.title) | ||
.font(.title02B) | ||
.padding(.leading, 16) | ||
.padding(.vertical, 20) | ||
|
||
SignUpContent(selectedTab: $signUpFeature.currentContent) | ||
|
||
WithSuhyeonButton(title: "버튼", buttonState: .disabled, onTapButton: { | ||
signUpFeature.send(.nextStep) | ||
}) | ||
.padding(.horizontal, 16) | ||
} | ||
} | ||
} | ||
|
||
#Preview { | ||
SignUpView() | ||
} |
18 changes: 18 additions & 0 deletions
18
WithSuhyeon-iOS/WithSuhyeon-iOS/Presentation/SignUp/View/ActiveAreaView.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// | ||
// ActiveAreaView.swift | ||
// WithSuhyeon-iOS | ||
// | ||
// Created by 김예지 on 1/15/25. | ||
// | ||
|
||
import SwiftUI | ||
|
||
struct ActiveAreaView: View { | ||
var body: some View { | ||
Text("활동 지역 선택") | ||
} | ||
} | ||
|
||
#Preview { | ||
ActiveAreaView() | ||
} |
18 changes: 18 additions & 0 deletions
18
WithSuhyeon-iOS/WithSuhyeon-iOS/Presentation/SignUp/View/PhoneAuthenticationView.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// | ||
// PhoneAuthenticationView.swift | ||
// WithSuhyeon-iOS | ||
// | ||
// Created by 김예지 on 1/15/25. | ||
// | ||
|
||
import SwiftUI | ||
|
||
struct PhoneAuthenticationView: View { | ||
var body: some View { | ||
Text("핸드폰 인증") | ||
} | ||
} | ||
|
||
#Preview { | ||
PhoneAuthenticationView() | ||
} |
18 changes: 18 additions & 0 deletions
18
WithSuhyeon-iOS/WithSuhyeon-iOS/Presentation/SignUp/View/ProfileImageView.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// | ||
// ProfileImageView.swift | ||
// WithSuhyeon-iOS | ||
// | ||
// Created by 김예지 on 1/15/25. | ||
// | ||
|
||
import SwiftUI | ||
|
||
struct ProfileImageView: View { | ||
var body: some View { | ||
Text("프로필 이미지 선택") | ||
} | ||
} | ||
|
||
#Preview { | ||
ProfileImageView() | ||
} |
18 changes: 18 additions & 0 deletions
18
WithSuhyeon-iOS/WithSuhyeon-iOS/Presentation/SignUp/View/SelectBirthYearView.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// | ||
// SelectBirthYearView.swift | ||
// WithSuhyeon-iOS | ||
// | ||
// Created by 김예지 on 1/15/25. | ||
// | ||
|
||
import SwiftUI | ||
|
||
struct SelectBirthYearView: View { | ||
var body: some View { | ||
Text("태어난 년도 선택") | ||
} | ||
} | ||
|
||
#Preview { | ||
SelectBirthYearView() | ||
} |
19 changes: 19 additions & 0 deletions
19
WithSuhyeon-iOS/WithSuhyeon-iOS/Presentation/SignUp/View/SelectGenderView.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// | ||
// SelectGenderView.swift | ||
// WithSuhyeon-iOS | ||
// | ||
// Created by 김예지 on 1/15/25. | ||
// | ||
|
||
import SwiftUI | ||
|
||
struct SelectGenderView: View { | ||
var body: some View { | ||
Text("성별 선택 뷰") | ||
.navigationBarBackButtonHidden(true) | ||
} | ||
} | ||
|
||
#Preview { | ||
SelectGenderView() | ||
} |
18 changes: 18 additions & 0 deletions
18
WithSuhyeon-iOS/WithSuhyeon-iOS/Presentation/SignUp/View/TermsOfServiceView.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// | ||
// TermsOfServiceView.swift | ||
// WithSuhyeon-iOS | ||
// | ||
// Created by 김예지 on 1/15/25. | ||
// | ||
|
||
import SwiftUI | ||
|
||
struct TermsOfServiceView: View { | ||
var body: some View { | ||
Text("이용약관") | ||
} | ||
} | ||
|
||
#Preview { | ||
TermsOfServiceView() | ||
} |
18 changes: 18 additions & 0 deletions
18
WithSuhyeon-iOS/WithSuhyeon-iOS/Presentation/SignUp/View/WriteNickNameView.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// | ||
// WriteNickNameView.swift | ||
// WithSuhyeon-iOS | ||
// | ||
// Created by 김예지 on 1/15/25. | ||
// | ||
|
||
import SwiftUI | ||
|
||
struct WriteNickNameView: View { | ||
var body: some View { | ||
Text("닉네임 입력") | ||
} | ||
} | ||
|
||
#Preview { | ||
WriteNickNameView() | ||
} |