Skip to content

Instantly share code, notes, and snippets.

@anupamchugh
Last active July 1, 2020 12:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anupamchugh/ec61a5ed1eb126c8f333590eb643d61d to your computer and use it in GitHub Desktop.
Save anupamchugh/ec61a5ed1eb126c8f333590eb643d61d to your computer and use it in GitHub Desktop.
struct JokesWidgetEntryView : View {
var entry: JokeProvider.Entry
@Environment(\.widgetFamily) var family
@ViewBuilder
var body: some View {
switch family {
case .systemSmall:
Text(entry.joke)
.minimumScaleFactor(0.3)
.padding(.all, 5)
default:
VStack{
Text("Chuck Norris Cracks:")
.font(.system(.headline, design: .rounded))
.padding()
Text(entry.joke)
.minimumScaleFactor(0.3)
.padding(.all, 5)
}
.frame(minWidth: 0, maxWidth: .infinity, minHeight: 0, maxHeight: .infinity)
.background(Color.pink)
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment