I'm trying to get the right widget family in a view, but I'm always getting .systemMedium value. This is my view:
import SwiftUI
struct MyView: View
{
@Environment(\.widgetFamily) var family
let entry: MyEntry
@ViewBuilder
var body: some View
{
switch family
{
case .systemSmall:
Text("systemSmall")
case .systemMedium:
Text("systemMedium")
case .systemLarge:
Text("systemLarge")
case .systemExtraLarge:
Text("systemExtraLarge")
}
}
}
Any ideas why this is happening? Thanks.