aboutsummaryrefslogtreecommitdiffstats
path: root/WireGuard/WireGuard/ZipArchive/ZipImporter.swift
diff options
context:
space:
mode:
authorEric Kuck <eric@bluelinelabs.com>2018-12-12 11:40:57 -0600
committerEric Kuck <eric@bluelinelabs.com>2018-12-12 11:40:57 -0600
commitde14b76b4d99f74d52b6e404b2ab37394fa5b9dc (patch)
tree0d6e1efbf855bb4995b22e6c55ab8ab2f08e8f24 /WireGuard/WireGuard/ZipArchive/ZipImporter.swift
parentZip importing: importFromFile should take a completionHandler (diff)
downloadwireguard-apple-de14b76b4d99f74d52b6e404b2ab37394fa5b9dc.tar.xz
wireguard-apple-de14b76b4d99f74d52b6e404b2ab37394fa5b9dc.zip
Added swiftlint and fixed all errors (and a bunch, but not all, warnings)
Signed-off-by: Eric Kuck <eric@bluelinelabs.com>
Diffstat (limited to 'WireGuard/WireGuard/ZipArchive/ZipImporter.swift')
-rw-r--r--WireGuard/WireGuard/ZipArchive/ZipImporter.swift12
1 files changed, 6 insertions, 6 deletions
diff --git a/WireGuard/WireGuard/ZipArchive/ZipImporter.swift b/WireGuard/WireGuard/ZipArchive/ZipImporter.swift
index 6c1e3de2..194dc0ec 100644
--- a/WireGuard/WireGuard/ZipArchive/ZipImporter.swift
+++ b/WireGuard/WireGuard/ZipArchive/ZipImporter.swift
@@ -20,13 +20,13 @@ class ZipImporter {
var unarchivedFiles: [(fileBaseName: String, contents: Data)]
do {
unarchivedFiles = try ZipArchive.unarchive(url: url, requiredFileExtensions: ["conf"])
- for (i, unarchivedFile) in unarchivedFiles.enumerated().reversed() {
+ for (index, unarchivedFile) in unarchivedFiles.enumerated().reversed() {
let fileBaseName = unarchivedFile.fileBaseName
let trimmedName = fileBaseName.trimmingCharacters(in: .whitespacesAndNewlines)
if (!trimmedName.isEmpty) {
- unarchivedFiles[i].fileBaseName = trimmedName
+ unarchivedFiles[index].fileBaseName = trimmedName
} else {
- unarchivedFiles.remove(at: i)
+ unarchivedFiles.remove(at: index)
}
}
@@ -42,8 +42,8 @@ class ZipImporter {
unarchivedFiles.sort { $0.fileBaseName < $1.fileBaseName }
var configs = Array<TunnelConfiguration?>(repeating: nil, count: unarchivedFiles.count)
- for (i, file) in unarchivedFiles.enumerated() {
- if (i > 0 && file == unarchivedFiles[i - 1]) {
+ for (index, file) in unarchivedFiles.enumerated() {
+ if (index > 0 && file == unarchivedFiles[index - 1]) {
continue
}
guard let fileContents = String(data: file.contents, encoding: .utf8) else {
@@ -52,7 +52,7 @@ class ZipImporter {
guard let tunnelConfig = try? WgQuickConfigFileParser.parse(fileContents, name: file.fileBaseName) else {
continue
}
- configs[i] = tunnelConfig
+ configs[index] = tunnelConfig
}
DispatchQueue.main.async { completion(.success(configs)) }
}