The frame(width:?) contains CGFloat, so .
can start CGFloat init, static, etc., but in this case CGFloat does not have main, so .
cannot start.
.frame (width: UISscreen.main.bounds.width*0.8, height:200)
.frame (width:.zero)
You can force yourself to do it, but it doesn't make sense.
struct ContentView:View {
@State var text: String="Hello"
varbody:someView {
TextEditor (text:$text)
.frame (width:.main.bounds.width*0.8, height:200)
}
}
extension CGFloat {
static let main —UISscreen=.main
}
© 2024 OneMinuteCode. All rights reserved.