| 1 |
// |
|
| 2 |
// BorderView.swift |
|
| 3 |
// USB Meter |
|
| 4 |
// |
|
| 5 |
// Created by Bogdan Timofte on 11/04/2020. |
|
| 6 |
// Copyright © 2020 Bogdan Timofte. All rights reserved. |
|
| 7 |
// |
|
| 8 | ||
| 9 |
import SwiftUI |
|
| 10 | ||
| 11 |
struct BorderView: View {
|
|
| 12 |
let show: Bool |
|
| 13 |
var fillColor: Color = .clear |
|
| 14 |
var opacity = 0.5 |
|
| 15 | ||
| 16 |
var body: some View {
|
|
| 17 |
ZStack {
|
|
| 18 |
RoundedRectangle(cornerRadius: 10) |
|
| 19 |
.foregroundColor(fillColor).opacity(opacity) |
|
| 20 | ||
| 21 |
RoundedRectangle(cornerRadius: 10) |
|
| 22 |
.stroke(lineWidth: 3.0).foregroundColor(show ? fillColor : Color.clear) |
|
| 23 |
.animation(.linear(duration: 0.1)) |
|
| 24 |
} |
|
| 25 |
} |
|
| 26 |
} |
|
| 27 | ||
| 28 |
struct BorderView_Previews: PreviewProvider {
|
|
| 29 |
static var previews: some View {
|
|
| 30 |
BorderView(show: true) |
|
| 31 |
} |
|
| 32 |
} |