I've downloaded the new Xcode 11.4 update and it's broken my codebase. I use GeometryReader to determine the user's Watch screen size so it can draw a frame that fills up most of the frame.
Say if I wrote this to draw a rectangular frame:
var body: some View {
GeometryReader {geometry in
ZStack {
// Draw rounded rectangle flashcard background
RoundedRectangle(cornerRadius: 15, style: .continuous)
.frame(width: geometry.size.width, height: geometry.size.height*0.9)
}
}
}
It looks fine at the moment. But my main view usually uses subviews more like this:
var body: some View {
GeometryReader {geometry in
ZStack {
// Draw rounded rectangle flashcard background
Frontside(id: self.$settings.randomNum, sheet: self.$showingSheet, rotate: self.$fullRotation, invis: self.$showNextCard, col: self.$colour, width: geometry.size.width*0.9, height: geometry.size.height).environmentObject(self.settings)
.rotation3DEffect(.degrees(self.showResults ? 180.0 : 0.0), axis: (x: 0.0, y: 1.0, z: 0.0))
.rotation3DEffect(.degrees(self.fullRotation ? 360.0 : 0.0), axis: (x: 0.0, y: 1.0, z: 0.0))
.opacity(self.showResults ? 0 : 1)
.zIndex(self.showResults ? 0 : 1)
}
}
}
public struct Frontside: View
{
@EnvironmentObject var settings: UserSettings
@Binding public var id: Int
@Binding public var sheet: Bool
@Binding public var rotate: Bool
@Binding public var invis: Bool
@Binding public var col: Int
public var width: CGFloat
public var height: CGFloat
public var body: some View
{
ZStack {
// Draw rounded rectangle flashcard background
RoundedRectangle(cornerRadius: 15, style: .continuous)
.frame(width: self.width, height: self.height)
.zIndex(0)
}
}
}
For some reason this causes an error when I call Frontside. Does anyone know why? There doesn't seem to be a real difference between the two code snippets other than using a subview in the second example.