Part of the learning adventure for us is seeing what you tried and failed. It would be great if you shared some of your knowledge and code, letting us learn from your mistakes and success.
What code do you have that doesn't work?
Have you reviewed @twoStraw's lesson on orientation? If you have, let us know. Then share what didn't work for you.
See -> Device Orientation
You may consider adding an alternative view with a simple text box:
Text("Flan App Frog Detector™️ 🐸 does not support landscape. Please reorient your iPhone 17.")
ViewThatFits
You might also check out adaptive views with ViewThatFits
, introduced in iOS 16.
If your user rotates their device, you can add an alternative view to adapt to that unwanted orientation. Perhaps you show part of your data but blurred with an overlay informing the user that landscape isn't supported? Or maybe you show a dancing frog image with instructions to reorient the device. YMMV.
See -> View that Fits