This PR fixes iOS storage space reporting to match device settings (Issue #12 ).
Current behavior shows incorrect values:
// Current implementation using NSHomeDirectory()
let attributes = try FileManager.default.attributesOfFileSystem(forPath: NSHomeDirectory())
return attributes[FileAttributeKey.systemSize] as! Int64 // Returns ~104GB for 128GB device
Solution
Updated implementation to use proper URLResourceValues.
Test Results
Device: iPhone (128GB)
Before:
Total Space: 104.70 GB (112418697216 bytes)
Free Space: 36.45 GB (39138611200 bytes)
After:
Total Space: 128.00 GB (matches Settings)
Free Space: 44.32 GB (matches Settings)
Changes
✅ Using URLResourceValues for accurate storage information
✅ Proper error handling added
✅ Values now match iOS Settings
Testing Done
Tested on iPhone with 128GB storage
Verified values match Settings app
Tested error scenarios
Verified both total and free space calculations
This PR fixes iOS storage space reporting to match device settings (Issue #12 ).
Current behavior shows incorrect values: