Mercurial > public > lazybear
view LazyBear/UI/HUD.swift @ 178:c1aa75608c27
Implement HUD
author | Dennis Concepción Martín <66180929+denniscm190@users.noreply.github.com> |
---|---|
date | Sun, 21 Feb 2021 17:38:23 +0100 |
parents | 235ee168a9c3 |
children |
line wrap: on
line source
// // HUD.swift // LazyBear // // Created by Dennis Concepción Martín on 21/2/21. // import SwiftUI struct HUD: View { var text: String var image: String var body: some View { Label(text, systemImage: image) .foregroundColor(.gray) .padding(.horizontal, 10) .padding(14) .background( Blur(style: .systemMaterial) .clipShape(Capsule()) .shadow(color: Color(.black).opacity(0.22), radius: 12, x: 0, y: 5) ) } } struct Blur: UIViewRepresentable { var style: UIBlurEffect.Style func makeUIView(context: Context) -> UIVisualEffectView { return UIVisualEffectView(effect: UIBlurEffect(style: style)) } func updateUIView(_ uiView: UIVisualEffectView, context: Context) { uiView.effect = UIBlurEffect(style: style) } }