SwiftUI Group Boxes can be used to combine related views.
ContentView.swift
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | // // ContentView.swift // swiftuidev // // Created by Cairocoders // import SwiftUI struct ContentView: View { @State private var name = "" var body: some View { VStack { GroupBox(label: Label( "Heart rate" , systemImage: "heart.fill" ).font(.largeTitle).foregroundColor(.red)) { Text( "69 BPM" ).font(.title) } GroupBox { Text( "Enter your name" ).font(.title) TextField( "name" , text: $name) } Spacer() }.padding(.horizontal) } } struct ContentView_Previews: PreviewProvider { static var previews: some View { ContentView() } } |