I'm trying to do an activity monitor for MacOS (I know that there is a mac app called activity monitor that tell that) so I want to get the cpu usage percentage with Swift. I found some similar questions but they only work with iOS. I also found a question in Objective-C but not in Swift and I don't understand very well Objective-C (I'm a Swift person).
Asked
Active
Viewed 2,359 times
3
-
You could try to use this to get started https://stackoverflow.com/questions/44744372/get-cpu-usage-ios-swift – Sam Hollenbach Dec 23 '18 at 01:02
-
1@SamHollenbach Thank you but I'm trying to do it for mac, not iOS – oxixes Dec 23 '18 at 01:05
-
Ah I see my mistake. I did find this resource that may be helpful though. https://stackoverflow.com/a/33857707/6685140 – Sam Hollenbach Dec 23 '18 at 01:07
-
2Possible duplicate of [Get CPU percent usage](https://stackoverflow.com/questions/6785069/get-cpu-percent-usage) – Cœur Dec 23 '18 at 01:20
-
1@AdriánQB I added my Swift conversion to the other question, to have it all together: https://stackoverflow.com/a/53901721/1033581 – Cœur Dec 23 '18 at 06:39
-
@Cœur Thank you very much – oxixes Dec 23 '18 at 11:27