A utility library for getting system info, meant to provide a safe and straightforward way of accessing system information only available through C APIs.
I’ve used this library when making the criollo.io website in order to display the system the app is running on and various other projects over the years.
Add the package to your project's dependencies. If you have a Package.swift
, it should look similar to this:
dependencies: [
.package(name: "CSSystemInfoHelper", url: "https://github.com/thecatalinstan/CSSystemInfoHelper", from: "2.0.0"),
]
Install using CocoaPods by adding this line to your Podfile
:
use_frameworks!
target 'MyApp' do
pod 'CSSystemInfoHelper', '~> 2.0'
end
import CSSystemInfoHelper
print("\(CSSystemInfoHelper.shared.systemInfo.string)"
let networkInterfaces = CSSystemInfoHelper.shared.networkInterfaces!
for nif in networkInterfaces {
print("\(nif.name): \(nif.address) (\(nif.familyName))")
}
let systemInfo = h.systemInfo!
print(systemInfo.string)
print(systemInfo.versionString)
print(CSSystemInfoHelper.shared.memoryUsageString)
print(CSSystemInfoHelper.shared.memoryPhysicalFootprintString)
print(CSSystemInfoHelper.shared.platformUUID)
Check out the complete documentation on CocoaDocs.