Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Xcode 12.4 Missing return in a closure expected to return 'AnyView' #78

Open
ekordin opened this issue Jul 10, 2022 · 3 comments
Open

Comments

@ekordin
Copy link

ekordin commented Jul 10, 2022

In Xcode 12.4, Stinsen v2.0.9: Adding the library by CocoaPods or by SPM, but compilation failed in the NavigationViewCoordinator.swift

Any ideas except updating the macOS? (I can fix the Stinsen's code locally, but it will not work for the rest of the team)

public class NavigationViewCoordinator<T: Coordinatable>: ViewWrapperCoordinator<T, AnyView> {
    public init(_ childCoordinator: T) {
        super.init(childCoordinator) { view in
            #if os(macOS)
            AnyView(
                NavigationView {
                    view
                }
            )
            #else
            AnyView( // Missing return in a closure expected to return 'AnyView' ; did you mean to return the last expression?
                NavigationView {
                    view
                }
                .navigationViewStyle(StackNavigationViewStyle())
            )
            #endif
        }
    }
    
    @available(*, unavailable)
    public override init(_ childCoordinator: T, _ view: @escaping (AnyView) -> AnyView) {
        fatalError("view cannot be customized")
    }
}
@LePips
Copy link
Collaborator

LePips commented Jul 13, 2022

This is implicit return in Swift 5.1. You either must be using that version or later, which you should be able to do with Xcode 12.4, or update your Xcode version.

@ekordin
Copy link
Author

ekordin commented Jul 17, 2022

This is implicit return in Swift 5.1. You either must be using that version or later, which you should be able to do with Xcode 12.4, or update your Xcode version.

I understand this, but I didn't want to modify the Stinsen code locally and fetch the code via pods.

@LePips
Copy link
Collaborator

LePips commented Jul 25, 2022

Updating your Swift version does not require modification of Stinsen.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants