This commit is contained in:
David Roman 2023-06-02 14:57:31 +01:00
parent 442fa3b799
commit 2a80dd1cc2
No known key found for this signature in database
GPG Key ID: 7058646EEFCB70A7
2 changed files with 8 additions and 6 deletions

View File

@ -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<PlatformSpecificView: PlatformView>(
ofType type: PlatformSpecificView.Type,
anchorID: UUID
anchorID: IntrospectionAnchorID
) -> PlatformSpecificView? {
let frontView = self
guard

View File

@ -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)
}