-
Notifications
You must be signed in to change notification settings - Fork 0
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
[#84] SettingView 내 ListView 분리 및 추가 리팩터링 #89
Open
CJiu01
wants to merge
12
commits into
develop
Choose a base branch
from
refactor/#84
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+164
−160
Open
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
46a29d4
[#84] navigation 관련 주석코드 제거
CJiu01 2d55349
[#84] 로그아웃/알림권한설정 완료시 YDSToast 띄움
CJiu01 5073dfd
[#84] 혼선방지를 위해 Alert enum 케이스에 Tapped접미사 추가
CJiu01 5c5ad2a
[#84] 알림권한 거부 시 YDSToast 추가
CJiu01 5737557
[#84] ListRowView 분리 완료
CJiu01 5bae3ca
[#84] 버전정보 ListRowView 추가
CJiu01 ac3efb2
[#84] 터치영역 cell 전체로 수정
CJiu01 90e0ed7
[#84] Bundle로부터 앱버전 불러오는 로직 추가
CJiu01 e83f104
[#84] toggle .onChange 액션 추가
CJiu01 7a8df00
[#84] .onChange 클로저 매개변수 값 명시
CJiu01 9295f66
[#84] navigationStack 적용에 따른 navigationTitle 수정
CJiu01 130ab0b
[#84] divider 추가
CJiu01 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
92 changes: 92 additions & 0 deletions
92
Soomsil-USaint/Application/Feature/Setting/View/ListRowView.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,92 @@ | ||
// | ||
// ListRowView.swift | ||
// Soomsil-USaint | ||
// | ||
// Created by 최지우 on 2/5/25. | ||
// | ||
|
||
import SwiftUI | ||
|
||
import YDS_SwiftUI | ||
|
||
enum RightItem { | ||
case none | ||
case toggle(isPushAuthorizationEnabled: Binding<Bool>) | ||
} | ||
|
||
struct ListRowView: View { | ||
let title: String | ||
let items: [ItemModel] | ||
|
||
init(title: String, items: [ItemModel]) { | ||
self.title = title | ||
self.items = items | ||
} | ||
|
||
var body: some View { | ||
VStack(alignment: .leading, spacing: 0) { | ||
Text(title) | ||
.font(YDSFont.subtitle3) | ||
.foregroundColor(YDSColor.textSecondary) | ||
.padding(20) | ||
.frame(height: 48) | ||
|
||
Divider() | ||
.frame(height: 0.34) | ||
.background(YDSColor.borderThin) | ||
|
||
ForEach(items.indices, id: \.self) { index in | ||
HStack { | ||
items[index] | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
struct ItemModel: View { | ||
let text: String | ||
let rightItem: RightItem | ||
let action: () -> Void | ||
@State private var isPressed: Bool = false | ||
|
||
var body: some View { | ||
HStack { | ||
Text(text) | ||
.font(YDSFont.button3) | ||
.foregroundColor(YDSColor.textSecondary) | ||
.padding(20) | ||
.frame(height: 48) | ||
.frame(maxWidth: .infinity, alignment: .leading) | ||
.background(isPressed ? Color(red: 0.95, green: 0.96, blue: 0.97) : Color.white) | ||
.gesture( | ||
DragGesture(minimumDistance: 0) | ||
.onChanged { _ in isPressed = true } | ||
.onEnded { _ in | ||
isPressed = false | ||
switch rightItem { | ||
case .none: | ||
action() | ||
case .toggle(_): | ||
break | ||
} | ||
} | ||
) | ||
|
||
switch rightItem { | ||
case .none: | ||
EmptyView() | ||
case .toggle(let isPushAuthorizationEnabled): | ||
Toggle("", isOn: isPushAuthorizationEnabled) | ||
.labelsHidden() | ||
.padding(.horizontal, 20) | ||
.padding(.vertical, 20) | ||
.tint(YDSColor.buttonPoint) | ||
.frame(height: 48) | ||
.onChange(of: isPushAuthorizationEnabled.wrappedValue) { newValue in | ||
action() | ||
} | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
한 가지 걸리는 건
ItemModel
이란 네이밍이 적절할까 고민이긴 한데,, ItemModel하면 뭔가 View가 아닌 느낌이 더 들어서, Row나 RowView와 같은 이름이 더 적절할 것 같아요!