From cfc3c30cfe15789dc31931f1467d0eb477244360 Mon Sep 17 00:00:00 2001 From: David Roman <2538074+davdroman@users.noreply.github.com> Date: Wed, 17 Jul 2024 00:16:36 +0100 Subject: [PATCH] WIP --- Sources/Introspect.swift | 12 ------------ Sources/IntrospectionSelector.swift | 3 --- Sources/IntrospectionView.swift | 3 +-- Sources/ViewTypes/ListCell.swift | 2 +- 4 files changed, 2 insertions(+), 18 deletions(-) diff --git a/Sources/Introspect.swift b/Sources/Introspect.swift index 1572c0f6..67d6ea12 100644 --- a/Sources/Introspect.swift +++ b/Sources/Introspect.swift @@ -103,46 +103,37 @@ public protocol PlatformEntity: AnyObject { associatedtype Base: PlatformEntity @_spi(Internals) - @MainActor var ancestor: Base? { get } @_spi(Internals) - @MainActor var descendants: [Base] { get } @_spi(Internals) - @MainActor func isDescendant(of other: Base) -> Bool } extension PlatformEntity { @_spi(Internals) - @MainActor public var ancestor: Base? { nil } @_spi(Internals) - @MainActor public var descendants: [Base] { [] } @_spi(Internals) - @MainActor public func isDescendant(of other: Base) -> Bool { false } } extension PlatformEntity { @_spi(Internals) - @MainActor public var ancestors: some Sequence { sequence(first: self~, next: { $0.ancestor~ }).dropFirst() } @_spi(Internals) - @MainActor public var allDescendants: some Sequence { recursiveSequence([self~], children: { $0.descendants~ }).dropFirst() } - @MainActor func nearestCommonAncestor(with other: Base) -> Base? { var nearestAncestor: Base? = self~ @@ -153,7 +144,6 @@ extension PlatformEntity { return nearestAncestor } - @MainActor func allDescendants(between bottomEntity: Base, and topEntity: Base) -> some Sequence { self.allDescendants .lazy @@ -161,7 +151,6 @@ extension PlatformEntity { .prefix(while: { $0 !== topEntity }) } - @MainActor func receiver( ofType type: PlatformSpecificEntity.Type ) -> PlatformSpecificEntity? { @@ -180,7 +169,6 @@ extension PlatformEntity { .first } - @MainActor func ancestor( ofType type: PlatformSpecificEntity.Type ) -> PlatformSpecificEntity? { diff --git a/Sources/IntrospectionSelector.swift b/Sources/IntrospectionSelector.swift index 8722d3c4..f4d38b35 100644 --- a/Sources/IntrospectionSelector.swift +++ b/Sources/IntrospectionSelector.swift @@ -4,11 +4,9 @@ @MainActor public struct IntrospectionSelector { @_spi(Advanced) - @MainActor public static var `default`: Self { .from(Target.self, selector: { $0 }) } @_spi(Advanced) - @MainActor public static func from(_ entryType: Entry.Type, selector: @MainActor @escaping (Entry) -> Target?) -> Self { .init( receiverSelector: { controller in @@ -45,7 +43,6 @@ public struct IntrospectionSelector { return copy } - @MainActor func callAsFunction(_ controller: IntrospectionPlatformViewController, _ scope: IntrospectionScope) -> Target? { if scope.contains(.receiver), diff --git a/Sources/IntrospectionView.swift b/Sources/IntrospectionView.swift index 2386f1e6..c464b5b3 100644 --- a/Sources/IntrospectionView.swift +++ b/Sources/IntrospectionView.swift @@ -3,8 +3,8 @@ import SwiftUI typealias IntrospectionViewID = UUID +@MainActor fileprivate enum IntrospectionStore { - @MainActor static var shared: [IntrospectionViewID: Pair] = [:] struct Pair { @@ -14,7 +14,6 @@ fileprivate enum IntrospectionStore { } extension PlatformEntity { - @MainActor var introspectionAnchorEntity: Base? { if let introspectionController = self as? IntrospectionPlatformViewController { return IntrospectionStore.shared[introspectionController.id]?.anchor~ diff --git a/Sources/ViewTypes/ListCell.swift b/Sources/ViewTypes/ListCell.swift index 0fc45c43..3684e6b6 100644 --- a/Sources/ViewTypes/ListCell.swift +++ b/Sources/ViewTypes/ListCell.swift @@ -74,7 +74,7 @@ import SwiftUI /// } /// ``` public struct ListCellType: IntrospectableViewType { - @MainActor public var scope: IntrospectionScope { .ancestor } + public var scope: IntrospectionScope { .ancestor } } extension IntrospectableViewType where Self == ListCellType {