Skip to content

shubham230523/AppleCoreSensorKit

Repository files navigation

AppleCoreSensorKit

A lightweight Swift package for accessing low-level system sensor and device metrics, including CPU, memory, thermal state, battery, and hardware performance statistics.

Built for developers who need deeper visibility into Apple device performance beyond standard public APIs.


✨ Features

  • 🌡 Thermal State Monitoring (device & CPU pressure indicators)
  • 🧠 CPU Usage Tracking (real-time system load)
  • 💾 Memory Analytics (used, free, and active memory)
  • 💽 Disk Usage Stats (storage capacity and availability)
  • 🔋 Battery Information (level, state, and health signals)
  • Power & Performance Metrics
  • 📊 Formatted System Reports (human-readable output)

📱 Why AppleCoreSensorKit?

Apple provides limited system-level metrics through public APIs. This library helps bridge that gap by offering:

  • Deep system performance insights
  • Lightweight diagnostic tools for developers
  • Easy integration into monitoring dashboards & utilities
  • A clean, Swift-native API design

🛠 Tech Stack

  • Language: Swift
  • Frameworks: IOKit / Darwin APIs
  • Platform: iOS / macOS
  • Architecture: Modular service-based design
  • Package Manager: Swift Package Manager (SPM)

📦 Installation

Swift Package Manager

Add this repository to your Package.swift:

dependencies: [
    .package(url: "https://github.com/shubham230523/AppleCoreSensorKit.git", from: "1.0.0")
]

Or in Xcode:

File → Add Packages → Paste repo URL

🚀 Usage

import AppleCoreSensorKit

let sensorKit = AppleCoreSensorKit.shared

// 🌡 Thermal State
let thermalState = await sensorKit.getThermalState()

// 🧠 CPU Usage
let cpuUsage = await sensorKit.getCPUUsage()

// 💾 Memory Usage
let memory = await sensorKit.getMemoryStats()

// 💽 Disk Usage
let disk = await sensorKit.getDiskUsage()

// 🔋 Battery Info
let battery = await sensorKit.getBatteryInfo()

print("CPU:", cpuUsage)
print("Memory:", memory)
print("Disk:", disk)

📂 Project Structure

AppleCoreSensorKit/
├── Sources/
│   ├── Core/              # Core sensor engine
│   ├── CPU/               # CPU metrics
│   ├── Memory/            # Memory stats
│   ├── Disk/              # Disk usage
│   ├── Battery/           # Battery info
│   ├── Thermal/           # Thermal monitoring
│   └── Utils/             # Helpers & formatters
├── Tests/
└── Package.swift

⚠️ Important Notes

  • Some metrics rely on low-level system APIs

  • Behavior may vary across iOS/macOS versions

  • Not intended for App Store-sensitive use cases if private APIs are used internally

  • Best suited for:

    • Developer tools
    • System diagnostics apps
    • Performance monitoring dashboards

🎯 Use Cases

  • 📊 System monitoring dashboards
  • 🧪 Performance testing tools
  • 🔍 Debugging & profiling apps
  • ⚙️ Developer utilities
  • 📱 Device health tracking tools

🤝 Contributing

Contributions are welcome!

You can help by:

  • Adding new sensor modules
  • Improving accuracy of metrics
  • Optimizing performance
  • Enhancing documentation

📄 License

MIT License © 2026


⭐ Support

If you find this project useful, please consider giving it a ⭐ on GitHub!

About

A lightweight Swift package for accessing low-level system sensor and device metrics, including CPU, memory, thermal state, battery, and hardware performance statistics.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors