Hi, guys i got errors from my View like below : Is anyone who can help me to fix it?
My model like:
var id = UUID()
var decision: String
var choices: [String]
var startAngle: Angle
var endAngle: Angle
@CodableColor var color: UIColor
struct Angle: Codable, Equatable {
var degrees: Double
}
}
My model view like:
import SwiftUI
class ChooseModelView: ObservableObject {
var midRadians: Double {
return Double.pi / 2.0 - (model.startAngle.degrees + model.endAngle.degrees) * .pi / 180 / 2.0
}
@Published var model = ChooseModel(decision: "What to eat tonight?", choices: ["Sushi", "Ramen", "Korean BBQ", "Chinese"], startAngle: ChooseModel.Angle(degrees: 0.0), endAngle: ChooseModel.Angle(degrees: 90.0), color: UIColor.green)
My view like :
let width: CGFloat = min(geometry.size.width, geometry.size.height)
let height = width
let center = CGPoint(x: width * 0.5, y: height * 0.5)
path.move(to: center)
path.addArc(
center: center,
radius: width * 0.5,
startAngle: Angle(degrees: -90.0) + chooseMV.model.startAngle,
endAngle: Angle(degrees: -90.0) + chooseMV.model.endAngle,
clockwise: false)
path.closeSubpath()
}