简体   繁体   中英

How to remove default padding for separator for List in SwiftUI?

I have created List in SwiftUI, but it has extra padding for divider (separator), I want to reduce that leading padding and make same padding for trailing and leading.

在此处输入图像描述

var body: some View {
    NavigationView() {
        List(modelData) { weather in
            HStack {
                Image(systemName: weather.image)
                    .frame(width: 50, height: 10, alignment: .leading)
                Text("\(weather.temp)º")
                    .frame(width: 50, height: 10, alignment: .leading)
                VStack {
                    Text(weather.city)
                }
            }.font(.title)

        }
        .navigationBarTitle(Text("World Weather"))
    }
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM