[SUI] 양식 (Form)
발행: (2026년 1월 31일 오전 06:42 GMT+9)
2 min read
원문: Dev.to
Source: Dev.to
Form
Form은 주로 기능 설정에 사용되는 컨트롤을 그룹화하는 컨테이너입니다.
컨트롤을 grouped 스타일의 List에 표시하고 주변에 패딩을 제공합니다.
List 컴포넌트와 마찬가지로, Form도 Section을 사용하여 내용을 섹션별로 구분할 수 있습니다.
예시
enum NotifyMeAboutType {
case directMessages, mentions, anything
}
enum ProfileImageSize {
case large, medium, small
}
struct ContentView: View {
@State private var notifyMeAbout: NotifyMeAboutType = .anything
@State private var playNotificationSounds = false
@State private var sendReadReceipts = false
@State private var profileImageSize: ProfileImageSize = .small
var body: some View {
NavigationView {
Form {
Section(header: Text("Notifications"),
footer: Text("¿Qué quieres que te notifique?")) {
Picker("Notify Me About", selection: $notifyMeAbout) {
Text("Direct Messages").tag(NotifyMeAboutType.directMessages)
Text("Mentions").tag(NotifyMeAboutType.mentions)
Text("Anything").tag(NotifyMeAboutType.anything)
}
Toggle("Play notification sounds", isOn: $playNotificationSounds)
Toggle("Send read receipts", isOn: $sendReadReceipts)
}
Section(header: Text("User Profiles")) {
Picker("Profile Image Size", selection: $profileImageSize) {
Text("Large").tag(ProfileImageSize.large)
Text("Medium").tag(ProfileImageSize.medium)
Text("Small").tag(ProfileImageSize.small)
}
Button("Clear Image Cache") {}
}
}
}
}
}