error build: Cannot find 'NavigationStack' in scope

just upgraded Xcode beta to Xcode 14 RC

Now it does not find NavigationStack in scope. It build fine on Xcode beta.

               

                NavigationStack {                     List() { ... } }

Post not yet marked as solved Up vote post of jrgamber Down vote post of jrgamber
2.6k views

Replies

Same issue here. Did Apple manage to break the RC once again or are we doing something wrong?

Post not yet marked as solved Up vote reply of iCat Down vote reply of iCat

Same here! Unbelievable with RC version.

Strange. I am not having this problem on Xcode 14 RC. Are you sure you have imported SwiftUI?

  • It happens when you develop for iOS, iPadOS, and MacOS.

Add a Comment

Just installed Ventura beta 7, now two new additional errors..

error build: Cannot infer contextual base in reference to member 'horizontal'

error build: Value of type 'TextField' has no member 'autocorrectionDisabled'

  • change it to .disableAutocorrection(true)

Add a Comment

It happens when you develop for iOS, iPadOS, and MacOS.

Make sure that your macOS minimum deployment target is set to version 13.0, otherwise NavigationStack will not be available. I'm assuming you're iOS target version is 16.0.


Just installed Ventura beta 7, now two new additional errors..

Double-check you are targeting iOS 16 and/or macOS 13 where NavigationStack, and other new APIs, are available.

If not, you will have to provide more information on where these errors are coming from.

  • I thought conditional #if handled versions. Will a special release be required for every OS?

  • @available(iOS 16.0, *)

    struct ContentViewNSV: View { ... }

    The entire struct containing the NavigationStack is built with an annotation for IOS 16. It used to build just fine until XCODE RC.

  • We will have to continue using NavigationView, because otherwise we are out of the market in the company. Removing iOS 16 to keep our great MacOS market.

This fixed the issue. I had a Mac OS build in the supported destinations

  • That macOS build is not a macOS build, but the iOS build that can run on macOS.

Add a Comment

Maybe this will explain things (from the macOS and Xcode release notes):

The macOS 13 SDK provides support to develop apps for Mac computers running macOS 13 Ventura beta 7. The SDK comes bundled with Xcode 14 beta 6 ...

Xcode 14 RC includes Swift 5.7 and SDKs for iOS 16, iPadOS 16, tvOS 16, watchOS 9, and macOS Monterey 12.5. 

  • Thank you. I shall never assume that cardinality is relevant again.

Add a Comment

I have fixed it using NavigationView {} instead NavigationStack{}

i have MACOS 11.6.2 and my xcode version is 13.2.1 and i am getting this same error "Cannot find 'NavigationStack' in scope" how to fix this , any solution