can have / save multiple custom widgets

This commit is contained in:
Trey t
2022-02-22 22:59:08 -06:00
parent 769c6335d9
commit 520119de85
6 changed files with 278 additions and 66 deletions

View File

@@ -293,8 +293,15 @@ struct SmallIconView: View {
var body: some View {
GeometryReader { geo in
CustomWidgetView(customWidgetModel: UserDefaultsStore.getCustomWidget())
.frame(width: geo.size.width, height: geo.size.height)
if let inUseWidget = UserDefaultsStore.getCustomWidgets().first(where: {
$0.inUse == true
}) {
CustomWidgetView(customWidgetModel: inUseWidget)
.frame(width: geo.size.width, height: geo.size.height)
} else {
CustomWidgetView(customWidgetModel: CustomWidgetModel.randomWidget)
.frame(width: geo.size.width, height: geo.size.height)
}
}
}
}