Skip to content

Instantly share code, notes, and snippets.

@alxstu
alxstu / filePath.swift
Created March 18, 2016 15:34
filepath for NSKeyedArchiver in swift
import Foundation
func filePath(fileName: String)->String?{
var path: NSString = ""
let urls = NSFileManager.defaultManager().URLsForDirectory( .DocumentDirectory, inDomains: .UserDomainMask)
let url = urls[urls.count-1] as NSURL
if let _path = url.path {
path = _path}
let file = path.stringByAppendingPathComponent(fileName)
return file
}

Keybase proof

I hereby claim:

  • I am alxstu on github.
  • I am alx (https://keybase.io/alx) on keybase.
  • I have a public key whose fingerprint is 6583 8FB2 9E63 CFF9 67AB 3139 27D8 5EE7 5CAF 2E97

To claim this, I am signing this object: