Tuesday, October 2, 2018

Prevent files from being backed up to iCloud and iTunes in Swift 4


    func addSkipBackupAttributeToItemAtURL(url){
        
        do {
            var resourceValues = URLResourceValues()
            resourceValues.isExcludedFromBackup = true
            try url.setResourceValues(resourceValues)
        } catch {
            print(error.localizedDescription)
        }
    

    }

        addSkipBackupAttributeToItemAtURL(url)

       url: file url pass and call when store on desired directory