์๊น์
๊ตฌํ
struct SelectableModal: View {
let title: String
let selectCases: [String]
let onSelect: (String) -> Void
var body: some View {
VStack(spacing: 0) {
Spacer().frame(height: 26)
Text(title)
.font(.system(size: 17, weight: .bold))
.padding(.bottom, 16)
Rectangle()
.foregroundColor(ColorManager.black150)
.frame(height: 1)
ForEach(selectCases, id: \\.self) { selectCase in
Button {
onSelect(selectCase)
} label: {
VStack(spacing: 0) {
Rectangle()
.foregroundColor(ColorManager.black50)
.frame(height: 1)
Spacer()
Text(selectCase)
.foregroundColor(ColorManager.black600)
.font(.system(size: 16))
Spacer()
}
.frame(height: 52)
}
}
}
.frame(width: 310)
.cornerRadius(24)
}
}
์ฌ์ฉ
SelectableModal(
title: "์ ๊ณ ์ฌ์ ๋ฅผ ์
๋ ฅํด์ฃผ์ธ์",
selectCases: ReportType.allCases.compactMap({ $0.rawValue})
) { selectedReport in
// TODO: ๋ทฐ๋ชจ๋ธ์์ report ํ๊ธฐ
viewModel.report(selectedReport: selectedReport)
}
๋ฐ์ํ
'๐ iOS > SwiftUI' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
Introspect (0) | 2023.12.06 |
---|---|
SwiftUI Charts๋ก ๋ฐฉ์ฌํ ์ฐจํธ๋ง๋ค๊ธฐ (0) | 2023.06.22 |
[์ฑ์คํ ์ด ๋ฆฌ์ ] Guideline 4.3 - Design - Spam (0) | 2023.03.14 |
[SwiftUI] ์ ๋๋ชน ๋ฐฐ๋๊ด๊ณ ๋ฌ๊ธฐ (0) | 2023.03.02 |
git@my_private_repo.git: An unknown error occurred. reference 'refs/remotes/origin/main' not found (-1) ์ค๋ฅ ํด๊ฒฐ (0) | 2023.03.02 |