Swiftui navigationview and tabview give grey header - swiftui

I have a two-tabbed tab view and in the second tab there are different pages being displayed. There is a navigationview and navigationlink within some of the pages. The navigation bar has a weird grey background that I can’t make go away. Any ideas how to remove that?

So it turns out I had a .padding around the view for the second tab, so everything within that view was padded, which introduced this. Removing that solved the issue.

Related

Navigation View in Tab View Child Views SwiftUi

I have started learning swiftUI so I have question about Navigation View. My app starts with splash screen which is embedded in Navigation View and after that I have navigation link to the second screen which is Tab View. Do I need navigation views in child views of Tab View if I have some button etc and I also need to go to other screens from them or I use primary navigation view which tab view is embedded in?
When using both TabView and NavigationView, TabView should always be the parent view and should contain NavigationView inside it.
Hope this clarifies what you’re looking for?

Change Title Bar Colour SwiftUI (No NavigationView nor .ignoresSafeArea())

There are two solutions I have seen can be used to change the colour of the title bar in SwiftUI:
Making the use of NavigationView
Ignoring the sage area with .ignoresSafeArea()
I have no use for a NavigationView nor I want to use .ignoresSafeArea() since it helps on giving the TabView bottom tab space.
The only requirement to the solution I am looking for is that it cannot be for iOS 16 and above only, since it will not be viable to use in production for at least the next two years.
TL;DR:
I need to change the colour of the title bar (the upper-most part of the app) with features available in versions prior to iOS 16, and without the use of NavigationView and .ignoresSafeArea()
The white stuff in this image:

UIView hidden by TabView

I have tried to include TabView in my SwiftUI, after inclusion, I found that the bottom of the other UIView is being covered.
I have tried to use GeometryReader in each of my UIView, so that it get the maximum space. However, I found that it is still covered by the TabView unless I try to hide it. Any method to get the space only occupied by the screen (visible area, not include the tab bar at the bottom)?

SwiftUI TextField does not work after adding gesture

After adding a combined gesture to a view, a TextField inside the view would no longer respond when I would tap into it to change the text. I discovered this after adding a custom combined gesture - where I used a long press to start things before dragging. (Note: things still worked if just a drag gesture was added. Not sure what is particularly different between these two cases.)
The combined gesture:
let combined = longPressGesture.simultaneously(with: dragGesture)
The gesture was added to the view with:
.gesture(combined)
I got things to work by adding an onTapGesture{} to the TextField. Didn’t have to put anything into the action. Seems like a side effect whose behavior could change in the future. Appreciate any comments on if this makes sense or other ways to handle.
TextField(“Enter Text”, text: $myText)
.textFieldStyle(RoundedBorderTextFieldStyle())
.onTapGesture {}
In case one would have this issue with a drag gesture, you can set the minimumDistance. This would still register the tap on the textfield to edit it.
DragGesture(minimumDistance: 30, coordinateSpace: .global)
Adding a drag gesture in SwiftUI to a View inside a ScrollView blocks the scrolling

UIViewRepresentable not sizing correctly in ScrollView

I followed Apple's guide on using UIPageViewController with SwiftUI. Their guide works fine. However I ran into an issue, where if I have my PageView inside a ScrollView - the height of the PageView is no longer respected and I have to set the frame manually. Not ideal, as the content inside PageView is dynamic and thus, heights will vary.
This seems to be an issue with ScrollView; as I have another view - UIViewRepresentable - that is a simple wrapper around WKWebView - with the same issue.
Is there a way to have these views size themselves, inside a SwiftUI ScrollView?
If I place these views outside of a ScrollView and into a simple VStack for example, they size themselves correctly.