This commit is contained in:
Ivan Vorobei
2019-06-26 22:12:35 +03:00
parent 2477f5d038
commit 48001a8e9a
1363 changed files with 6 additions and 3 deletions

View File

@@ -0,0 +1,32 @@
//
// GreenBadge.swift
// SwiftUIDemo
//
// Created by Thomas Ricouard on 06/06/2019.
// Copyright © 2019 Thomas Ricouarf. All rights reserved.
//
import SwiftUI
struct Badge : View {
let text: String
let color: Color
@Binding var show: Bool
var animation: Animation {
Animation
.spring(initialVelocity: 5)
.speed(2)
}
var body: some View {
Text(text)
.color(.white)
.padding()
.background(color)
.cornerRadius(8)
.scaleEffect(show ? 1: 0.5)
.opacity(show ? 1 : 0)
.animation(animation)
}
}