Introspect now properly updates on every view lifecycle change, so add a check to a reference on the UIHostingController and see if it has been instantiated already. Also clean up view struct names to reflect what is a modifier. Signed-off-by: kingbri <bdashore3@proton.me>
25 lines
540 B
Swift
25 lines
540 B
Swift
//
|
|
// DisableInteraction.swift
|
|
// Ferrite
|
|
//
|
|
// Created by Brian Dashore on 9/13/22.
|
|
//
|
|
// Disables interaction on any view without applying the appearance
|
|
//
|
|
|
|
import SwiftUI
|
|
|
|
struct DisableInteractionModifier: ViewModifier {
|
|
let disabled: Bool
|
|
|
|
func body(content: Content) -> some View {
|
|
content
|
|
.overlay {
|
|
if disabled {
|
|
Color.clear
|
|
.contentShape(Rectangle())
|
|
.gesture(TapGesture())
|
|
}
|
|
}
|
|
}
|
|
}
|