Saturday 24 June 2017

How to check if a file exists in Documents folder?

let documentsURL = try! FileManager().url(for: .documentDirectory, in: .userDomainMask, appropriateFor: nil, create: true) let fooURL = documentsURL.appendingPathComponent("foo.html") let fileExists = FileManager().fileExists(atPath: fooURL.path) if fileExists==true { print("already existed") } else { print("no file") }

https://stackoverflow.com/questions/1638834/how-to-check-if-a-file-exists-in-documents-folder

No comments:

Post a Comment

Remove bottom line in navigation bar

navigationController ?. navigationBar . setBackgroundImage ( UIImage (), for: . any , barMetrics: . default )          navigat...