我在SwiftUI中创建了一个列表,想要更改颜色或移除分隔线,在UIKit中,我们可以轻松地更改TableView中分隔线的颜色。
以下是SwiftUI列表的代码和UI(图像)
@State private var users = ["Paul", "Taylor", "Adele"]
var body: some View {
List(){
ForEach(users, id: \.self) { user in
HStack{
Image("helmet").resizable().frame(width: 40, height: 40, alignment: .leading)
VStack(alignment : .leading){
Text(user).font(.custom("SFProText-Semibold", size: 14))
Text("Blu Connect").font(.custom("SFProText-Semibold.ttf", size: 11))
}
}
}
.onDelete(perform: delete)
}
}