Get CPU usage percentage of single iOS App in Swift 4.x

i0S Swift Issue

The short code below is useful when building a log system for your iOS application with Swift. It displays exactly the percentage of usage on each CPU core of the iOS device.

The function returns the value of CPU usage:

Test results on Xcode 10.1:

Get CPU Usage Percentage Of Single IOS App In Swift 4.X
Get CPU Usage Percentage Of Single IOS App In Swift 4.X