Claude31, you are a genius, thank you sir.
Post
Replies
Boosts
Views
Activity
Sorry Claude which tutorial?
Thank you Claude31, I have tried that but it won't work on an iMac. I think I have to have a solution using SwiftUI
Thank you darkpaw, but I need this to work on an iMac as well as iOS devices, and "UIDevice" is part of "UIKit" which won't work on OSX. I think I need a SwiftUI solution.
dakkpaw, you are a genius thank you for an excellent answer.
Thank you Quinn, that was most helpful and solved it for me.
I tried this and I think I nearly understood it. In the XCode preview, it worked perfectly but when I ran it in the "Simulator" (iPhone 11 and iPhone 15) I got the following runtime error:
SwiftUI/EnvironmentObject.swift:90: Fatal error: No ObservableObject of type OrientationInfo found. A View.environmentObject(_:) for OrientationInfo may be missing as an ancestor of this view.
This seems to be referring to the line "Text("Orientation is ...."
an
How would I use this lovely and simple solution to detect an orientation change?
Claude31,
I give up it was just too difficult, I think a plain white background will do nicely.
@BabyJ
That worked thank you so much. But now whenever I try to pick up the value envOrient.myOrient in the ContentView the App Crashes. What am I doing wrong now:
I was just trying to use a background image and get it to fit when the user rotates the device. But I have been at it for over a week now, and I can't get it to work, it is far too complicated, so I am just going to go with a plain white background. So thank you for all your help.
@BabyJ It is always the simple solutions that work, Thank you.
@BabyJ , you are a genius, you have come to my rescue once again! Thank you.
Thanks @Claude31, I am not surprised, why would anything do what its documentation says it will?
@AnnArborMark Thanks that seems to have done the job nicely, I have read and re-read the page you suggested, and I am still unsure what the "id:.self" does, but as it works I will just use it as you have suggested.