Clipped and small List in Sidebar

Hello, all. I made a SplitView with a List in the sidebar, but the List is TINY in the sidebar for some reason (see attached image). Why is the List not taking up the full size of the sidebar area? Why is it so small? Thank you!
struct ContentView: View {
let assets = Assets(textures: [.init(id: "ColorMap", width: 1024, height: 1024, format: "png")])

var body: some View {
NavigationSplitView {
List {
Section(header: Text("Textures")) {
List {
ForEach(self.assets.textures) { texture in
HStack {
Image(systemName: "photo")
.resizable()
.scaledToFit()
.frame(width: 24, height: 24)
Text(texture.id)
.bold()
}
}
}
.listStyle(.sidebar)
}
}
} detail: {
HStack { }
}
}
}
struct ContentView: View {
let assets = Assets(textures: [.init(id: "ColorMap", width: 1024, height: 1024, format: "png")])

var body: some View {
NavigationSplitView {
List {
Section(header: Text("Textures")) {
List {
ForEach(self.assets.textures) { texture in
HStack {
Image(systemName: "photo")
.resizable()
.scaledToFit()
.frame(width: 24, height: 24)
Text(texture.id)
.bold()
}
}
}
.listStyle(.sidebar)
}
}
} detail: {
HStack { }
}
}
}
No description
5 Replies
grimlessbbs
grimlessbbs14mo ago
No description
grimlessbbs
grimlessbbs14mo ago
Here is the running app
xPsycHoWasPx
xPsycHoWasPx14mo ago
add
.frame(maxWidth: .infinity, maxHeight: .infinity)
.frame(maxWidth: .infinity, maxHeight: .infinity)
to the list ?
grimlessbbs
grimlessbbs14mo ago
Uuuuhhh thanks for the tip, but I deleted all of that code and moved back to Storyboards (for my own reasons).... I cannot confirm or deny that this worked...
xPsycHoWasPx
xPsycHoWasPx14mo ago
ofc it would hat worked.. but if u just jump back to uikit the first time swiftui fails you, ofc u will never learn to use it ..
Want results from more Discord servers?
Add your server