Skip to content

Instantly share code, notes, and snippets.

@caiobzen
Created September 24, 2019 20:32
Show Gist options
  • Save caiobzen/c5f5da18c8544147d1486698771f782a to your computer and use it in GitHub Desktop.
Save caiobzen/c5f5da18c8544147d1486698771f782a to your computer and use it in GitHub Desktop.
Drink Button
import SwiftUI
struct DrinkButton: View {
var text: String
var action: () -> Void
var body: some View {
Button(action: {
withAnimation { self.action() }
}) {
HStack(spacing: 20) {
Image(systemName: "plus.circle.fill")
.resizable()
.frame(width: 20, height: 20)
Text(text)
}
}
.frame(width: 120, height: 50)
}
}
struct DrinkButton_Previews: PreviewProvider {
static var previews: some View {
DrinkButton(text: "100ml") { }
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment