I\'m getting a thread issue that says "Invalid frame dimension (negative or non-finite)."
Here\'s my code:
struct CellSty
Basically .frame will take the given values and return another view that is updated with the values you put.
If you omit one of the parameters or set it to nil, then it will take the respective width/height value of the previous view.
Test code:
struct ContentView: View {
@State var keyValue = ""
var body: some View {
VStack(spacing: 10) {
Text("Something")
.background(Color.blue)
Text("Something")
.frame(width: 300, height: nil, alignment: .center)
.background(Color.blue)
Text("Something")
.frame(width: nil, height: 200, alignment: .center)
.background(Color.blue)
Text("Something")
.frame(width: nil, height: nil, alignment: .center)
.background(Color.blue)
}
}
}
.infinity
(Apple doc on .infinity) is of type Float
, so there's no way for .frame
not to except it, but it still can create problems. (Thus the thread issue)
Thanks to Mark Moeykens for the help in getting me to this answer!