How to get the Total Disk Space and Free Disk space using AttributesOfFileSystemForpaths in swift 2.0
<p>This is the way I use in Objective-C</p>

<pre><code>-(uint64_t)getFreeDiskspace {
float totalSpace = 0;
float totalFreeSpace = 0;
NSError *error = nil;
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSDictionary *dictionary = [[NSFileManager defaultManager] attributesOfFileSystemForPath:[paths lastObject] error: &amp;error];

if (dictionary) {
    NSNumber *fileSystemSizeInBytes = [dictionary objectForKey: NSFileSystemSize];
    NSNumber *freeFileSystemSizeInBytes = [dictionary objectForKey:NSFileSystemFreeSize];
    totalSpace = [fileSystemSizeInBytes floatValue];
    self.totalSpace = [NSString stringWithFormat:@"%.3f GB",totalSpace/(1024*1024*1024)];
    totalFreeSpace = [freeFileSystemSizeInBytes unsignedLongLongValue];
    self.freeSpace = [NSString stringWithFormat:@"%.3f GB",totalFreeSpace/(1024*1024*1024)];

} else {
    LogError(@"Error Obtaining System Memory Info: Domain = %@, Code = %ld", [error domain], (long)[error code]);
}

return totalFreeSpace;
</code></pre>

<p>}</p>

<p>I tried converting it to swift and errors in</p>

<pre><code>if(dictionary)
</code></pre>

<p>and</p>

<pre><code>attributesOfFileSystemForPaths 
</code></pre>

<p>were shown.Can anyone help me in converting this to swift 2.0 ? It would do a world of good to my project. Thank You in Advance.</p>