Xcode 14 navigation bar whited out with UIHostingController - ios

I have noticed a bug introduced when building with Xcode 14.
The navigation bar of my swiftui view is whited out and does not properly display the title, back button or other navigation items.
I haven't found anyone else reporting this issue online but it is clearly a change in how Xcode builds the app.
I have verified that building with Xcode 13.4.1 produces the expected navigation bar.
I manually downloaded 13.4.1 in order to continue deploying builds without this bug but I know eventually I will have to investigate why Xcode 14 is causing this issue. I'm hoping there is a fix that Apple discovers and releases to fix this issue.
The navigation bar is programmatically set through a view controller using a UIHostingController as its rootView.
I have found that this only happens when injecting swiftui into a UIKit app using UIHostingController. The SwiftUI view does not use a NavigationView so there shouldn't be any overlap between what is displayed in the navigation bar from the viewController and what is displayed from the SwiftUI view.

I never heard back from Apple but I figured out the issue!
In my case the app had a few settings that worked in Xcode 13 but created the issue in Xcode 14.
I had to remove this key/val from the Info.plist for my app
UIStatusBarStyle
UIStatusBarStyleDarkContent
I removed a setting that was set in AppDelegate
application.setStatusBarStyle(UIStatusBarStyleLightContent)
I explicitly called this in every ViewController (I used a base class that all my View Controllers inherit)
navigationController.setNavigationBarHidden(false, animated:false)
After the above changes the navigation bar showed up correctly and the top status bar also displayed correctly.

Related

NavigationBar is under the statusbar on iOS 9 and 10

I've been developing an app for the past few months, and I was always testing on my iOS 11 device and simulators. Since we are close to public release, I decided to test the app on iOS 9 and 10 simulators to make sure everything is ok.
To my disapointment, the core element of the app is broken: Its an app that displays a list of articles in tableviews, using a TabBarController. More article categories can be accessed through the side menu. However, when I display a VC form the side menu, for which I create the VC, embed it in a NavigationController and then add it in the TabBarController and make it the selected tab, the NavBar is under the status bar and the tableview's content insets extend under the tabBar, which also breaks my TabBar and creates a whole lot of other problems.
The weird thing is that after navigating to the next VC, the whole statusbar situation is fixed, so I'm guessing something is initially off with the NavBar that gets fixed once a second VC is pushed.
Does anyone have any idea on how to fix this bug? On iOS 11 everything works perfectly, while on iOS 9 and 10 only when a new VC is pushed, the error is fixed. Please note that I'm not using a UITableViewController but a ViewCOntroller with an embeded TableView, since I also need to add othr views at the bottom of my view controller.

Issue with Navigation Bar on iOS 10

I am working on an application which needs to be supported from iOS 10. I see the strange issue with navigation bars with Xcode 9.2 and 9.3. I added a view controller on the storyboard and when executing the application on iPhone 5 with iOS 10, I don't get to see the navigation bars, but the same is working on another device with iOS 11. But I can see the navigation bar on storyboards when selected topbar as transculent navigation bar and also embedded in a navigation controller. So what might be the issue?

iOS 11 No background color for status bar in master side of splitview

I have seen a couple of issues similar to this but theirs seemed to be in the main view of their app. I have tried some of their suggestions like deselecting "Safe Area Relieve Margins" in the Size Inspector pane but none have worked. In the Detail side of my iPad app, the background color of my navigation bar stops at the status bar.
In this screenshot, I tried to use MMDrawerController to see if using something other than UISplitViewController would work but I have the same problem for both. So far the only difference between the two libraries is I haven't seen UISplitViewController work at all but with MMDrawerController, if you set openDrawerGestureModeMask to MMOpenDrawerGestureModePanningCenterView and the master view stretches a little bit then the background color renders correctly.
I saw on one of the other post that their issue was a bug for Xcode and there had been several people who already filed their bug Apple. Could this be a separate issue that Apple needs to know about as well if it is a iOS bug?
This is not an issue for iOS 9.X or 10.X, only 11.X.

Xcode 9 Navigation bar issue after navigating from Left Side Menu on iOS 11 not on iOS 10.3 and below

After updating from Xcode 8 to Xcode 9 I've noticed this very strange behaviour in the navigation bar only on devices running iOS 11.
This bug appears after navigating from my left side menu that show the menu controller you choose modally with a default presentation (That is Full Screen)
I've posted a video here: https://youtu.be/mgjlbkMi-N8
It seems a bug of the compilation on Xcode 9.
Tryed also on real device iPad Pro with iOS 11.
The same code compiled with Xcode 8.3.3 works as expected, while compiled with Xcode 9 exposes the issue.
I've put a playground code here: https://github.com/shadowsheep1/xcode9navigationissue
With already a workaround: set the presentation to Over Full Screen.
But that has no meaning this is not the exptected operation.
Once the navigation bar is broken, is broken for every navigation controller in the App.
Any idea?
EDIT:
Apple Developer Relations January 23 2018, 11:13 PM
There are no plans
to address this based on the following:
You are creating a detached presentation, which is causing multiple
navigation bars to be placed in the view hierarchy. The navigation bar
that is seen is not the one where pushes are happening, thus the error
in display. I don’t know why this didn’t happen on iOS 10, but it was
an invalid configuration there as well.
We would recommend that you use a proper view controller container to
implement this menu, rather than what seems to be done (the
IS_SlideMenu_View being placed directly in the window).
I have the same problem with regular UIModalTransitionStyleCoverVertical.
I've solved it by setting UIModalPresentationOverFullScreen or UIModalPresentationOverCurrentContext.
Possibly it also helps you.
Example for navigation that is presented modally:
if (#available(iOS 11.0, *)) {
navController.modalPresentationStyle = UIModalPresentationOverFullScreen;
}

Weird Bug in XCode StoryBoard after upgrading to iOS SDK 7.1

Last night I updated XCode and the iOS SDK.
It looks like it messed up the UINavbar on the storyboard, here is a pic:
It shows two titles overlapping, if I delete the title , then there is still another one in the background, Im not able to remove that second one.
The strange part is it magically disapear, if I run the app.
XCODE version --> Version 5.1 (5B130a)
iOS SDK---------> Version 7.1
Yes, there's a new property for the uiviewcontrollers named "exteded edges" you must uncheck this in the interface builder inside the uiviewcontroller preferences. Or by inserting this code in your view did load. This will tell the controller not to draw the view under the navigation bar.
if ([self respondsToSelector:#selector(edgesForExtendedLayout)]){
self.edgesForExtendedLayout = UIRectEdgeNone;
}
I checked again and there was an extra navigation bar, its weird that It shows only after I upgraded, I think something happen with that view because I embedded it into a navigation controller.

Resources