Commit fc037ecd authored by Roy Marmelstein's avatar Roy Marmelstein

Adding documentation for unzip

parent 79dfb476
...@@ -9,10 +9,12 @@ ...@@ -9,10 +9,12 @@
import Foundation import Foundation
import minizip import minizip
/// Zip error type
public enum ZipError: ErrorType { public enum ZipError: ErrorType {
case FileNotFound case FileNotFound // File not found
case UnzipError case UnzipError // Unzip error
/// Description variable
public var description: String { public var description: String {
switch self { switch self {
case .FileNotFound: return NSLocalizedString("File not found.", comment: "") case .FileNotFound: return NSLocalizedString("File not found.", comment: "")
...@@ -24,8 +26,24 @@ public enum ZipError: ErrorType { ...@@ -24,8 +26,24 @@ public enum ZipError: ErrorType {
public class Zip { public class Zip {
public init () {} /**
Init
- returns: Zip object
*/
public init () {
}
/**
Unzip file
- parameter path: Path of zipped file. NSURL.
- parameter destination: Path to unzip to. NSURL.
- parameter overwrite: Overwrite bool.
- parameter password: Optional password if file is protected.
- throws: Error if unzipping fails or if fail is not found. Can be printed with a description variable.
*/
public func unzipFile(path: NSURL, destination: NSURL, overwrite: Bool, password: String?) throws { public func unzipFile(path: NSURL, destination: NSURL, overwrite: Bool, password: String?) throws {
// Check file exists at path. // Check file exists at path.
let fileManager = NSFileManager.defaultManager() let fileManager = NSFileManager.defaultManager()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment