Skip to content

Instantly share code, notes, and snippets.

@intan1907
Last active June 16, 2021 09:08
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 intan1907/ca095896b79a1eb994c5e30b4d0889ca to your computer and use it in GitHub Desktop.
Save intan1907/ca095896b79a1eb994c5e30b4d0889ca to your computer and use it in GitHub Desktop.
HeartyRecipeWidgetSmallView with widgetURL modifier
// ...
struct HeartyRecipeWidgetSmallView: View {
var recipe: RecipeBaseClass?
var body: some View {
ZStack(alignment: .top) {
Color(.white)
VStack(alignment: .leading) {
Image.loadLocalImage(image: recipe?.imageURL ?? "")
.centerCropped()
.frame(height: 64)
.cornerRadius(10)
Text("\(recipe?.getTime() ?? "") • \(recipe?.serving ?? "1 portion")")
.font(.system(size: 10, weight: .regular, design: .default))
Text(recipe?.name ?? "")
.font(.system(size: 12, weight: .semibold, design: .default))
.multilineTextAlignment(.leading)
}
.padding()
}
.widgetURL(recipe?.widgetURL)
}
}
// ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment