1

I am creating a folder programatically using swift language. Creating a folder follows the below code:

var error: NSError?

var homeDirectory = NSHomeDirectory()
var dataPath = homeDirectory.stringByAppendingPathComponent("MyFolder")

if (!NSFileManager.defaultManager().fileExistsAtPath(dataPath)) {
    NSFileManager.defaultManager().createDirectoryAtPath(dataPath, withIntermediateDirectories: false, attributes: nil, error: &error)
}

My intention of doing now is whenever the folder changes (add/delete a file) , then i should be notified and automatically it should link up to my server i.e., when user adds a file in that folder, that should be uploaded to my api server. As i went through with Grand Central Dispatch (GCD) to overcome with this. But i din't find a better option.

Please help

Yashwanth Babu
  • 919
  • 9
  • 30

0 Answers0