checking
if #available(iOS 17.0, *)
then apply the .contentMarginsDisabled() worked for me
Post
Replies
Boosts
Views
Activity
tried
var body: some WidgetConfiguration {
if UIDevice.current.systemVersion.components(separatedBy: ".").first!.convertToInt! > 16 {
return IntentConfiguration(kind: self.kind,
intent: testIntent.self,
provider: testProvider()) { entry in
testEntryView(entry: entry)
.frame(maxWidth: .infinity, maxHeight: .infinity)
.background(Color(.widgetBackground))
}
.configurationDisplayName(Localized("test") + ": " + Localized("test"))
.description(Localized("test"))
.supportedFamilies([.systemMedium])
.contentMarginsDisabled()
} else {
return IntentConfiguration(kind: self.kind,
intent: testIntent.self,
provider: testProvider()) { entry in
testEntryView(entry: entry)
.frame(maxWidth: .infinity, maxHeight: .infinity)
.background(Color(.widgetBackground))
}
.configurationDisplayName(Localized("test") + ": " + Localized("test"))
.description(Localized("test"))
.supportedFamilies([.systemMedium])
}
}
but got an error Function declares an opaque return type 'some WidgetConfiguration', but the return statements in its body do not have matching underlying types which is odd, this is not unlike the first approach but it won't recognize the body after .contentMarginsDisabled(), removing it fix the error