Get Device Total Storage Capacity

I’m trying to get a device’s total disk space but iOS foundation objects are not available via java or Kotlin, examples NSHomeDirectory(), FileAttributeKey are just a few which i need to get a device total storage capacity. Here is swift code that accomplishes what I need.

class var totalDiskSpaceInBytes:Int64 {
        get {
            do {
                let systemAttributes = try FileManager.default.attributesOfFileSystem(forPath: NSHomeDirectory() as String)
                let space = (systemAttributes[FileAttributeKey.systemSize] as? NSNumber)?.int64Value
                return space!
            } catch {
                return 0
            }
        }
    }

How can I accomplish that in java or kotlin?

You can use the apple.foundation.c.Foundation class for all of these constants. So Foundation.NSHomeDirectory and Foundation.NSFileSystemSize.

Awesome! Thank you so much, that did the trick.