From 2a80dd1cc29827dd93c542dbfa0d60598b69a47e Mon Sep 17 00:00:00 2001 From: David Roman <2538074+davdroman@users.noreply.github.com> Date: Fri, 2 Jun 2023 14:57:31 +0100 Subject: [PATCH] wip --- Sources/Introspect.swift | 4 ++-- Sources/IntrospectionView.swift | 10 ++++++---- 2 files changed, 8 insertions(+), 6 deletions(-) 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) }