[SUI] 라벨드 콘텐츠

발행: (2026년 1월 31일 오전 06:52 GMT+9)
1 min read
원문: Dev.to

Source: Dev.to

기본 사용

struct ContentView: View {
    @State private var selection: Int = 1
    @State private var stepperValue = 1

    var body: some View {
        NavigationView {
            Form {
                LabeledContent("Etiqueta visible") {
                    HStack {
                        Text("Tengo: \(stepperValue)")
                        Stepper("Etiqueta oculta", value: $stepperValue, in: 0...10)
                            .labelsHidden()
                    }
                }
                Picker("Selected Value", selection: $selection) {
                    Text("Option 1").tag(1)
                    Text("Option 2").tag(2)
                }
            }
        }
    }
}

보이는 레이블과 내부 컨트롤이 있는 LabeledContent 예시

사용자 정의 뷰가 있는 레이블

struct ContentView: View {
    @State private var selection: Int = 1
    @State private var stepperValue = 1

    var body: some View {
        NavigationView {
            Form {
                LabeledContent {
                    HStack {
                        Text("Tengo: \(stepperValue)")
                        Stepper("Etiqueta oculta", value: $stepperValue, in: 0...10)
                            .labelsHidden()
                    }
                } label: {
                    HStack {
                        Image(systemName: "pencil")
                        Text("Etiqueta visible")
                    }
                    Text("Subtitle")
                }
                Picker("Selected Value", selection: $selection) {
                    Text("Option 1").tag(1)
                    Text("Option 2").tag(2)
                }
            }
        }
    }
}

맞춤형 레이블이 있는 LabeledContent 예시

Back to Blog

관련 글

더 보기 »

[SUI] 양식 (Form)

Form Form은 컨트롤을 그룹화하기 위한 컨테이너이며, 주로 특정 기능의 설정에 사용됩니다. 컨트롤을 List에 표시합니다.

[SUI] 검색 바

NavigationStack의 검색 바 NavigationStack은 `searchable` 수식어를 사용하여 검색 바를 포함할 수 있습니다. 그 서명은 다음과 같습니다: ```swift searchable(...) ```

[SUI] MultiDatePicker

MultiDatePicker 사용 MultiDatePicker는 SwiftUI에서 여러 날짜를 선택할 수 있게 합니다. Swift 초기화 메서드 MultiDatePicker.init(_:selection:in:) - titleKey: 레이블 키…