Skip to content

Commit

Permalink
remove AnyView requirement
Browse files Browse the repository at this point in the history
  • Loading branch information
David Scheutz committed Feb 27, 2024
1 parent ac7a027 commit 51c9400
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions Sources/InfiniteNavigation/InfiniteNavContainer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand All @@ -14,7 +14,7 @@ public typealias Environments = [any ObservableObject]
public struct InfiniteNavContainer<Destination: Hashable, Root: View>: View {

public typealias NavDestinationPublisher = AnyPublisher<NavAction<Destination>, Never>
public typealias NavDestinationBuilder = (Destination) -> AnyView
public typealias NavDestinationBuilder = (Destination) -> any View

private let navAction: NavDestinationPublisher
private let viewBuilder: NavDestinationBuilder
Expand Down Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions Sources/InfiniteNavigation/InfiniteNavigation.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ public struct InfiniteNavigation {
initialStack: [Destination] = [],
navAction: AnyPublisher<NavAction<Destination>, Never>,
environments: any ObservableObject...,
viewBuilder: @escaping (Destination) -> AnyView,
viewBuilder: @escaping (Destination) -> some View,
@ViewBuilder root: @escaping () -> Root
) -> some View {
create(
Expand All @@ -25,7 +25,7 @@ public struct InfiniteNavigation {
initialStack: [Destination] = [],
navAction: AnyPublisher<NavAction<Destination>, Never>,
environments: Environments = [],
viewBuilder: @escaping (Destination) -> AnyView,
viewBuilder: @escaping (Destination) -> some View,
@ViewBuilder root: @escaping () -> Root
) -> some View {
if #available(iOS 16.0, *) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ public struct LegacyInfiniteNavContainer<Root: SwiftUI.View, View>: UIViewContro

public typealias UIViewControllerType = UINavigationController
public typealias NavDestinationPublisher = AnyPublisher<NavAction<View>, Never>
public typealias NavDestinationBuilder = (View) -> AnyView
public typealias NavDestinationBuilder = (View) -> any SwiftUI.View

private let coordinator: Coordinator
private let rootResolver: () -> Root
Expand Down

0 comments on commit 51c9400

Please sign in to comment.