Skip to content

Commit

Permalink
fixed recorders widget for iOS 17
Browse files Browse the repository at this point in the history
  • Loading branch information
sobri909 committed Dec 14, 2023
1 parent 3ee06d2 commit fd729eb
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions RecordersWidget/RecordersWidget.swift
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,9 @@ struct RecordersWidgetEntryView: View {
.opacity(0.3)
}
}
.padding([.top, .leading, .trailing], family == .systemSmall ? 16 : 20)
.padding([.top, .leading, .trailing], 16)
.padding([.bottom], 4)
.widgetBackground(Color.clear)
}

func row(leftText: Text, rightText: Text, isActiveRecorder: Bool = false, isAlive: Bool = false) -> some View {
Expand All @@ -105,6 +106,18 @@ struct RecordersWidget: Widget {
}
.configurationDisplayName("Arc Recorders")
.description("Status of Arc recorders.")
.supportedFamilies([.systemSmall, .systemMedium])
.supportedFamilies([.systemSmall])
.contentMarginsDisabled()
}
}

// workaround for iOS 17's required new background thing while still supporting iOS 16
extension View {
func widgetBackground(_ backgroundView: some View) -> some View {
if #available(iOSApplicationExtension 17.0, *) {
return containerBackground(for: .widget) { backgroundView }
} else {
return background(backgroundView)
}
}
}

0 comments on commit fd729eb

Please sign in to comment.