How to detect which iOS version is running on the device?

iOSiPhone/iPadMobile Development

When working on iOS applications, we sometimes need to know the version that's running on an iPhone device. In this article we'll learn how to find the iOS version being used, using an iOS Application.

Create an iOS application and in it's viewController's view did load function write the following code.

print(" System version - ",UIDevice.current.systemVersion)

This will return the iOS version of the device currently in use. Like current version of my simulator is iOS 12.0 hence the result comes as

System Version – 12.0
Published on 22-Jan-2019 16:44:22