0

I have a SwiftUI view which was originally only used for an iOS widget. I would like to re-use this view now for a watchOS app.

@Environment(.widgetFamily) var widgetFamily

The widgetFamily surprisingly was set to ".accessoryCircular". Is this some kind of strange default? This happens within the context of the main watchOS app - no widgets and no complications involved at this stage.

I would like to distinguish between the "accessoryCircular" iOS widget and the main watchOS app. How can I achieve this?

Mick
  • 954
  • 7
  • 17
  • 1
    Just refactor the actual view from the widget, and use that refactored view in both places. – Yrb Oct 04 '22 at 01:18
  • @Yrb: you mean - refactor this view until there are no more environment values about the widget family? I think I get the point - the widget family should not occur deep down in my SwiftUI views.... – Mick Oct 04 '22 at 20:30

0 Answers0