|
I have the following code:
My goal is to have my LocationPickerView() take up the entire screen regardless of the orientation of the device. A LocationPickerView() is a custom view I built:
However, I have a problem. The safe area is not being ignored. At first glance, I thought this was because the frame was already set by a "constant" value from geometry. So, I thought I would flip the order of when I ignore the safe area and when I set the frame. This only resulted in a much weirder configuration. At first, the view does take up the entire screen. However, when I change the device to another orientation, the view stays the original height and width it was without updating, despite using What is happening here? I am certain this is valid behavior, but I don't understand why it is and how to fix it. I am trying to make things as simple as possible and thought I would add the frame and safe area options in my main struct, in an attempt to keep that code out of every view. This feels like an easy fix, but I can't figure it out. |
|
Probably all depends on what you have inside your Simple code like below handles everything without a hitch.
|
|
I think it has something to do with ARView. I tested your code and it does indeed work. However, it doesn't seem to work with what I have. I will look into it more, but this is kind of odd. |
|
I found a person with the same issue, but no solution: https://www.reddit.com/r/SwiftUI/comments/j5s7tn/how_to_make_arview_fullscreen_uiviewrepresentable/ |
|
|
|
@NigelGee I think my situation using |
|
|
SPONSORED Alex is the iOS & Mac developer’s ultimate AI assistant. It integrates with Xcode, offering a best-in-class Swift coding agent. Generate modern SwiftUI from images. Fast-apply suggestions from Claude 3.5 Sonnet, o3-mini, and DeepSeek R1. Autofix Swift 6 errors and warnings. And so much more. Start your 7-day free trial today!
Sponsor Hacking with Swift and reach the world's largest Swift community!
This topic has been closed due to inactivity, so you can't reply. Please create a new topic if you need to.
All interactions here are governed by our code of conduct.
Link copied to your pasteboard.