Skip to content

Commit

Permalink
♻️ 문자열 변수 분리
Browse files Browse the repository at this point in the history
  • Loading branch information
isGeekCode committed Jan 28, 2024
1 parent f95c717 commit 23ff307
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 13 deletions.
9 changes: 0 additions & 9 deletions PyeonHaeng-iOS/Resources/Localizable.xcstrings
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,6 @@
"strings" : {
"" : {

},
"건너뛰기" : {

},
"다음" : {

},
"편행 시작하기" : {

}
},
"version" : "1.0"
Expand Down
22 changes: 18 additions & 4 deletions PyeonHaeng-iOS/Sources/Scenes/OnboardingScene/OnboardingView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,20 @@ private enum OnboardingPage: Int, CaseIterable {
struct OnboardingView: View {
@State private var currentPage = 0

private var currentTitle: String {
OnboardingPage(rawValue: currentPage)?.title ?? ""
}

private var currentBody: String {
OnboardingPage(rawValue: currentPage)?.body ?? ""
}

private var nextBtnText: String {
currentPage < OnboardingPage.allCases.count - 1 ? "다음" : "편행 시작하기"
}

private var skipBtnText: String = "건너뛰기"

var body: some View {
NavigationStack {
VStack {
Expand All @@ -71,12 +85,12 @@ struct OnboardingView: View {
.padding(.vertical)

// 본문 제목
Text(OnboardingPage(rawValue: currentPage)?.title ?? "")
Text(currentTitle)
.font(.h2)
Spacer().frame(height: 16)

// 본문 내용
Text(OnboardingPage(rawValue: currentPage)?.body ?? "")
Text(currentBody)
.font(.body2)
.foregroundStyle(Color.gray500)
.multilineTextAlignment(.center)
Expand All @@ -89,7 +103,7 @@ struct OnboardingView: View {
currentPage += 1
}
}) {
Text(currentPage < OnboardingPage.allCases.count - 1 ? "다음" : "편행 시작하기")
Text(nextBtnText)
.foregroundColor(.white)
.frame(maxWidth: .infinity)
.padding()
Expand All @@ -102,7 +116,7 @@ struct OnboardingView: View {
.navigationTitle("")
.toolbar {
ToolbarItem(placement: .navigationBarTrailing) {
Button("건너뛰기") {
Button(skipBtnText) {
// 건너뛰기 버튼 액션
}
.foregroundStyle(Color.green500)
Expand Down

0 comments on commit 23ff307

Please sign in to comment.