Check if file is writable


I want to check if file, at a specific location, is writable.


// Create a FileManager instance

let fileManager = NSFileManager.defaultManager()

// Check if file exists, given its path

if fileManager.isWritableFileAtPath("hello.swift") {
    print("File is writable")
} else {
    print("File is read-only")

Heard the news?

The Swift Cookbook for Swift 3 is at last here! For iBooks, Kindle and Paperback.
Hurry up - and Check it out! ;-)