-
Notifications
You must be signed in to change notification settings - Fork 1
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
๐ :: [#74] ์ฐธ๊ฐ์ ๊ด๋ฆฌ ํ์ด์ง ํผ๋ธ๋ฆฌ์ฑ #75
Conversation
Walkthrough์ด ํ ๋ฆฌํ์คํธ๋ ์ฑ์ ๋์์ธ ์์คํ
๊ณผ ์ฌ์ฉ์ ๊ด๋ฆฌ ๊ธฐ๋ฅ์ ๋ํ ์ฌ๋ฌ ๋ณ๊ฒฝ ์ฌํญ์ ํฌํจํ๊ณ ์์ต๋๋ค. ์๋ก์ด ์ด๋ฏธ์ง ์์
๊ณผ ํจ๊ป Changes
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? ๐ชง TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
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.
Actionable comments posted: 8
๐งน Nitpick comments (11)
Projects/App/Sources/DesignSystem/InfoList/SceneApplicationInfoListView.swift (2)
13-43
: ์ ๊ทผ์ฑ ๋ฐ ์ ์ง๋ณด์์ฑ ๊ฐ์ ์ด ํ์ํฉ๋๋ค๋ค์ ์ฌํญ๋ค์ ๊ฐ์ ํ๋ฉด ์ข์ ๊ฒ ๊ฐ์ต๋๋ค:
- ๊ณ ์ ๋ ๋๋น๊ฐ๊ณผ ๊ฐ๊ฒฉ์ ์ฌ์ฉํ๋ฉด ๋๋ฐ์ด์ค ํฌ๊ธฐ์ ๋ฐ๋ผ ๋ ์ด์์์ด ๊นจ์ง ์ ์์ต๋๋ค. ์๋์ ์ธ ํฌ๊ธฐ๋ GeometryReader ์ฌ์ฉ์ ๊ณ ๋ คํด๋ณด์ธ์.
- ํ๋์ฝ๋ฉ๋ ๋ฌธ์์ด์ ์ง์ญํ๋ฅผ ์ํด ๋ณ๋ ์์๋ก ๋ถ๋ฆฌํ๋ ๊ฒ์ด ์ข์ต๋๋ค.
- ๋ฐ๋ณต๋๋ Text ์คํ์ผ๋ง์ ์ํ modifier ํจ์๋ฅผ ๋ง๋ค๋ฉด ์ฝ๋ ์ค๋ณต์ ์ค์ผ ์ ์์ต๋๋ค.
์์ ๊ฐ์ ์:
// ๋ฌธ์์ด ์์ private enum Strings { static let name = "์ฑ๋ช " static let organization = "์์" static let position = "์ง๊ธ" static let contact = "์๋ด๋ฌธ์ ๋ฐ์ก์ฉ ์ฐ๋ฝ์ฒ" static let consent = "๊ฐ์ธ์ ๋ณด๋์์ ๊ณต ๋์" } // ๊ณตํต Text ์คํ์ผ modifier extension View { func columnHeaderStyle(width: CGFloat) -> some View { self .frame(width: width, alignment: .leading) .expoFont(.caption1B) .expoColor(ExpoColor.gray600) } }
11-45
: ์ฌ์ฌ์ฉ์ฑ ํฅ์์ ์ํ ์ ์ํ์ฌ ๋ทฐ๊ฐ ๊ณ ์ ๋ ํํ๋ก ๊ตฌํ๋์ด ์์ด ๋ค๋ฅธ ์ํฉ์์ ์ฌ์ฌ์ฉํ๊ธฐ ์ด๋ ค์ธ ์ ์์ต๋๋ค. ๋ฐ์ดํฐ ๋ชจ๋ธ๊ณผ ์ค์ ์ ์ฃผ์ ๋ฐ๋ ํํ๋ก ๋ณ๊ฒฝํ๋ฉด ์ข์ ๊ฒ ๊ฐ์ต๋๋ค.
์์:
struct ColumnConfig { let title: String let width: CGFloat } struct SceneApplicationInfoListView: View { let columns: [ColumnConfig] var body: some View { VStack(spacing: 16) { // ... ๊ธฐ์กด ์ฝ๋ ... HStack(spacing: 45) { ForEach(columns, id: \.title) { column in Text(column.title) .columnHeaderStyle(width: column.width) } Spacer() } // ... ๊ธฐ์กด ์ฝ๋ ... } } }Projects/App/Sources/DesignSystem/Program/SceneApplicationInfoListDetail.swift (2)
11-20
: ์์ฑ๋ค์ ์ ๊ทผ ์ ์ด์๋ฅผ ๋ช ์์ ์ผ๋ก ์ ์ธํด์ฃผ์ธ์.ํ์ฌ ๋ชจ๋ ์์ฑ๋ค์ด ์์์ internal ์ ๊ทผ ์์ค์ ๊ฐ์ง๊ณ ์์ต๋๋ค. ์ธ๋ถ์์ ์ ๊ทผํ ํ์๊ฐ ์๋ ์์ฑ๋ค์ private์ผ๋ก ์ ์ธํ๋ ๊ฒ์ด ์ข์ต๋๋ค.
public struct SceneApplicationInfoListDetail: View { - var programNum: Int - var userName: String - var affiliation: String - var position: String - var phoneNumber: String - var consentStatus: Bool - var action: () -> Void + private let programNum: Int + private let userName: String + private let affiliation: String + private let position: String + private let phoneNumber: String + private let consentStatus: Bool + private let action: () -> Void
80-82
: ํ๋ฆฌ๋ทฐ๋ฅผ ํ์ฌ ๋ทฐ์ ๋ง๊ฒ ์์ ํด์ฃผ์ธ์.UserManagementView ๋์ SceneApplicationInfoListDetail์ ํ๋ฆฌ๋ทฐ๋ฅผ ๋ณด์ฌ์ฃผ๋ ๊ฒ์ด ๋ ์ ์ ํฉ๋๋ค.
#Preview { - UserManagementView() + SceneApplicationInfoListDetail( + programNum: 1, + userName: "ํ๊ธธ๋", + affiliation: "ํ์ฌ", + position: "๊ฐ๋ฐ์", + phoneNumber: "01012345678", + consentStatus: true + ) }Projects/App/Sources/Feature/ProgramDetailFeature/Sources/ProgramDetailView.swift (1)
79-89
: ํ๋์ฝ๋ฉ๋ ๋ฐ์ดํฐ ๋์ ์ ๋ชจ๋ธ ์ฌ์ฉ ๊ถ์ฅ
ForEach
๋ด๋ถ์์ ํ๋์ฝ๋ฉ๋ ๋ฐ์ดํฐ๋ฅผ ์ฌ์ฉํ๊ณ ์์ต๋๋ค. ์ค์ ๋ฐ์ดํฐ ๋ชจ๋ธ์ ํ์ฉํ์ฌ ๋ทฐ์ ๋ฐ์ดํฐ๋ฅผ ๋ฐ์ธ๋ฉํ๋ฉด ์ ์ง๋ณด์์ฑ๊ณผ ํ์ฅ์ฑ์ด ํฅ์๋ฉ๋๋ค.Projects/App/Sources/DesignSystem/InfoList/InfoListView.swift (1)
18-39
: ํ๋์ฝ๋ฉ๋ ํ๋ ์ ํฌ๊ธฐ ๋์ ์ ์ฐํ ๋ ์ด์์ ์ฌ์ฉ ๊ถ์ฅ
Text
๋ทฐ์ ๊ณ ์ ๋width
์padding
๊ฐ์ ์ฌ์ฉํ๋ฉด ๋ค์ํ ๊ธฐ๊ธฐ ํ๋ฉด ํฌ๊ธฐ์์ ๋ ์ด์์ ๋ฌธ์ ๊ฐ ๋ฐ์ํ ์ ์์ต๋๋ค.Spacer()
๋GeometryReader
๋ฅผ ํ์ฉํ์ฌ ๋์ ์ธ ๋ ์ด์์์ ๊ตฌ์ฑํ๋ ๊ฒ์ด ์ข์ต๋๋ค.Projects/App/Sources/DesignSystem/Program/ExpoProgramDetail.swift (1)
51-74
: ํ๋์ฝ๋ฉ๋ ํ๋ ์ ํฌ๊ธฐ ๋์ ๋ฐ์ํ ๋ ์ด์์ ์ฌ์ฉ ๊ถ์ฅ
Text
๋ทฐ์ ๊ณ ์ ๋width
๋ฅผ ์ค์ ํ๋ฉด ํ๋ฉด ํฌ๊ธฐ์ ๋ฐ๋ผ ๋ ์ด์์์ด ๊นจ์ง ์ ์์ต๋๋ค.HStack
๋ด์์Spacer()
๋ฅผ ์ฌ์ฉํ๊ฑฐ๋LazyVGrid
๋ฑ์ ํ์ฉํ์ฌ ๋ค์ํ ํ๋ฉด ํฌ๊ธฐ์ ๋์ํ๋ ๋ฐ์ํ ๋ ์ด์์์ ๊ตฌํํ๋ ๊ฒ์ ๊ถ์ฅํฉ๋๋ค.Projects/App/Sources/Feature/UserManagementFeature/Sources/UserManagementView.swift (4)
1-10
: ๋ฌธ์ํ ๊ฐ์ ์ ์๋ทฐ์ ๋ชฉ์ ๊ณผ ์ฃผ์ ๊ธฐ๋ฅ์ ์ค๋ช ํ๋ ๋ฌธ์ ์ฃผ์์ ์ถ๊ฐํ๋ฉด ์ข๊ฒ ์ต๋๋ค.
๋ค์๊ณผ ๊ฐ์ด ๋ฌธ์ ์ฃผ์์ ์ถ๊ฐํด๋ณด์ธ์:
// // UserManagementView.swift // Expo-iOS // // Created by ์์ง์ on 1/5/25. // Copyright ยฉ 2025 SchoolofCompany. All rights reserved. // +/// `UserManagementView`๋ ์ด๋ฒคํธ ์ฐธ๊ฐ์ ๊ด๋ฆฌ๋ฅผ ์ํ ๋ทฐ์ ๋๋ค. +/// - ์ฌ์ ํ์ฌ ์ฐธ๊ฐ์, ํ์ฅ ์ ์ฒญ ์ฐธ๊ฐ์, ์ฌ์ ๊ต์ ์์ ์ฐธ๊ฐ์๋ฅผ ๊ตฌ๋ถํ์ฌ ๊ด๋ฆฌํ ์ ์์ต๋๋ค. +/// - ์ฐธ๊ฐ์ ๋ชฉ๋ก์ ํ์ธํ๊ณ ์์ธ ์ ๋ณด๋ฅผ ๋ณผ ์ ์์ต๋๋ค. + import SwiftUI
11-15
: ์ํ ๋ณ์ ์ด๋ฆ ๊ฐ์ ๋ฐ ๋ฌธ์ํ ์ ์์ํ ๋ณ์์ ์ด๋ฆ์ ๋ ๋ช ํํ๊ฒ ํ๊ณ , ๊ฐ ๋ณ์์ ์ฉ๋๋ฅผ ์ค๋ช ํ๋ ๋ฌธ์ ์ฃผ์์ ์ถ๊ฐํ๋ฉด ์ข๊ฒ ์ต๋๋ค.
๋ค์๊ณผ ๊ฐ์ด ๋ณ๊ฒฝํด๋ณด์ธ์:
struct UserManagementView: View { @Environment(\.dismiss) var dismiss - @State private var userInfoListName: String = "์ฌ์ ํ์ฌ" - @State private var userInfoListButtonAction: Bool = false + /// ์ ํ๋ ์ฐธ๊ฐ์ ๋ชฉ๋ก ์ ํ (์ฌ์ ํ์ฌ, ํ์ฅ ์ ์ฒญ, ์ฌ์ ๊ต์ ์์) + @State private var selectedParticipantType: String = "์ฌ์ ํ์ฌ" + /// ์ฐธ๊ฐ์ ์ ํ ์ ํ ์ํธ ํ์ ์ฌ๋ถ + @State private var isParticipantTypeSheetPresented: Bool = false
16-32
: ๋ค๋น๊ฒ์ด์ ๊ตฌํ ๊ฐ์ ์ ์ํ์ฌ
ZStack
์ ์ฌ์ฉํ ๋ค๋น๊ฒ์ด์ ๊ตฌํ๋ณด๋ค SwiftUI์ ๋ค๋น๊ฒ์ด์ ์ปดํฌ๋ํธ๋ฅผ ํ์ฉํ๋ฉด ๋ ์ข์ ๊ฒ ๊ฐ์ต๋๋ค.๋ค์๊ณผ ๊ฐ์ด
NavigationStack
์ ์ฌ์ฉํ์ฌ ๊ตฌํํด๋ณด์ธ์:- var body: some View { - ZStack { - HStack(spacing: 0) { - Button { - dismiss() - } label: { - ExpoIOSAsset.Assets.leftBackButton.swiftUIImage - .padding(.leading, 4) - } - - Spacer() - } - - Text("์ฐธ๊ฐ์ ๊ด๋ฆฌ") - .expoFont(.body1R) - } + var body: some View { + NavigationStack { + VStack { + // ๊ธฐ์กด ์ปจํ ์ธ + } + .navigationTitle("์ฐธ๊ฐ์ ๊ด๋ฆฌ") + .navigationBarTitleDisplayMode(.center) + .navigationBarBackButtonHidden(true) + .toolbar { + ToolbarItem(placement: .navigationBarLeading) { + Button { + dismiss() + } label: { + ExpoIOSAsset.Assets.leftBackButton.swiftUIImage + } + } + } + }
159-161
: ํ๋ฆฌ๋ทฐ ๊ตฌํ ๊ฐ์ ์ ์ํ๋ฆฌ๋ทฐ์ ์ํ ๋ฐ์ดํฐ์ ๋ค์ํ ์ํ๋ฅผ ์ถ๊ฐํ๋ฉด ๊ฐ๋ฐ ์ ๋ ์ ์ฉํ ๊ฒ ๊ฐ์ต๋๋ค.
๋ค์๊ณผ ๊ฐ์ด ํ๋ฆฌ๋ทฐ๋ฅผ ๊ฐ์ ํด๋ณด์ธ์:
#Preview { Group { UserManagementView(viewModel: ParticipantViewModel(participants: PreviewData.sampleParticipants)) .previewDisplayName("๊ธฐ๋ณธ ์ํ") UserManagementView(viewModel: ParticipantViewModel(participants: [])) .previewDisplayName("๋น ์ํ") } } enum PreviewData { static let sampleParticipants: [Participant] = [ // ์ํ ๋ฐ์ดํฐ ์ถ๊ฐ ] }
๐ Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
โ Files ignored due to path filters (2)
Projects/App/Resources/Assets.xcassets/blackBottomButton.imageset/blackBottomButton.svg
is excluded by!**/*.svg
Projects/App/Resources/Assets.xcassets/okIcon.imageset/okIcon.svg
is excluded by!**/*.svg
๐ Files selected for processing (9)
Projects/App/Resources/Assets.xcassets/blackBottomButton.imageset/Contents.json
(1 hunks)Projects/App/Resources/Assets.xcassets/okIcon.imageset/Contents.json
(1 hunks)Projects/App/Sources/DesignSystem/InfoList/InfoListView.swift
(1 hunks)Projects/App/Sources/DesignSystem/InfoList/SceneApplicationInfoListView.swift
(1 hunks)Projects/App/Sources/DesignSystem/Program/ExpoProgramDetail.swift
(5 hunks)Projects/App/Sources/DesignSystem/Program/SceneApplicationInfoListDetail.swift
(1 hunks)Projects/App/Sources/Feature/ProgramDetailFeature/Sources/ProgramDetailView.swift
(1 hunks)Projects/App/Sources/Feature/ProgramFeature/Sources/ProgramView.swift
(0 hunks)Projects/App/Sources/Feature/UserManagementFeature/Sources/UserManagementView.swift
(1 hunks)
๐ค Files with no reviewable changes (1)
- Projects/App/Sources/Feature/ProgramFeature/Sources/ProgramView.swift
โ Files skipped from review due to trivial changes (2)
- Projects/App/Resources/Assets.xcassets/okIcon.imageset/Contents.json
- Projects/App/Resources/Assets.xcassets/blackBottomButton.imageset/Contents.json
๐ Additional comments (3)
Projects/App/Sources/DesignSystem/Program/SceneApplicationInfoListDetail.swift (2)
1-10
: ํ์ผ ํค๋์ import ๋ฌธ์ด ์ ์ ํฉ๋๋ค.๊ธฐ๋ณธ์ ์ธ ํ์ผ ๊ตฌ์กฐ๊ฐ ์ ๊ฐ์ถฐ์ ธ ์์ต๋๋ค.
22-38
: ์ด๊ธฐํ ๊ตฌ๋ฌธ์ด ์ ๊ตฌํ๋์ด ์์ต๋๋ค.๋งค๊ฐ๋ณ์์ ๊ธฐ๋ณธ๊ฐ์ด ์ ์ ํ๊ฒ ์ค์ ๋์ด ์์ต๋๋ค.
Projects/App/Sources/DesignSystem/Program/ExpoProgramDetail.swift (1)
92-92
: Preview ๋ณ๊ฒฝ ์ฌํญ ํ์ธ ํ์
#Preview
์์ProgramDetailView()
๋์UserManagementView()
๋ฅผ ์ฌ์ฉํ๊ณ ์์ต๋๋ค. ์๋๋ ๋ณ๊ฒฝ ์ฌํญ์ธ์ง ํ์ธํด์ฃผ์ธ์.
#Preview { | ||
UserManagementView() | ||
} |
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.
๐ ๏ธ Refactor suggestion
ํ๋ฆฌ๋ทฐ ์์ ์ด ํ์ํฉ๋๋ค
ํ์ฌ ํ๋ฆฌ๋ทฐ๊ฐ UserManagementView()
๋ฅผ ํ์ํ๊ณ ์๋๋ฐ, ์ด๋ SceneApplicationInfoListView
์ ๋์์ ํ์ธํ๊ธฐ์ ์ ์ ํ์ง ์์ต๋๋ค. ์ปดํฌ๋ํธ๋ฅผ ์ง์ ํ๋ฆฌ๋ทฐํ๋๋ก ์์ ํด์ฃผ์ธ์.
#Preview {
- UserManagementView()
+ SceneApplicationInfoListView()
}
๐ Committable suggestion
โผ๏ธ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
#Preview { | |
UserManagementView() | |
} | |
#Preview { | |
SceneApplicationInfoListView() | |
} |
var userName: String | ||
var affiliation: String | ||
var position: String | ||
var phoneNumber: String |
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.
๐ ๏ธ Refactor suggestion
์ ํ๋ฒํธ ํ์ ๊ฒ์ฆ์ด ํ์ํฉ๋๋ค.
phoneNumber ์์ฑ์ ๋ํ ํ์ ๊ฒ์ฆ์ด ์์ต๋๋ค. ์ฌ๋ฐ๋ฅธ ์ ํ๋ฒํธ ํ์์ธ์ง ํ์ธํ๋ ๋ก์ง์ ์ถ๊ฐํ๋ ๊ฒ์ด ์ข์ต๋๋ค.
private func isValidPhoneNumber(_ number: String) -> Bool {
let pattern = "^01[0-1, 7][0-9]{7,8}$"
let predicate = NSPredicate(format: "SELF MATCHES %@", pattern)
return predicate.evaluate(with: number)
}
HStack(spacing: 0) { | ||
Text("\(programNum)") | ||
.expoFont(.caption1B) | ||
.padding(.leading, 8) | ||
.frame(width: 50, alignment: .leading) | ||
|
||
Text(userName) | ||
.frame(width: 70, alignment: .leading) | ||
|
||
Text(affiliation) | ||
.frame(width: 70, alignment: .leading) | ||
|
||
Text(position) | ||
.frame(width: 70, alignment: .leading) | ||
|
||
Text(phoneNumber) | ||
.frame(width: 170, alignment: .leading) | ||
|
||
Image(consentStatus ? "okIcon" : "ButtonX") | ||
.frame(width: 130, alignment: .center) | ||
} | ||
.padding(.bottom, 36) | ||
.expoFont(.caption2R) |
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.
๐ ๏ธ Refactor suggestion
๋ ์ด์์ ๊ฐ์ ์์๋ก ๋ถ๋ฆฌํ๊ณ ์ ๊ทผ์ฑ์ ๊ฐ์ ํด์ฃผ์ธ์.
- ํ๋์ฝ๋ฉ๋ ํ๋ ์ ๋๋น๊ฐ๋ค์ ์์๋ก ๋ถ๋ฆฌํ๋ฉด ์ ์ง๋ณด์๊ฐ ์ฉ์ดํด์ง๋๋ค.
- VoiceOver ์ง์์ ์ํ ์ ๊ทผ์ฑ ๋ ์ด๋ธ์ด ๋๋ฝ๋์ด ์์ต๋๋ค.
+ private enum Layout {
+ static let programNumWidth: CGFloat = 50
+ static let nameWidth: CGFloat = 70
+ static let affiliationWidth: CGFloat = 70
+ static let positionWidth: CGFloat = 70
+ static let phoneWidth: CGFloat = 170
+ static let statusWidth: CGFloat = 130
+ }
HStack(spacing: 0) {
Text("\(programNum)")
.expoFont(.caption1B)
.padding(.leading, 8)
- .frame(width: 50, alignment: .leading)
+ .frame(width: Layout.programNumWidth, alignment: .leading)
+ .accessibilityLabel("ํ๋ก๊ทธ๋จ ๋ฒํธ \(programNum)")
Committable suggestion skipped: line range outside the PR's diff.
Button(action: { | ||
self.action() | ||
}) { | ||
HStack(spacing: 0) { | ||
Text("\(programNum)") | ||
.expoFont(.caption1B) | ||
.padding(.leading, 8) | ||
.frame(width: 50, alignment: .leading) | ||
|
||
Text(userName) | ||
.frame(width: 70, alignment: .leading) | ||
|
||
Text(affiliation) | ||
.frame(width: 70, alignment: .leading) | ||
|
||
Text(position) | ||
.frame(width: 70, alignment: .leading) | ||
|
||
Text(phoneNumber) | ||
.frame(width: 170, alignment: .leading) | ||
|
||
Image(consentStatus ? "okIcon" : "ButtonX") | ||
.frame(width: 130, alignment: .center) | ||
} | ||
.padding(.bottom, 36) | ||
.expoFont(.caption2R) | ||
} | ||
.buttonStyle(PlainButtonStyle()) | ||
.gesture( | ||
DragGesture(minimumDistance: 0) | ||
.onChanged { _ in self.isPressed = true } | ||
.onEnded { _ in | ||
self.isPressed = false | ||
self.action() | ||
} |
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.
์ค๋ณต ์ก์ ํธ์ถ์ ์ ๊ฑฐํด์ฃผ์ธ์.
Button์ action๊ณผ gesture์ onEnded์์ ๋ชจ๋ action()์ ํธ์ถํ๊ณ ์์ด ์ค๋ณต ์คํ๋ ์ ์์ต๋๋ค.
- Button(action: {
- self.action()
- }) {
+ Button(action: {}) {
๐ Committable suggestion
โผ๏ธ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
Button(action: { | |
self.action() | |
}) { | |
HStack(spacing: 0) { | |
Text("\(programNum)") | |
.expoFont(.caption1B) | |
.padding(.leading, 8) | |
.frame(width: 50, alignment: .leading) | |
Text(userName) | |
.frame(width: 70, alignment: .leading) | |
Text(affiliation) | |
.frame(width: 70, alignment: .leading) | |
Text(position) | |
.frame(width: 70, alignment: .leading) | |
Text(phoneNumber) | |
.frame(width: 170, alignment: .leading) | |
Image(consentStatus ? "okIcon" : "ButtonX") | |
.frame(width: 130, alignment: .center) | |
} | |
.padding(.bottom, 36) | |
.expoFont(.caption2R) | |
} | |
.buttonStyle(PlainButtonStyle()) | |
.gesture( | |
DragGesture(minimumDistance: 0) | |
.onChanged { _ in self.isPressed = true } | |
.onEnded { _ in | |
self.isPressed = false | |
self.action() | |
} | |
Button(action: {}) { | |
HStack(spacing: 0) { | |
Text("\(programNum)") | |
.expoFont(.caption1B) | |
.padding(.leading, 8) | |
.frame(width: 50, alignment: .leading) | |
Text(userName) | |
.frame(width: 70, alignment: .leading) | |
Text(affiliation) | |
.frame(width: 70, alignment: .leading) | |
Text(position) | |
.frame(width: 70, alignment: .leading) | |
Text(phoneNumber) | |
.frame(width: 170, alignment: .leading) | |
Image(consentStatus ? "okIcon" : "ButtonX") | |
.frame(width: 130, alignment: .center) | |
} | |
.padding(.bottom, 36) | |
.expoFont(.caption2R) | |
} | |
.buttonStyle(PlainButtonStyle()) | |
.gesture( | |
DragGesture(minimumDistance: 0) | |
.onChanged { _ in self.isPressed = true } | |
.onEnded { _ in | |
self.isPressed = false | |
self.action() | |
} |
ScrollView(.horizontal, showsIndicators: false) { | ||
InfoListView() | ||
.padding(.top, 12) | ||
|
||
ScrollView(showsIndicators: false) { | ||
ForEach(1..<10, id: \.self) { index in | ||
ExpoProgramDetail( | ||
programNum: index, | ||
userName: "์์ง์", | ||
affiliation: "๊ณ ๋ฑํ๊ต", | ||
position: "์ฐ์์", | ||
attendanceState: true, | ||
inTime: "10:30", | ||
outTime: "11:30" | ||
) | ||
} | ||
.frame(maxWidth: .infinity, alignment: .leading) | ||
} |
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.
๐ ๏ธ Refactor suggestion
์ค์ฒฉ๋ ScrollView๋ก ์ธํ ์ฌ์ฉ์ ๊ฒฝํ ๋ฐ ์ฑ๋ฅ ๋ฌธ์ ๊ฐ๋ฅ์ฑ ํ์ธ ํ์
ScrollView(.horizontal)
๋ด์ ScrollView
๋ฅผ ์ค์ฒฉํ์ฌ ์ฌ์ฉํ๋ฉด ์คํฌ๋กค ์ด๋ฒคํธ๊ฐ ์ถฉ๋ํ์ฌ ์ฌ์ฉ์ ๊ฒฝํ์ ๋ถ์ ์ ์ธ ์ํฅ์ ์ค ์ ์์ต๋๋ค. ํนํ ์คํฌ๋กค ๋ฐฉํฅ์ด ๋ค๋ฅธ ScrollView๋ฅผ ์ค์ฒฉํ ๊ฒฝ์ฐ ์์์น ๋ชปํ ๋์์ด ๋ฐ์ํ ์ ์์ต๋๋ค. ๋ ์ด์์์ ์ฌ๊ตฌ์ฑํ์ฌ ์ค์ฒฉ๋ ScrollView๋ฅผ ํผํ๋ ๊ฒ์ด ์ข์ต๋๋ค.
Text("100๋ช ") | ||
.expoColor(ExpoColor.main) | ||
.expoFont(.caption2R) | ||
.padding(.trailing, 16) | ||
} |
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.
์ฐธ๊ฐ์ ์ ํ๋์ฝ๋ฉ ๊ฐ์ ํ์
์ฐธ๊ฐ์ ์๊ฐ ํ๋์ฝ๋ฉ๋์ด ์์ต๋๋ค. ์ค์ ๋ฐ์ดํฐ๋ฅผ ๋ฐ์ํ๋๋ก ์์ ์ด ํ์ํฉ๋๋ค.
์ฐธ๊ฐ์ ์๋ฅผ ๋์ ์ผ๋ก ๊ณ์ฐํ์ฌ ํ์ํ๋๋ก ์์ ํด์ฃผ์ธ์. ๋ํ ๋ฐ์ดํฐ ๋ชจ๋ธ์ ์ถ๊ฐํ์ฌ ์ํ ๊ด๋ฆฌ๋ฅผ ๊ตฌํํ๋ ๊ฒ์ด ์ข๊ฒ ์ต๋๋ค.
ScrollView(.horizontal, showsIndicators: false) { | ||
if userInfoListName == "ํ์ฅ ์ ์ฒญ" { | ||
SceneApplicationInfoListView() | ||
.padding(.top, 12) | ||
} else { | ||
InfoListView() | ||
.padding(.top, 12) | ||
} | ||
|
||
ScrollView(showsIndicators: false) { | ||
ForEach(1..<10, id: \.self) { index in | ||
if userInfoListName == "ํ์ฅ ์ ์ฒญ" { | ||
SceneApplicationInfoListDetail( | ||
programNum: index, | ||
userName: "์์ง์", | ||
affiliation: "๊ณ ๋ฑํ๊ต", | ||
position: "์ฐ์์", | ||
phoneNumber: "01062860063", | ||
consentStatus: true | ||
) | ||
} else { | ||
ExpoProgramDetail( | ||
programNum: index, | ||
userName: "์์ง์", | ||
affiliation: "๊ณ ๋ฑํ๊ต", | ||
position: "์ฐ์์", | ||
attendanceState: true, | ||
inTime: "10:30", | ||
outTime: "11:30" | ||
) | ||
} | ||
} | ||
.frame(maxWidth: .infinity, alignment: .leading) | ||
} | ||
.padding(.top, 15) | ||
} | ||
|
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.
๐ ๏ธ Refactor suggestion
์คํฌ๋กค ๋ทฐ ๊ตฌํ ๋ฐ ๋ฐ์ดํฐ ์ฒ๋ฆฌ ๊ฐ์ ํ์
- ์ค์ฒฉ๋
ScrollView
๋ ์ฑ๋ฅ ๋ฌธ์ ๋ฅผ ์ผ์ผํฌ ์ ์์ต๋๋ค. - ํ ์คํธ ๋ฐ์ดํฐ๊ฐ ํ๋์ฝ๋ฉ๋์ด ์์ต๋๋ค.
๋ค์๊ณผ ๊ฐ์ ๊ฐ์ ์ ์ ์๋๋ฆฝ๋๋ค:
- ์ค์ฒฉ๋
ScrollView
๋์LazyVStack
๊ณผ ๋จ์ผScrollView
๋ฅผ ์ฌ์ฉํ์ธ์. - ์ค์ ๋ฐ์ดํฐ ๋ชจ๋ธ์ ์์ฑํ๊ณ
ObservableObject
๋ฅผ ํ์ฉํ ๋ฐ์ดํฐ ๋ฐ์ธ๋ฉ์ ๊ตฌํํ์ธ์.
์์ ์ฝ๋:
class ParticipantViewModel: ObservableObject {
@Published var participants: [Participant] = []
func fetchParticipants(type: String) {
// API ํธ์ถ ๋ฐ ๋ฐ์ดํฐ ๋ก๋ฉ ๊ตฌํ
}
}
struct Participant: Identifiable {
let id: UUID
let programNum: Int
let userName: String
let affiliation: String
// ... ๊ธฐํ ํ์ํ ์์ฑ๋ค
}
.sheet(isPresented: $userInfoListButtonAction) { | ||
VStack(spacing: 0){ | ||
Button { | ||
userInfoListName = "์ฌ์ ํ์ฌ" | ||
userInfoListButtonAction.toggle() | ||
} label: { | ||
Text("์ฌ์ ํ์ฌ ์ฐธ๊ฐ์") | ||
.frame(maxWidth: .infinity, minHeight: 58) | ||
.foregroundStyle(.black) | ||
} | ||
.padding(.top, 15) | ||
|
||
Button { | ||
userInfoListName = "ํ์ฅ ์ ์ฒญ" | ||
userInfoListButtonAction.toggle() | ||
} label: { | ||
Text("ํ์ฅ ์ ์ฒญ ์ฐธ๊ฐ์") | ||
.frame(maxWidth: .infinity, minHeight: 58) | ||
.foregroundStyle(.black) | ||
} | ||
|
||
Button { | ||
userInfoListName = "์ฌ์ ๊ต์ ์์" | ||
userInfoListButtonAction.toggle() | ||
} label: { | ||
Text("์ฌ์ ๊ต์ ์์ ์ฐธ๊ฐ์") | ||
.frame(maxWidth: .infinity, minHeight: 58) | ||
.foregroundStyle(.black) | ||
} | ||
|
||
Button { | ||
userInfoListButtonAction.toggle() | ||
} label: { | ||
Text("์ทจ์") | ||
.frame(maxWidth: .infinity, minHeight: 58) | ||
.expoColor(ExpoColor.error) | ||
} | ||
|
||
Spacer() | ||
} | ||
.expoFont(.body2R) | ||
.presentationDetents([.height(230)]) | ||
} |
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.
๐ ๏ธ Refactor suggestion
์ํธ ๊ตฌํ ๊ฐ์ ์ ์
๋ฒํผ ๊ตฌํ์ด ๋ฐ๋ณต๋๊ณ ์์ผ๋ฉฐ, ์ฐธ๊ฐ์ ์ ํ์ด ํ๋์ฝ๋ฉ๋์ด ์์ต๋๋ค.
๋ค์๊ณผ ๊ฐ์ ๊ฐ์ ์ ์ ์๋๋ฆฝ๋๋ค:
- ์ฐธ๊ฐ์ ์ ํ์ ์ด๊ฑฐํ์ผ๋ก ์ ์
- ๊ณตํต ๋ฒํผ ์คํ์ผ์ ์ถ์ถ
- ๋์ ์ํธ ๋์ด ๊ณ์ฐ
enum ParticipantType: String, CaseIterable {
case preEvent = "์ฌ์ ํ์ฌ"
case onSite = "ํ์ฅ ์ ์ฒญ"
case preTeacher = "์ฌ์ ๊ต์ ์์"
var description: String {
return "\(rawValue) ์ฐธ๊ฐ์"
}
}
struct ParticipantTypeButton: View {
let type: ParticipantType
let action: () -> Void
var body: some View {
Button(action: action) {
Text(type.description)
.frame(maxWidth: .infinity, minHeight: 58)
.foregroundStyle(.black)
}
}
}
๐ก ๊ฐ์
์ฐธ๊ฐ์ ๊ด๋ฆฌ ํ์ด์ง ํผ๋ธ๋ฆฌ์ฑ
๐ ์์ ๋ด์ฉ
๐ธ ๊ธฐํ
2025-01-12.8.24.53.mov
Summary by CodeRabbit
์๋ก์ด ๊ธฐ๋ฅ
๋์์ธ ์์คํ
๋ฒ๊ทธ ์์