How to get IOS device information
Their is a UIDevice component that is part of UIKit, and SwiftUI that allows us to do all the functionality we will be going over today. I have written a simple SwiftUI app to demonstrate what UIDevice can do. I am sure that it can do a lot more than what I am showing you today, however I hope this will give you an idea on how to get the information you need.
As you can see we can get some useful information from just some simple code. To access this information you have to use UIDevice.current to retrieve any of these values. Some values require you to convert from float to string which is quite simple. Below is a line of code to retrieve the device model just so you can get a feel for how to retrieve device info.
As you can see we can get the device model with a simple line of code, however you can also retrieve the localized model by changing model to localizedModel. Now I will show you the entire code so you can see how I retrieved the entire list shown above.
Some items as you can see require logic such as device orientation, however it isn’t that complicated to create custom actions in your codebase based on device state. You can do this in UIKit and SwiftUI.