forked from nalexn/clean-architecture-swiftui
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRootViewModifier.swift
More file actions
31 lines (25 loc) · 842 Bytes
/
Copy pathRootViewModifier.swift
File metadata and controls
31 lines (25 loc) · 842 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
//
// RootViewModifier.swift
// CountriesSwiftUI
//
// Created by Alexey Naumov on 09.11.2019.
// Copyright © 2019 Alexey Naumov. All rights reserved.
//
import SwiftUI
import Combine
// MARK: - RootViewAppearance
struct RootViewAppearance: ViewModifier {
@Environment(\.injected) private var injected: DIContainer
@State private var isActive: Bool = false
internal let inspection = Inspection<Self>()
func body(content: Content) -> some View {
content
.blur(radius: isActive ? 0 : 10)
.ignoresSafeArea()
.onReceive(stateUpdate) { self.isActive = $0 }
.onReceive(inspection.notice) { self.inspection.visit(self, $0) }
}
private var stateUpdate: AnyPublisher<Bool, Never> {
injected.appState.updates(for: \.system.isActive)
}
}