Skip to content

Commit

Permalink
Xcode 12 updates
Browse files Browse the repository at this point in the history
  • Loading branch information
JanGorman committed Sep 29, 2020
1 parent ae226f4 commit 68060f9
Show file tree
Hide file tree
Showing 15 changed files with 132 additions and 159 deletions.
4 changes: 3 additions & 1 deletion Example/MapleBacon Example.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 1140;
LastUpgradeCheck = 1140;
LastUpgradeCheck = 1200;
ORGANIZATIONNAME = Schnaub;
TargetAttributes = {
F29D617C240595BA00E85F11 = {
Expand Down Expand Up @@ -305,6 +305,7 @@
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
Expand Down Expand Up @@ -365,6 +366,7 @@
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1130"
LastUpgradeVersion = "1200"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
4 changes: 2 additions & 2 deletions Example/MapleBacon Example/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import UIKit

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
@main
final class AppDelegate: UIResponder, UIApplicationDelegate {

}
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ private class SepiaImageTransformer: ImageTransforming {
let context = CIContext()
guard let outputImage = filter.outputImage,
let cgImage = context.createCGImage(outputImage, from: outputImage.extent) else {
return image
return image
}

return UIImage(cgImage: cgImage)
Expand Down
2 changes: 1 addition & 1 deletion Example/MapleBacon Example/SceneDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import UIKit

class SceneDelegate: UIResponder, UIWindowSceneDelegate {
final class SceneDelegate: UIResponder, UIWindowSceneDelegate {

var window: UIWindow?

Expand Down
4 changes: 2 additions & 2 deletions MapleBacon.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'MapleBacon'
s.version = '6.1.0'
s.version = '6.1.1'
s.swift_version = '5.1'
s.summary = 'A lightweight and fast image downloading library iOS.'

Expand All @@ -15,7 +15,7 @@ Pod::Spec.new do |s|
tag: s.version.to_s }
s.social_media_url = 'https://twitter.com/JanGorman'

s.ios.deployment_target = '10.0'
s.ios.deployment_target = '12.0'

s.source_files = 'MapleBacon/**/*.swift'
end
16 changes: 9 additions & 7 deletions MapleBacon.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
F27CBA1C2402CC28006CD529 /* CacheResult.swift in Sources */ = {isa = PBXBuildFile; fileRef = F27CBA1B2402CC28006CD529 /* CacheResult.swift */; };
F27CBA1E2402D9A8006CD529 /* Downloader.swift in Sources */ = {isa = PBXBuildFile; fileRef = F27CBA1D2402D9A8006CD529 /* Downloader.swift */; };
F27CBA222402DC0B006CD529 /* DownloaderTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = F27CBA212402DC0B006CD529 /* DownloaderTests.swift */; };
F27CBA242402DC34006CD529 /* MockURLProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = F27CBA232402DC34006CD529 /* MockURLProtocol.swift */; };
F27CBA242402DC34006CD529 /* MockURLSessionConfiguration.swift in Sources */ = {isa = PBXBuildFile; fileRef = F27CBA232402DC34006CD529 /* MockURLSessionConfiguration.swift */; };
F2EEE583240BBC2E0002C9CA /* ImageTransforming.swift in Sources */ = {isa = PBXBuildFile; fileRef = F2EEE582240BBC2E0002C9CA /* ImageTransforming.swift */; };
F2EEE587240BBE040002C9CA /* ImageTransformingTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = F2EEE586240BBE040002C9CA /* ImageTransformingTests.swift */; };
F2EEE589240BBEF90002C9CA /* DownsamplingImageTransformer.swift in Sources */ = {isa = PBXBuildFile; fileRef = F2EEE588240BBEF90002C9CA /* DownsamplingImageTransformer.swift */; };
Expand Down Expand Up @@ -73,7 +73,7 @@
F27CBA1B2402CC28006CD529 /* CacheResult.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CacheResult.swift; sourceTree = "<group>"; };
F27CBA1D2402D9A8006CD529 /* Downloader.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Downloader.swift; sourceTree = "<group>"; };
F27CBA212402DC0B006CD529 /* DownloaderTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DownloaderTests.swift; sourceTree = "<group>"; };
F27CBA232402DC34006CD529 /* MockURLProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MockURLProtocol.swift; sourceTree = "<group>"; };
F27CBA232402DC34006CD529 /* MockURLSessionConfiguration.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MockURLSessionConfiguration.swift; sourceTree = "<group>"; };
F2EEE582240BBC2E0002C9CA /* ImageTransforming.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ImageTransforming.swift; sourceTree = "<group>"; };
F2EEE586240BBE040002C9CA /* ImageTransformingTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ImageTransformingTests.swift; sourceTree = "<group>"; };
F2EEE588240BBEF90002C9CA /* DownsamplingImageTransformer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DownsamplingImageTransformer.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -153,7 +153,7 @@
F247A24E23FF15410083DB03 /* Info.plist */,
F2255E23240462D800193742 /* MapleBaconTests.swift */,
F247A25B23FF163F0083DB03 /* MemoryCacheTests.swift */,
F27CBA232402DC34006CD529 /* MockURLProtocol.swift */,
F27CBA232402DC34006CD529 /* MockURLSessionConfiguration.swift */,
F27CBA112402B33E006CD529 /* TestHelpers.swift */,
);
path = MapleBaconTests;
Expand Down Expand Up @@ -244,7 +244,7 @@
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 1130;
LastUpgradeCheck = 1130;
LastUpgradeCheck = 1200;
ORGANIZATIONNAME = Schnaub;
TargetAttributes = {
F247A23D23FF15410083DB03 = {
Expand Down Expand Up @@ -326,7 +326,7 @@
F247A25C23FF163F0083DB03 /* MemoryCacheTests.swift in Sources */,
F2255E24240462D800193742 /* MapleBaconTests.swift in Sources */,
F247A26023FF19300083DB03 /* DiskCacheTests.swift in Sources */,
F27CBA242402DC34006CD529 /* MockURLProtocol.swift in Sources */,
F27CBA242402DC34006CD529 /* MockURLSessionConfiguration.swift in Sources */,
F27CBA102402B2F0006CD529 /* CacheTests.swift in Sources */,
F27CBA122402B33E006CD529 /* TestHelpers.swift in Sources */,
F2EEE587240BBE040002C9CA /* ImageTransformingTests.swift in Sources */,
Expand Down Expand Up @@ -370,6 +370,7 @@
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
Expand All @@ -395,7 +396,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES;
ONLY_ACTIVE_ARCH = YES;
Expand Down Expand Up @@ -433,6 +434,7 @@
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
Expand All @@ -452,7 +454,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
MTL_ENABLE_DEBUG_INFO = NO;
MTL_FAST_MATH = YES;
SDKROOT = iphoneos;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1140"
LastUpgradeVersion = "1200"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
30 changes: 10 additions & 20 deletions MapleBaconTests/CacheTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,18 @@ final class CacheTests: XCTestCase {

private let cache = Cache<Data>(name: CacheTests.cacheName)

override func tearDownWithError() throws {
cache.clear(.all)
}

func testStorage() {
let expectation = self.expectation(description: #function)

let data = dummyData()

cache.store(value: data, forKey: #function) { error in
XCTAssertNil(error)
self.cache.clear(.all) { _ in
expectation.fulfill()
}
expectation.fulfill()
}

waitForExpectations(timeout: 5, handler: nil)
Expand All @@ -40,9 +42,7 @@ final class CacheTests: XCTestCase {
case .failure:
XCTFail()
}
self.cache.clear(.all) { _ in
expectation.fulfill()
}
expectation.fulfill()
}
}

Expand All @@ -64,9 +64,7 @@ final class CacheTests: XCTestCase {
case .failure(let error):
XCTAssertNotNil(error)
}
self.cache.clear(.all) { _ in
expectation.fulfill()
}
expectation.fulfill()
}
}

Expand All @@ -89,9 +87,7 @@ final class CacheTests: XCTestCase {
case .failure:
XCTFail()
}
self.cache.clear(.all) { _ in
expectation.fulfill()
}
expectation.fulfill()
}
}

Expand All @@ -117,10 +113,7 @@ final class CacheTests: XCTestCase {
XCTFail()
}
}

self.cache.clear(.all) { _ in
expectation.fulfill()
}
expectation.fulfill()
}
}

Expand All @@ -137,10 +130,7 @@ final class CacheTests: XCTestCase {

self.cache.clear(.memory) { _ in
XCTAssertTrue(try! self.cache.isCached(forKey: #function))

self.cache.clear(.all) { _ in
expectation.fulfill()
}
expectation.fulfill()
}
}

Expand Down
38 changes: 14 additions & 24 deletions MapleBaconTests/DiskCacheTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,39 +7,37 @@ import XCTest

final class DiskCacheTests: XCTestCase {

private static let cacheName = "DiskCacheTests"
private let cache = DiskCache(name: "DiskCacheTests")

override func tearDownWithError() throws {
cache.clear()
}

func testWrite() {
let expectation = self.expectation(description: #function)
let cache = DiskCache(name: Self.cacheName)

cache.insert(dummyData(), forKey: "test") { error in
XCTAssertNil(error)
cache.clear { _ in
expectation.fulfill()
}
expectation.fulfill()
}

waitForExpectations(timeout: 5, handler: nil)
}

func testReadWrite() {
let expectation = self.expectation(description: #function)
let cache = DiskCache(name: Self.cacheName)
let key = "test"
let data = dummyData()

cache.insert(data, forKey: key) { _ in
cache.value(forKey: key) { result in
self.cache.value(forKey: key) { result in
switch result {
case .success(let cacheData):
XCTAssertEqual(cacheData, data)
case .failure:
XCTFail()
}
cache.clear { _ in
expectation.fulfill()
}
expectation.fulfill()
}
}

Expand All @@ -48,7 +46,6 @@ final class DiskCacheTests: XCTestCase {

func testReadInvalid() {
let expectation = self.expectation(description: #function)
let cache = DiskCache(name: Self.cacheName)

cache.value(forKey: #function) { result in
switch result {
Expand All @@ -65,7 +62,6 @@ final class DiskCacheTests: XCTestCase {

func testClear() {
let expectation = self.expectation(description: #function)
let cache = DiskCache(name: Self.cacheName)

cache.clear { error in
XCTAssertNil(error)
Expand All @@ -77,24 +73,21 @@ final class DiskCacheTests: XCTestCase {

func testClearExpired() {
let expectation = self.expectation(description: #function)
let cache = DiskCache(name: Self.cacheName)
cache.maxCacheAgeSeconds = 0.seconds

cache.insert(dummyData(), forKey: "test") { _ in
// Tests that setting maxCacheAgeSeconds does work
let expired = try! cache.expiredFileURLs()
let expired = try! self.cache.expiredFileURLs()
XCTAssertFalse(expired.isEmpty)

cache.clearExpired { error in
self.cache.clearExpired { error in
XCTAssertNil(error)

// After clearing expired files, there should be no further expired URLs
let expired = try! cache.expiredFileURLs()
let expired = try! self.cache.expiredFileURLs()
XCTAssertTrue(expired.isEmpty)

cache.clear { _ in
expectation.fulfill()
}
expectation.fulfill()
}
}

Expand All @@ -103,13 +96,10 @@ final class DiskCacheTests: XCTestCase {

func testIsCached() {
let expectation = self.expectation(description: #function)
let cache = DiskCache(name: Self.cacheName)

cache.insert(dummyData(), forKey: "test") { _ in
XCTAssertTrue(try! cache.isCached(forKey: "test"))
cache.clear { _ in
expectation.fulfill()
}
XCTAssertTrue(try! self.cache.isCached(forKey: "test"))
expectation.fulfill()
}

waitForExpectations(timeout: 5, handler: nil)
Expand Down
Loading

0 comments on commit 68060f9

Please sign in to comment.