Swift リストの要素内の余白を削除するサンプル
環境
Swift version 5.2.3 (swift-5.2.3-RELEASE)
Ubuntu 20.04.2 LTS
構文
ItemView()
.listRowInsets(EdgeInsets()) //listRowInsets修飾子の引数にEdgeInsetsを指定
Listの要素の余白を削除するには、listRowInsets修飾子を使います。
使用例
struct ContentView: View {
var body: some View {
List {
ForEach (0..<3, id: \.self) { index in
Text("test\(index + 1)")
.listRowInsets(EdgeInsets())
}
}
}
}