diff options
author | Eric Kuck <eric@bluelinelabs.com> | 2018-12-12 12:28:27 -0600 |
---|---|---|
committer | Eric Kuck <eric@bluelinelabs.com> | 2018-12-12 12:28:27 -0600 |
commit | d06cff2a360839c67ce42a695f01bb933ba820c0 (patch) | |
tree | 3aa166de8c75947345b9bfb8398ee8b7c6b581c7 /WireGuard/WireGuard/ZipArchive/ZipImporter.swift | |
parent | Added swiftlint and fixed all errors (and a bunch, but not all, warnings) (diff) | |
download | wireguard-apple-d06cff2a360839c67ce42a695f01bb933ba820c0.tar.xz wireguard-apple-d06cff2a360839c67ce42a695f01bb933ba820c0.zip |
Tons more swiftlint warnings fixed. Still a few remaining.
Signed-off-by: Eric Kuck <eric@bluelinelabs.com>
Diffstat (limited to 'WireGuard/WireGuard/ZipArchive/ZipImporter.swift')
-rw-r--r-- | WireGuard/WireGuard/ZipArchive/ZipImporter.swift | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/WireGuard/WireGuard/ZipArchive/ZipImporter.swift b/WireGuard/WireGuard/ZipArchive/ZipImporter.swift index 194dc0e..e2767f2 100644 --- a/WireGuard/WireGuard/ZipArchive/ZipImporter.swift +++ b/WireGuard/WireGuard/ZipArchive/ZipImporter.swift @@ -7,7 +7,7 @@ enum ZipImporterError: WireGuardAppError { case noTunnelsInZipArchive func alertText() -> (String, String)? { - switch (self) { + switch self { case .noTunnelsInZipArchive: return ("No tunnels in zip archive", "No .conf tunnel files were found inside the zip archive.") } @@ -23,17 +23,17 @@ class ZipImporter { for (index, unarchivedFile) in unarchivedFiles.enumerated().reversed() { let fileBaseName = unarchivedFile.fileBaseName let trimmedName = fileBaseName.trimmingCharacters(in: .whitespacesAndNewlines) - if (!trimmedName.isEmpty) { + if !trimmedName.isEmpty { unarchivedFiles[index].fileBaseName = trimmedName } else { unarchivedFiles.remove(at: index) } } - if (unarchivedFiles.isEmpty) { + if unarchivedFiles.isEmpty { throw ZipImporterError.noTunnelsInZipArchive } - } catch (let error as WireGuardAppError) { + } catch let error as WireGuardAppError { DispatchQueue.main.async { completion(.failure(error)) } return } catch { @@ -41,9 +41,9 @@ class ZipImporter { } unarchivedFiles.sort { $0.fileBaseName < $1.fileBaseName } - var configs = Array<TunnelConfiguration?>(repeating: nil, count: unarchivedFiles.count) + var configs: [TunnelConfiguration?] = Array(repeating: nil, count: unarchivedFiles.count) for (index, file) in unarchivedFiles.enumerated() { - if (index > 0 && file == unarchivedFiles[index - 1]) { + if index > 0 && file == unarchivedFiles[index - 1] { continue } guard let fileContents = String(data: file.contents, encoding: .utf8) else { |