|
window is nil, thus the second tab button does not appear. I copied this code from the finished project in the repo, so where else do I need to look? How does window get set? |
|
Hi @ha1neux! It also took me some time to figure out, as the course is a "bit" outdated and I would say substantial changes were introduced. You need to add those lines in SceneDelegate file instead.
|
|
that sort of works except clicking the "Top Rated" icon produces two "Most Recent" buttons -- sorry can't figure out how to post pictures. |
|
Did you make any set up in tabview for 2 tabitems in your Stroryboard file by any chance? If you could share your full code (maybe via github) I can have a look what is the issue then, otherwise it is diffucult to say what triggers that... |
|
https://github.com/ha1neux/Project7 should be the git repo if I did it right. It's public (why not). |
|
Ok, the issue as follows: In your Storyboard file you have indicated Tab Bar Controller screen in Identity Inspector StoryboardID as "NavController". You have to remove it and instead choose Navigation Controller screen and update its StoryboardID as "NavController" and voila! ADDITION: To get rid of purple warning is you might have guessed you need to use async downloading so you can replace this piece of code:
with creating something like this
and then calling that function in viewDidLoad |
|
The window property in AppDelegate is typically set up in the SceneDelegate (or AppDelegate if you're not using the SceneDelegate). In iOS 13 and later, SceneDelegate became responsible for managing the window. This is because iOS 13 introduced multi-window support for iPad. Here's how you typically set up the window property: SceneDelegate (iOS 13 and later or class SceneDelegate: UIResponder, UIWindowSceneDelegate {
} @UIApplicationMain class AppDelegate: UIResponder, UIApplicationDelegate {
} Make sure that in your storyboard, you have set the initial view controller properly. If window is still nil after checking this, ensure that you don't have any conflicts or issues in your storyboard, and that you don't accidentally overwrite it somewhere else in your code. I follow the same process to resolve my website issue: |
|
BUILD THE ULTIMATE PORTFOLIO APP Most Swift tutorials help you solve one specific problem, but in my Ultimate Portfolio App series I show you how to get all the best practices into a single app: architecture, testing, performance, accessibility, localization, project organization, and so much more, all while building a SwiftUI app that works on iOS, macOS and watchOS.
Sponsor Hacking with Swift and reach the world's largest Swift community!
You need to create an account or log in to reply.
All interactions here are governed by our code of conduct.
Link copied to your pasteboard.