fix customizing widgets not working
This commit is contained in:
@@ -16,7 +16,7 @@ struct CreateWidgetView: View {
|
||||
|
||||
@State private var mouth: CustomWidgetMouthOptions = CustomWidgetMouthOptions.defaultOption
|
||||
|
||||
@State var widgetView: CustomWidgetView
|
||||
var widgetView: CustomWidgetView
|
||||
|
||||
private var randomElements: [AnyView]
|
||||
|
||||
@@ -38,7 +38,7 @@ struct CreateWidgetView: View {
|
||||
|
||||
_customWidget = StateObject(wrappedValue: customWidget)
|
||||
|
||||
_widgetView = State(initialValue:CustomWidgetView(customWidgetModel: customWidget))
|
||||
widgetView = CustomWidgetView(customWidgetModel: customWidget)
|
||||
}
|
||||
|
||||
func update(eye: CustomWidgetEyes, eyeOption: CustomWidgetEyeOptions) {
|
||||
@@ -48,8 +48,6 @@ struct CreateWidgetView: View {
|
||||
case .right:
|
||||
customWidget.rightEye = eyeOption
|
||||
}
|
||||
|
||||
widgetView = CustomWidgetView(customWidgetModel: customWidget)
|
||||
}
|
||||
|
||||
func createRandom() {
|
||||
@@ -66,18 +64,14 @@ struct CreateWidgetView: View {
|
||||
update(mouthOption: CustomWidgetMouthOptions.allCases.randomElement()!)
|
||||
|
||||
update(background: CustomWidgetBackGroundOptions.allCases.randomElement()!)
|
||||
|
||||
widgetView = CustomWidgetView(customWidgetModel: customWidget)
|
||||
}
|
||||
|
||||
func update(mouthOption: CustomWidgetMouthOptions) {
|
||||
customWidget.mouth = mouthOption
|
||||
widgetView = CustomWidgetView(customWidgetModel: customWidget)
|
||||
}
|
||||
|
||||
func update(background: CustomWidgetBackGroundOptions) {
|
||||
customWidget.background = background
|
||||
widgetView = CustomWidgetView(customWidgetModel: customWidget)
|
||||
}
|
||||
|
||||
var mixBG: some View {
|
||||
|
||||
Reference in New Issue
Block a user