Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Z
Zip
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Jira
Jira
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
YongYue
Zip
Commits
fc037ecd
Commit
fc037ecd
authored
Jan 14, 2016
by
Roy Marmelstein
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adding documentation for unzip
parent
79dfb476
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
3 deletions
+21
-3
Zip/Zip.swift
Zip/Zip.swift
+21
-3
No files found.
Zip/Zip.swift
View file @
fc037ecd
...
@@ -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
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment