困ったこと
.swift
let items = ["hoge", "higa", "piyo"]
var body: some View {
VStack () {
List {
ForEach(0 ..< items.count) { index in
Text(items[index])
}
}
.listStyle(PlainListStyle())
}
}
このコードを表示すると、こんな風に表示される
1番上と下のライン消したいんだがどうしたらいいのやら
対応方法
SectionでList内を囲って、 .listSectionSeparator(.hidden) を指定すればOK
.swift
let items = ["hoge", "higa", "piyo"]
var body: some View {
VStack () {
List {
Section() {
ForEach(0 ..< items.count) { index in
Text(items[index])
}
}.listSectionSeparator(.hidden)
}
.listStyle(PlainListStyle())
}
}
無事消えました🙏
参考