{"id":1255,"date":"2017-10-21T10:22:37","date_gmt":"2017-10-21T01:22:37","guid":{"rendered":"http:\/\/blue-bear.jp\/kb\/?p=1255"},"modified":"2017-10-21T11:23:58","modified_gmt":"2017-10-21T02:23:58","slug":"swift4-how-to-install-ssziparchive-for-un-zip-file-downloaded","status":"publish","type":"post","link":"https:\/\/blue-bear.jp\/kb\/swift4-how-to-install-ssziparchive-for-un-zip-file-downloaded\/","title":{"rendered":"[swift4] How to install SSZipArchive for un-zip file downloaded"},"content":{"rendered":"<p>How to install SSZipArchive for un-zip file downloaded, is below<\/p>\n<p>SSZipArchive is a library for zip\/un-zip files<\/p>\n<p><a href=\"https:\/\/github.com\/ZipArchive\/ZipArchive\">https:\/\/github.com\/ZipArchive\/ZipArchive<\/a><\/p>\n<h2>Create pod file<\/h2>\n<p>after prepare to use pod, move the folder where project located at console<\/p>\n<pre>pod init<\/pre>\n<p>Run above command<\/p>\n<p>Add below red code on Pod file created newly<\/p>\n<pre class=\"\"># Uncomment the next line to define a global platform for your project\r\n# platform :ios, '9.0'\r\n\r\ntarget 'Your Project Name' do\r\n  # Comment the next line if you're not using Swift and don't want to use dynamic frameworks\r\n  use_frameworks!\r\n\r\n  # Pods for textCollection\r\n<span style=\"color: #ff0000;\">  pod 'SSZipArchive'<\/span>\r\n\r\n  target 'textCollectionTests' do\r\n    inherit! :search_paths\r\n    # Pods for testing\r\n  end\r\n\r\n  target 'textCollectionUITests' do\r\n    inherit! :search_paths\r\n    # Pods for testing\r\n  end\r\n\r\nend\r\n<\/pre>\n<p>&nbsp;<\/p>\n<h2>pod Install<\/h2>\n<p>Move the folder where pod file located at console<\/p>\n<pre>pod install<\/pre>\n<p>Run above command<\/p>\n<p>&nbsp;<\/p>\n<h2>Install\/Use SSZipArchive<\/h2>\n<p>After pod install, workspace file created automatically, open this file on xcode<\/p>\n<p>You can zip\/un-zip below code<\/p>\n<pre class=\"\">import SSZipArchive\r\n\r\n\/\/ Create\r\nSSZipArchive.createZipFile(atPath: &lt;#T##String#&gt;, withContentsOfDirectory: &lt;#T##String#&gt;)\r\n\r\n\/\/ Create with password\r\nSSZipArchive.createZipFile(atPath: &lt;#T##String#&gt;, withContentsOfDirectory: &lt;#T##String#&gt;, withPassword: &lt;#T##String?#&gt;)\r\n\r\n\/\/ Unzip\r\nSSZipArchive.unzipFile(atPath: &lt;#T##String#&gt;, toDestination: &lt;#T##String#&gt;)\r\n\r\n\/\/ Unzip with Password\r\ndo {\r\n   try SSZipArchive.unzipFile(atPath: &lt;#T##String#&gt;, toDestination: &lt;#T##String#&gt;, overwrite: &lt;#T##Bool#&gt;, password: &lt;#T##String?#&gt;)\r\n                    \r\n   }catch (let error) {\r\n      print(error)\r\n   }\r\n\r\n\/\/ Unzip and Delete zip file\r\nSSZipArchive.unzipFile(atPath: &lt;#T##String#&gt;, toDestination: &lt;#T##String#&gt;, \r\n    progressHandler: { _,_,_,_ in },\r\n    completionHandler: { _,_,_ in\r\n                    \r\n    try! FileManager.default.removeItem(atPath: &lt;#T##String#&gt;)\r\n                    \r\n})\r\n\r\n<\/pre>\n<p>Value is String<\/p>\n","protected":false},"excerpt":{"rendered":"<p>How to install SSZip<\/p>\n","protected":false},"author":1,"featured_media":88,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[13],"tags":[],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/blue-bear.jp\/kb\/wp-json\/wp\/v2\/posts\/1255"}],"collection":[{"href":"https:\/\/blue-bear.jp\/kb\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blue-bear.jp\/kb\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blue-bear.jp\/kb\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blue-bear.jp\/kb\/wp-json\/wp\/v2\/comments?post=1255"}],"version-history":[{"count":3,"href":"https:\/\/blue-bear.jp\/kb\/wp-json\/wp\/v2\/posts\/1255\/revisions"}],"predecessor-version":[{"id":1258,"href":"https:\/\/blue-bear.jp\/kb\/wp-json\/wp\/v2\/posts\/1255\/revisions\/1258"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blue-bear.jp\/kb\/wp-json\/wp\/v2\/media\/88"}],"wp:attachment":[{"href":"https:\/\/blue-bear.jp\/kb\/wp-json\/wp\/v2\/media?parent=1255"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blue-bear.jp\/kb\/wp-json\/wp\/v2\/categories?post=1255"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blue-bear.jp\/kb\/wp-json\/wp\/v2\/tags?post=1255"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}