I'm experimenting with iOS 14 widgets and have a weird issue. My widget is not loading when I'm using a List
in the widget view. If I'm using HStack
, VStack
etc. all works ok.
Here is some simple code for the sake of example:
struct WidgetView: View {
var body: some View {
List {
Text("Test 1")
Text("Test 2")
}
}
}
I'm seeing this image as a result:
Again, it all works well with other elements, this is only happening with List
.
List has a scrolling function not supported on the widget, widgets only display static views, instead try using forEach.
struct SomeView: View {
var body: some View {
HStack {
ForEach(1..<5) { index in
otherView()
}
}
}
}
You may use an HStack, or VStack depending on your needs and design.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With