Last active
January 4, 2016 14:31
-
-
Save Abizern/634d8a34a9a48f00fa04 to your computer and use it in GitHub Desktop.
NSURL extension for common directory URLs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
/// abstract: Convenience methods for getting standard URLs | |
extension NSURL { | |
/// The URL to the Documents directory | |
static var documentsURL: NSURL { | |
return try! NSFileManager.defaultManager().URLForDirectory(.DocumentDirectory, inDomain: .UserDomainMask, appropriateForURL: nil, create: true) | |
} | |
/// The URL to the caches directory | |
static var cachesURL: NSURL { | |
return try! NSFileManager.defaultManager().URLForDirectory(.CachesDirectory, inDomain: .UserDomainMask, appropriateForURL: nil, create: true) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment