fix customizing widgets not working

This commit is contained in:
Trey t
2022-03-07 11:12:57 -06:00
parent 6089928fd4
commit 63911ea90d
3 changed files with 16 additions and 11 deletions

View File

@@ -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 {