Your First iOS and SwiftUI App · Adding an About Page | raywenderlich.com


This is a companion discussion topic for the original entry at https://www.raywenderlich.com/4919757-your-first-ios-and-swiftui-app/lessons/44
1 Like

I’m using a 2018 MBP, Catalina 15.2, Xcode 11.3

So I imagine this is a bug with Swift UI, but when I run the app in the simulator and press the info button, it pushes the about page normally.

Then I can press back and go back to the home page.

Then, if I press the about button again, now it does nothing. It doesn’t trigger the push to the about view.

Any ideas?

2 Likes

I am also having the same issue as well!

I came across the same problem!

1 Like

I have the same issue too. 2019 MBP, Catalina 10.15.1 , XCode 11.3.

The issue for me is only on simulators, not when I run it on a physical device

Using Catalina 15.2 and Xcode 11.3…
Not sure if this is related to other posts, but I encountered a problem when (following the video instructions at 6:38) I replaced
Button(action: {}) {
in ContentView with
NavigationLink(desitination: AboutView()) {
This resulted in a “Use of unresolved identifier ‘AboutView’” error.
I’ve double-triple checked that the AboutView.swift file was created correctly with correct target membership, etc.
Any clues? Thanks.

I’m having the same issue.
I hope someone at Raywenderlich.com can help and clarify this situation.

Hello, maybe using the right spelling solves your error?

Hello, in Bull’s Eye about page, the page can be opened only once on the simulator. Xcode 11.3.
Thank you for your attention.

Hello, Petitjo, and thank you for your reply…the embarrassing spelling error (good catch, by the way!) only occurred in the post not the code. In any case, the problem went away after closing Xcode and restarting the computer. Thank you again for your reply. Happy New Year.

I am having strange issue before .padding worked but when I added navigationBarTitle. The padding gives "“Int: is not Convertible to 'CGFloat?”

Here is part of the code:
.padding(.bottom, 20)
}
.background(Image(“Background”), alignment: .center)
.accentColor(midnightBlue)
.navigationBarTitle(“Bullseye”)

If I remove padding from the code then the error goes to:
Text("(self.target)").modifier(ValueStyle())

Error says: “Type of expression is ambiguous without more context.” I tried removing self but still has a error.

Before this video it will always build without any problems. I have no idea why adding navigation broke other parts of the code.

I had the same issue, but thanks to rokk’s comments I tried it on my phone and it works fine, so I concur, it’s only an issue on the simulator. A rather annoying bug I guess?

I’m running the Big Sur beta, and am currently using the Xcode 12 beta to complete this course. (Not ideal, I know, but I’d already installed Big Sur and am unable to get Xcode 11 to run correctly now.)

Xcode 12 seems to have removed the Single View App template, so I just used the App template. It didn’t make a difference until I got to this section. There is no AppDelegate.swift file or SceneDelegate.swift file for me to modify. I’m not sure where to go from here but did want to let you know as you may need to adjust the tutorials to take this into account.

You may have already solved this, but for others who come after us… I found the code that loads the ContentView in a source file named BullseyeApp.swift. I was able to enclose the ContentView in a NavigationView in BullseyeApp.swift and get the desired result.

1 Like

I’m getting this strange issue that NavigationLink(destination: AboutView()) { ... } gives me an error:

Cannot find ‘AboutView’ in scope

However, the app does build and run in the simulator as expected. In the following screenshot you can see the errors I’m getting. I’m running Xcode Version 12.1 (12A7403).

Moreover, I get this error in the AboutView.swift file and don’t quite see what the problem is:

Expected declaration

I currently run macOS Catalina 10.15, run XCode 12.1, and used the App template just like noktulo did.

After looking around, it looks like the new template has taken out App and SceneDelegates and just replaced them with “XXXApp.swift”. The only code I had was about 12 lines worth starting with @main and creating a struct.

Current link that gives more context to the situation: (https://medium.com/better-programming/say-goodbye-to-scenedelegate-in-swiftui-444173b23015)

it looks like adding a NavigationView inside WindowGroup in BulleyeApp.swift does the trick:

import SwiftUI

@main
struct BullseyeApp: App {
    var body: some Scene {
        WindowGroup {
            NavigationView{
                ContentView()
                AboutView()
            }
            .navigationViewStyle(StackNavigationViewStyle())
        }
    }
}

You’ll then follow the rest of the tutorial and it should be good.

There are white space in the left and right.
I’m using XCode Version 12.1 (12A7403) on Catalina 10.15.7.
Anyone know reason?

I got the same error but it went away after I refreshed the build.

Please check out the updated version of the course when you get a chance:

I hope it helps!