SwiftUI Get TabView Height - swiftui

Is it possible to detect the height of SwiftUI's TabView?
...Assuming different devices from iOS 15 onwards aren't all 49...
I have tried using Geometry Reader and SafeAeaInsets based on other answers but to no avail

Related

What is the recommended way to convert between pixels and points in SwiftUI?

I want to display a QR code in SwiftUI. The code is generated as a CGImage via CIImage. I don't want to scale it to the full size available because if the scaling factor isn't an integer there may be fuzzy boundaries between the QR modules. So I need a way to convert between iOS display points which I can get with GeometryReader and physical points. I've found a few search "hits" about reading the screen scale from a UIView, but not how I can get this scale in SwiftUI.
There a few more hits which just say the scale is 3 on all modern iPhones, and as I'm targeting iOS 15+ I think I can safely assume it's always 3 for now, but what if Apple bring out even higher pixel densities in future?
You can get displayScale using the Environment property wrapper.
struct ContentView: View {
#Environment(\.displayScale) var displayScale
var body: some View {
Text("display scale: \(displayScale)")
}
}
Consult EnvironmentValues to what else SwiftUI provides in the “environment”.

How to add character spacing in SwiftUI after applying fonts and color style?

I want to add character spacing in the text of SwiftUI in iOS version iOS 14 and plus.
When I use a new modifier called as kerning and Tracking after applying fonts styling then it won't work. So any pointer will be appreciated.
kerning and tracking are available in earlier versions of iOS, but only if they're applied directly to Text views.
What's new in iOS 16 is the ability to apply the modifier to any view, and have it apply to any of its Text child views.
Note the iOS availability flags:
Text.tracking(_:) - iOS 13.0+
View.tracking(_:) - iOS 16.0+
So that means that this should work for you in iOS 14:
Text("My Sample Text")
.tracking(-0.1)
but this would not:
VStack {
Text("My Sample View")
Text("With two lines of text")
}
.tracking(-0.1)

Strange home bar appearance in SwiftUI app [duplicate]

This question already has answers here:
How to hide the home indicator with SwiftUI?
(6 answers)
Hide the Home Indicator in Swift 2.0
(1 answer)
Closed 1 year ago.
I have a View that has some VStacks and ZStacks (top bar, carousel, detail view with if condition).
This code changes fullscreen/not fullscreen appearance:
.edgesIgnoringSafeArea(viewModel.currentItem != nil ? .all : [])
But even without .all activated I have a strange bottom Home bar appearance like there is a gradient/shadow overlay on it:
What could cause this and how to avoid this?
P.S. I also noticed in my UI hierarchy that HostingViewController is a subview of the UIDropShadowView.
P.P.S. It also doesn't go when navigation to other view with NavigationLink
That is not an issue, it should be like that, since we have no touch id in new iPhone models, that things play as kind of help in Screen. And when you use edgesIgnoringSafeArea in your code, you get access to under area and back area of that shape for Color works!
That shape is used for Swipe up to go iPhone main screens.
Look at the iPhone 8, it has touch, and look at iPhone 11, No touch ID!

SwiftUI Image crashes when you add dark mode asset

I've been using SwiftUI on this simple WidgetKit (iOS 14) successfully, until I added a dark mode asset (PDF) to the image:
If I choose, under "appearance" on the right, "Any, Dark", the widget crashes. I thought SwiftUI would handle this gracefully... Is there a "proper" way to take advantage of the image set's appearances, or do I have to do write the logic to choose between 2 image sets?

How to change the height of a UIPickerView on ios 4.3?

Hi i would like to know if its at all possible to change the height of a UIPickerView on IPhone IOS 4.3.
Creating the UIPickerView programmatically doesn't work
Setting the frame size programmatically doesn't work
Modifying the source code of the xib file doesn't work (Does on ipad)
Cheers