SwiftUI List行内、センタリング、HStackとSpacer活用

List行内のセンタリング

Example

Code

import SwiftUI

struct SettingView: View {
    var body: some View {
        List {
            Section(header: Text("About")) {
                HStack {
                    Spacer()
                    VStack {
                        Text("Music Info")
                            .font(.largeTitle)
                        Text("Version 1.0")
                            .font(.caption)
                    }
                    Spacer()
                }
            }
        }
    }
}

struct SettingView_Previews: PreviewProvider {
    static var previews: some View {
        SettingView()
    }
}

Swift

Posted by shi-n