The iOS 14 battery widget has blur.
But if you implement them yourself in WidgetKit, you'll get 🚫 on a yellow background.
How should I implement it?
struct VisualEffectView: UIViewRepresentable {
var effect: UIVisualEffect?
func makeUIView(context: UIViewRepresentableContext<Self>) -> UIVisualEffectView { UIVisualEffectView() }
func updateUIView(_ uiView: UIVisualEffectView, context: UIViewRepresentableContext<Self>) { uiView.effect = effect }
}
struct BackgroundSunView : View {
var body: some View {
VisualEffectView(effect: UIBlurEffect(style: .dark))
.edgesIgnoringSafeArea(.all)
}
}
struct WidgetKitEntryView : View {
var body: some View {
ZStack {
BackgroundSunView()
VStack {
Text("Hello")
}
}
}
}
7
0
5.2k