I am using Version 12.0.1 (12A7300).
Widgets are added by size to the app being serviced, but only the medium size is shown.
Below is the code.
struct SRWidgetEntryView: View {
@Environment(\.widgetFamily) private var widgetFamily
var entry: Provider.Entry
var body: some View {
VStack {
Text(entry.date, style: .time)
switch widgetFamily {
case .systemSmall:
Text("systemSmall")
case .systemMedium:
Text("systemMedium")
case .systemLarge:
Text("systemLarge")
@unknown default: Text("unknown")
}
}
}
}
It works well when it comes to a new project, but why does this work in an existing app?
Topic:
UI Frameworks
SubTopic:
SwiftUI
Tags: