0

Thanks! I was not able to find much documentation on this online. I appreciate the help.

jnpdx
  • 45,847
  • 6
  • 64
  • 94

1 Answers1

-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
  • 1
    This 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