Thanks! I was not able to find much documentation on this online. I appreciate the help.
Asked
Active
Viewed 76 times
0
-
The key you want from MartinR's answer is `volumeTotalCapacityKey`. – Rob Napier Aug 14 '22 at 21:05
1 Answers
-1
func deviceRemainingFreeSpaceInBytes() -> NSNumber {
let documentDirectoryPath = NSSearchPathForDirectoriesInDomains(.DocumentDirectory, .UserDomainMask, true)
let systemAttributes = NSFileManager.defaultManager().attributesOfFileSystemForPath(documentDirectoryPath.last as String, error: nil)
return systemAttributes[NSFileSystemFreeSize] as NSNumber
}
try this. Hope this helps

Paulw11
- 108,386
- 14
- 159
- 186
-
1This returns the available storage, not the total storage. It also looks like it was copied verbatim from another question. Please do not do that. If the question is a duplicate and there is an answer elsewhere, vote to close the question as a duplicate and link to the previous answer. – Rob Napier Aug 14 '22 at 21:07