Skip to content

Instantly share code, notes, and snippets.

View amayatsky's full-sized avatar

Alexander Mayatsky amayatsky

  • MTS - Mobile TeleSystems PJSC
  • Moscow
View GitHub Profile
@marcprux
marcprux / NSURL+Zip.swift
Created September 22, 2015 17:23
Categories on NSURL and NSData to create a zip archive without any external dependencies
public extension NSURL {
/// Creates a zip archive of the file/folder represented by this URL and returns a references to the zipped file
///
/// - parameter dest: the destination URL; if nil, the destination will be this URL with ".zip" appended
func zip(dest: NSURL? = nil) throws -> NSURL {
let destURL = dest ?? self.URLByAppendingPathExtension("zip")
let fm = NSFileManager.defaultManager()
var isDir: ObjCBool = false