the swift code below takes care of displaying a view according to a state value defined in the view, if the value is true a print is printed if not true nothing is displayed, now the value (Gotocropview) which is defined state is passed as a binding to another view and then changed to @Bindign, if I comment the line in the ContentView view the code is compiled, while if the line is not commented then the code is executed as the code shown in the contentview, it is generated the error: The compiler is unable to type-check this expression in reasonable time; try breaking up the expression into distinct sub-expressions, what is this due to?
Line of comment:
/* else if(Gotocropview==true){
print("Crop view è true")
}*/
Swift Code:
struct ContentView: View {
@State var Gotocamera:Bool = false
@State var Gotoeditcamera:Bool = false
@State var Gotocropview:Bool=false
@Environment(\.presentationMode) var presentationMode
var body: some View {
ZStack {
if (!Gotocamera && !Gotoeditcamera && !Gotocropview) {
Color(#colorLiteral(red: 0.9682741117, green: 0.9682741117, blue: 0.9682741117, alpha: 1)).edgesIgnoringSafeArea(.all)
VStack {
Header()
Search()
.padding(.top, 10)
Buttons(Gotoeditcamera: $Gotoeditcamera,Gotocropview: $Gotocropview)
.padding(.vertical, 20)
Cards()
.padding(.top, 20)
if(Support.getDevice() == DeviceType.ipad) {
Tabbar(Gotocamera: $Gotocamera)
.padding(.top, 200)
}
else{
if(Device.IS_IPHONE_XS){
Tabbar(Gotocamera: $Gotocamera)
.offset(y: 20)
}
else{
Tabbar(Gotocamera: $Gotocamera)
.offset(y: 60) }
}
}
}
else if(Gotocamera==true) {
CameraView()
}
else if(Gotoeditcamera==true){
ChangeEffect()
}
else if(Gotocropview==true){
print("Crop view è true")
}
}
}
}
struct Buttons: View {
@Binding var Gotoeditcamera:Bool
@Binding var Gotocropview:Bool
...
}