Skip to content

Instantly share code, notes, and snippets.

@apatronl
Last active July 18, 2020 15:53
Show Gist options
  • Save apatronl/7fc73b6da36a9808ce2984c77854164a to your computer and use it in GitHub Desktop.
Save apatronl/7fc73b6da36a9808ce2984c77854164a to your computer and use it in GitHub Desktop.
struct EmojiWidgetView: View {
@Environment(\.widgetFamily) var family: WidgetFamily
let emojiDetails: EmojiDetails
@ViewBuilder
var body: some View {
switch family {
case .systemSmall:
SmallEmojiWidgetView(emojiDetails: emojiDetails)
case .systemMedium:
MediumEmojiWidgetView(emojiDetails: emojiDetails)
case .systemLarge:
LargeEmojiWidgetView(emojiDetails: emojiDetails)
@unknown default:
EmptyView()
}
}
}
struct SmallEmojiWidgetView: View { ... }
struct MediumEmojiWidgetView: View { ... }
struct LargeEmojiWidgetView: View { ... }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment