Learn Courses My Dashboard

iOS Foundations: Bonus Module: Screencasts

I’m sure you guys are getting tired of hearing from me, LOL. I have an interesting issue that I can only surmise is an Xcode 13 issue. On the Category screen of the Recipe List App, when Chris scrolls the categories, they go behind the tabs at the bottom whereas mine overlays and makes it hard to read. Attached is a screenshot of what I mean. I opened Chris’s solution from the Resources folder and compared every line from every View and every file that showed there was a modification made during that video. I even went and added


to the end of the NavigationView in the RecipeListView, although I don’t think those are really related.

Try this code. I believe this is a new feature of iOS 15

So, looking at the code, I thought it probably needed to be added to the TabView somehow but I got all kinds of errors. I thought maybe at the top of the file outside the some View block but I got an expected declaration error with the first if underlined in red.

This modifier only applies to a NavigationView and impacts the Views that are transitioned to by tapping on a NavigationLink.

With no content in a TabItem, the tab bar of the TabView will have a transparent background. This is the iOS15 standard. As soon as you have content that goes below the tabBar, the TabBar will change so that the background automatically becomes opaque.

The fact that your version is not doing that is a little odd. Perhaps check your project settings here:

and here:

Project settings look like the screenshot you sent, set to iOS 15.2. Since this applies to the NavigationView, I assume it needs to go somewhere associated to that view; however, I cannot seem to figure out where exactly without getting a bunch of errors.

Add it inside the onAppear modifier of the tab bar

If you intend to use that modifier, it must be added to the closing brace of the NavigationView which is in RecipeListView.

In my version of the project, adding that makes no difference since there is only one View pushed onto the Navigation Stack.

If, for example, you were to have navigated from RecipeListView to RecipeDetailView using a NavigationLink and then navigated to another View from the RecipeDetailView via another NavigationLink then that modifier would be essential since you are placing another View on the Navigation Stack. You will find that is the case with the Learning App in Module 5.

Also in my version the Categories View does not suffer from the transparency issue you are experiencing with the TabBar so that’s interesting too.

What I think you mean by this is to add the .onAppear() modifier to the end of the TabView curly brace, which isn’t currently there. Then add that if #available code inside those parenthesis? Or as modifiers to the onAppear() modifier? I’ve tried both ways only to be presented with multiple errors. I’ve tried searching Google and am still trying but with not much luck.

I did just find this on Stack Overflow however and added it at the top above my @State property and it worked. Here’s that link if you want it: stackoverflow.com/questions/69309689/ios-15-swiftui-tabview-tab-bar-appearance-doesnt-update-between-views

let appearance: UITabBarAppearance = UITabBarAppearance()
    init() {
        UITabBar.appearance().scrollEdgeAppearance = appearance

I meant:

TabBar {
// code here for all tabs
.onAppear {
// code from the link I sent