From 51c94007a9f2f75d3c023849cf335810277a5572 Mon Sep 17 00:00:00 2001 From: David Scheutz Date: Tue, 27 Feb 2024 16:29:13 -0500 Subject: [PATCH] remove AnyView requirement --- Sources/InfiniteNavigation/InfiniteNavContainer.swift | 6 +++--- Sources/InfiniteNavigation/InfiniteNavigation.swift | 4 ++-- Sources/InfiniteNavigation/LegacyInfiniteNavContainer.swift | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Sources/InfiniteNavigation/InfiniteNavContainer.swift b/Sources/InfiniteNavigation/InfiniteNavContainer.swift index 95b8595..cc5261b 100644 --- a/Sources/InfiniteNavigation/InfiniteNavContainer.swift +++ b/Sources/InfiniteNavigation/InfiniteNavContainer.swift @@ -5,7 +5,7 @@ import Combine internal struct Sheet: Identifiable { let id = UUID().uuidString var path = NavigationPath() - let source: () -> AnyView + let source: () -> any View } public typealias Environments = [any ObservableObject] @@ -14,7 +14,7 @@ public typealias Environments = [any ObservableObject] public struct InfiniteNavContainer: View { public typealias NavDestinationPublisher = AnyPublisher, Never> - public typealias NavDestinationBuilder = (Destination) -> AnyView + public typealias NavDestinationBuilder = (Destination) -> any View private let navAction: NavDestinationPublisher private let viewBuilder: NavDestinationBuilder @@ -83,7 +83,7 @@ extension InfiniteNavContainer { .toAnyView() } - private func wrap(_ view: some View) -> some View { + private func wrap(_ view: any View) -> some View { view .apply(environments: environments) .navigationBarHidden(true) diff --git a/Sources/InfiniteNavigation/InfiniteNavigation.swift b/Sources/InfiniteNavigation/InfiniteNavigation.swift index 26c8d1e..2a850d8 100644 --- a/Sources/InfiniteNavigation/InfiniteNavigation.swift +++ b/Sources/InfiniteNavigation/InfiniteNavigation.swift @@ -8,7 +8,7 @@ public struct InfiniteNavigation { initialStack: [Destination] = [], navAction: AnyPublisher, Never>, environments: any ObservableObject..., - viewBuilder: @escaping (Destination) -> AnyView, + viewBuilder: @escaping (Destination) -> some View, @ViewBuilder root: @escaping () -> Root ) -> some View { create( @@ -25,7 +25,7 @@ public struct InfiniteNavigation { initialStack: [Destination] = [], navAction: AnyPublisher, Never>, environments: Environments = [], - viewBuilder: @escaping (Destination) -> AnyView, + viewBuilder: @escaping (Destination) -> some View, @ViewBuilder root: @escaping () -> Root ) -> some View { if #available(iOS 16.0, *) { diff --git a/Sources/InfiniteNavigation/LegacyInfiniteNavContainer.swift b/Sources/InfiniteNavigation/LegacyInfiniteNavContainer.swift index 91f2bee..a7be2d2 100644 --- a/Sources/InfiniteNavigation/LegacyInfiniteNavContainer.swift +++ b/Sources/InfiniteNavigation/LegacyInfiniteNavContainer.swift @@ -6,7 +6,7 @@ public struct LegacyInfiniteNavContainer: UIViewContro public typealias UIViewControllerType = UINavigationController public typealias NavDestinationPublisher = AnyPublisher, Never> - public typealias NavDestinationBuilder = (View) -> AnyView + public typealias NavDestinationBuilder = (View) -> any SwiftUI.View private let coordinator: Coordinator private let rootResolver: () -> Root