From ea59a771c06bb9d8b6d8f6447894da3b71ca14ca Mon Sep 17 00:00:00 2001 From: Khoa Pham Date: Fri, 2 Jun 2017 11:30:39 +0200 Subject: [PATCH] Remove all base64 methods --- Source/Shared/Extensions/String+Cache.swift | 16 ---------------- Source/Shared/Storage/DiskStorage.swift | 2 +- .../iOS/Specs/Extensions/String+CacheSpec.swift | 14 -------------- 3 files changed, 1 insertion(+), 31 deletions(-) diff --git a/Source/Shared/Extensions/String+Cache.swift b/Source/Shared/Extensions/String+Cache.swift index a3a5a3d..4757dcf 100644 --- a/Source/Shared/Extensions/String+Cache.swift +++ b/Source/Shared/Extensions/String+Cache.swift @@ -29,19 +29,3 @@ extension String: Cachable { return data(using: String.Encoding.utf8) } } - -// MARK: - Helpers - -/** - Helper String extension. - */ -extension String { - /** - Creates base64 string - - Returns: A base64 encoded string - */ - func base64() -> String { - guard let data = self.data(using: String.Encoding.utf8) else { return self } - return data.base64EncodedString(options: NSData.Base64EncodingOptions(rawValue: 0)) - } -} diff --git a/Source/Shared/Storage/DiskStorage.swift b/Source/Shared/Storage/DiskStorage.swift index a992215..17fe303 100644 --- a/Source/Shared/Storage/DiskStorage.swift +++ b/Source/Shared/Storage/DiskStorage.swift @@ -304,7 +304,7 @@ public final class DiskStorage: StorageAware { /** Builds file name from the key. - Parameter key: Unique key to identify the object in the cache - - Returns: A md5 or base64 string + - Returns: A md5 string */ func fileName(_ key: String) -> String { return MD5(key) diff --git a/Tests/iOS/Specs/Extensions/String+CacheSpec.swift b/Tests/iOS/Specs/Extensions/String+CacheSpec.swift index 4e34fb0..737cead 100644 --- a/Tests/iOS/Specs/Extensions/String+CacheSpec.swift +++ b/Tests/iOS/Specs/Extensions/String+CacheSpec.swift @@ -7,20 +7,6 @@ class StringCacheSpec: QuickSpec { override func spec() { describe("String+Cache") { - describe("#base64") { - it("returns the correct base64 string") { - let items = [ - "John Snow": "Sm9obiBTbm93", - "You know nothing": "WW91IGtub3cgbm90aGluZw==", - "Night's Watch": "TmlnaHQncyBXYXRjaA==" - ] - - for (key, value) in items { - expect(key.base64()).to(equal(value)) - } - } - } - describe("Cachable") { describe(".decode") {