diff --git a/Sources/Introspect.swift b/Sources/Introspect.swift index 6800812..fc7d4eb 100644 --- a/Sources/Introspect.swift +++ b/Sources/Introspect.swift @@ -20,7 +20,7 @@ extension View { customize: @escaping (PlatformSpecificView) -> Void ) -> some View { if platforms.contains(where: \.isCurrent) { - let id = UUID() + let id = IntrospectionAnchorID() self.background( IntrospectionAnchorView( id: id @@ -93,7 +93,7 @@ extension View { extension PlatformView { fileprivate func receiver( ofType type: PlatformSpecificView.Type, - anchorID: UUID + anchorID: IntrospectionAnchorID ) -> PlatformSpecificView? { let frontView = self guard diff --git a/Sources/IntrospectionView.swift b/Sources/IntrospectionView.swift index b4fd66d..2a0d5e3 100644 --- a/Sources/IntrospectionView.swift +++ b/Sources/IntrospectionView.swift @@ -1,5 +1,7 @@ import SwiftUI +typealias IntrospectionAnchorID = UUID + /// ⚓️ struct IntrospectionAnchorView: PlatformViewControllerRepresentable { #if canImport(UIKit) @@ -11,9 +13,9 @@ struct IntrospectionAnchorView: PlatformViewControllerRepresentable { @Binding private var observed: Void // workaround for state changes not triggering view updates - let id: UUID + let id: IntrospectionAnchorID - init(id: UUID) { + init(id: IntrospectionAnchorID) { self._observed = .constant(()) self.id = id } @@ -28,9 +30,9 @@ struct IntrospectionAnchorView: PlatformViewControllerRepresentable { } final class IntrospectionAnchorPlatformViewController: PlatformViewController { - let id: UUID + let id: IntrospectionAnchorID - init(id: UUID) { + init(id: IntrospectionAnchorID) { self.id = id super.init(nibName: nil, bundle: nil) }