Your Second iOS and SwiftUI App · Modal Views | raywenderlich.com


This is a companion discussion topic for the original entry at https://www.raywenderlich.com/5662524-your-second-ios-and-swiftui-app/lessons/11

Hi,
I habe a problem in this part. When I add NavigationView thru dragging from the Library, they give me this framework:
NavigationView {
NavigationLink(destination: navigation) {content}
}
then whatever i code in it, the color of codes are totally white.

fixed after restarted the computer, it’s weird.

1 Like

@listenerxdw Glad you fixed it. Cheers! :]

why we call the navigationBarTitle function and navigationBarItems function on the others view but not the NavigationView.

SwiftUI is designed that way so you can change the title based on what view is showing within the navigation view. For example, later on in the course, when TaskEditingView shows up, the title disappears. But you could give it a title too!

Hi I am having an issue, whenever I inserted the sheet I get this error:

Type ‘NewTaskView.Type’ cannot conform to ‘View’; only struct/enum/class types can conform to protocols

Why does this not work?

Sounds like you didn’t instantiate NewTaskView.Type, but instead, tried to use its metatype. What’s the line of code that generates the error?

I had the same problem and appeared to be two issues that resolved it.

  1. The code couldn’t see the NewTaskView. I had to move it out of the folder, let it be found then move back into the Views folder.

  2. “nmbs” keystrokes did not work. I instead type “navigationBaritems()” it should have been “navigationBarItems()” (capital i in items).

No idea why it wasn’t showing up.

I figured it out, I had put NewTaskView instead of NewTaskView() with parenthesis. That solved the problem.

EDIT: Never mind, realized 30sec after posting that I just had the title appended to the wrong View, oops :laughing:

When I added the title and image to the NavigationView, nothing shows up above the list.
image

Screenshot shows the SwiftUI preview, but it’s the same on my iPhone device.

1 Like

Must say I’m pretty disappointed with this course. I’ve watched first swift app, and the swift fundamentals and comparing to this it’s very unpleasing to watch. First two courses were explained clearly what’s going on and why.

I’m here to learn, instead I’m watching a tutor dragging and jumping all over the place some components and not explaining what’s going on. I want to understand and not to be copy monkey.

Currently at the Part 2, still thinking should I continue or just quit and learn on my own.

Sorry but this is not a good course.

Don’t know why but when I add a navigationBarItems, separator line of the list items is not full width. Example : Book an escape room task, the separator line start under the first “o” of Book instead of starting under the “B”. Not a big issue but it annoys me a little. :slight_smile: