diff --git a/.gitignore b/.gitignore index ea285cc..500efe8 100644 --- a/.gitignore +++ b/.gitignore @@ -46,3 +46,7 @@ DerivedData/ .DS_Store # End of https://www.gitignore.io/api/Xcode,Carthage + +.build/ +.swiftpm/ + diff --git a/MapleBacon.xcodeproj/project.pbxproj b/MapleBacon.xcodeproj/project.pbxproj index 89ab11a..3e1550f 100644 --- a/MapleBacon.xcodeproj/project.pbxproj +++ b/MapleBacon.xcodeproj/project.pbxproj @@ -21,7 +21,6 @@ 77B73D551F553A8700874885 /* MapleBaconCacheTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 77B73D541F553A8700874885 /* MapleBaconCacheTests.swift */; }; 77B73D571F553A8700874885 /* MapleBacon.h in Headers */ = {isa = PBXBuildFile; fileRef = 77B73D491F553A8700874885 /* MapleBacon.h */; settings = {ATTRIBUTES = (Public, ); }; }; 77B73D611F553AE800874885 /* MapleBaconCache.swift in Sources */ = {isa = PBXBuildFile; fileRef = 77B73D601F553AE800874885 /* MapleBaconCache.swift */; }; - 77B73D661F553F4800874885 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 77B73D651F553F4800874885 /* Assets.xcassets */; }; 77CA13111FA233260017C949 /* ImageTransformer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 77CA13101FA233260017C949 /* ImageTransformer.swift */; }; 77CA13151FA2391B0017C949 /* ImageTransformerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 77CA13141FA2391B0017C949 /* ImageTransformerTests.swift */; }; F26EECAE21BD9A4500454B3E /* Nimble.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F26EECAD21BD9A4500454B3E /* Nimble.framework */; }; @@ -61,7 +60,6 @@ 77B73D541F553A8700874885 /* MapleBaconCacheTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MapleBaconCacheTests.swift; sourceTree = ""; }; 77B73D561F553A8700874885 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 77B73D601F553AE800874885 /* MapleBaconCache.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MapleBaconCache.swift; sourceTree = ""; }; - 77B73D651F553F4800874885 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 77CA13101FA233260017C949 /* ImageTransformer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ImageTransformer.swift; sourceTree = ""; }; 77CA13141FA2391B0017C949 /* ImageTransformerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ImageTransformerTests.swift; sourceTree = ""; }; F26EECAD21BD9A4500454B3E /* Nimble.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Nimble.framework; path = Carthage/Build/iOS/Nimble.framework; sourceTree = ""; }; @@ -153,7 +151,6 @@ 77B73D531F553A8700874885 /* MapleBaconTests */ = { isa = PBXGroup; children = ( - 77B73D651F553F4800874885 /* Assets.xcassets */, 777691581F5C238F00BCDFF9 /* DownloaderTests.swift */, 77CA13141FA2391B0017C949 /* ImageTransformerTests.swift */, 77B73D561F553A8700874885 /* Info.plist */, @@ -281,7 +278,6 @@ isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( - 77B73D661F553F4800874885 /* Assets.xcassets in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/MapleBacon/Core/DiskCache.swift b/MapleBacon/Core/DiskCache.swift index 23be80e..9d7a8fd 100644 --- a/MapleBacon/Core/DiskCache.swift +++ b/MapleBacon/Core/DiskCache.swift @@ -2,7 +2,7 @@ // Copyright © 2019 Jan Gorman. All rights reserved. // -import Foundation +import UIKit final class DiskCache { diff --git a/MapleBaconTests/Assets.xcassets/Contents.json b/MapleBaconTests/Assets.xcassets/Contents.json deleted file mode 100644 index da4a164..0000000 --- a/MapleBaconTests/Assets.xcassets/Contents.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/MapleBaconTests/Assets.xcassets/MapleBacon.imageset/Contents.json b/MapleBaconTests/Assets.xcassets/MapleBacon.imageset/Contents.json deleted file mode 100644 index 57906c2..0000000 --- a/MapleBaconTests/Assets.xcassets/MapleBacon.imageset/Contents.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "images" : [ - { - "idiom" : "universal", - "filename" : "MapleBacon.png", - "scale" : "1x" - }, - { - "idiom" : "universal", - "scale" : "2x" - }, - { - "idiom" : "universal", - "scale" : "3x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/MapleBaconTests/Assets.xcassets/MapleBacon.imageset/MapleBacon.png b/MapleBaconTests/Assets.xcassets/MapleBacon.imageset/MapleBacon.png deleted file mode 100644 index d1ae94c..0000000 Binary files a/MapleBaconTests/Assets.xcassets/MapleBacon.imageset/MapleBacon.png and /dev/null differ diff --git a/MapleBaconTests/DownloaderTests.swift b/MapleBaconTests/DownloaderTests.swift index 763e144..6070916 100644 --- a/MapleBaconTests/DownloaderTests.swift +++ b/MapleBaconTests/DownloaderTests.swift @@ -19,7 +19,7 @@ final class DownloaderTests: XCTestCase { override func setUp() { MockURLProtocol.requestHandler = { request in - return (HTTPURLResponse(), self.helper.imageResponseData()) + return (HTTPURLResponse(), self.helper.imageData) } super.setUp() } diff --git a/MapleBaconTests/MapleBaconTests.swift b/MapleBaconTests/MapleBaconTests.swift index 2e23900..e2ef654 100644 --- a/MapleBaconTests/MapleBaconTests.swift +++ b/MapleBaconTests/MapleBaconTests.swift @@ -33,7 +33,7 @@ final class MapleBaconTests: XCTestCase { override func setUp() { super.setUp() MockURLProtocol.requestHandler = { request in - return (HTTPURLResponse(), self.helper.imageResponseData()) + return (HTTPURLResponse(), self.helper.imageData) } } diff --git a/MapleBaconTests/TestHelper.swift b/MapleBaconTests/TestHelper.swift index 953ad4b..146ed0a 100644 --- a/MapleBaconTests/TestHelper.swift +++ b/MapleBaconTests/TestHelper.swift @@ -10,19 +10,19 @@ protocol CallCounting { } -final class TestHelper { +struct TestHelper { var image: UIImage { - UIImage(named: "MapleBacon", in: Bundle(for: type(of: self).self), compatibleWith: nil)! + let renderer = UIGraphicsImageRenderer(size: .init(width: 10, height: 10)) + return renderer.image { context in + UIColor.black.setFill() + context.fill(renderer.format.bounds) + } } var imageData: Data { image.pngData()! } - - func imageResponseData() -> Data { - image.pngData()! - } } diff --git a/Package.swift b/Package.swift new file mode 100644 index 0000000..4b566aa --- /dev/null +++ b/Package.swift @@ -0,0 +1,19 @@ +// swift-tools-version:5.1 +// The swift-tools-version declares the minimum version of Swift required to build this package. + +import PackageDescription + +let package = Package( + name: "MapleBacon", + platforms: [ + .iOS(.v10) + ], + products: [ + .library(name: "MapleBacon", + targets: ["MapleBacon"]) + ], + targets: [ + .target(name: "MapleBacon", + path: "MapleBacon") + ] +) diff --git a/README.md b/README.md index f34572e..4c3bace 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,7 @@ [![License](https://img.shields.io/cocoapods/l/MapleBacon.svg?style=flat)](http://cocoapods.org/pods/MapleBacon) [![Platform](https://img.shields.io/cocoapods/p/MapleBacon.svg?style=flat)](http://cocoapods.org/pods/MapleBacon) [![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage) +[![SPM](https://img.shields.io/badge/spm-compatible-brightgreen.svg?style=flat)](https://swift.org/package-manager)

@@ -21,19 +22,20 @@ The folder `Example` contains a sample projects for you to try. ## Installation -MapleBacon is available through [CocoaPods](http://cocoapods.org). To install -it, simply add the following line to your Podfile: +MapleBacon is available through [CocoaPods](http://cocoapods.org). To install add it to your Podfile: ```ruby pod "MapleBacon" ``` -As well as [Carthage](https://github.com/Carthage/Carthage) / [punic](https://github.com/schwa/punic): +[Carthage](https://github.com/Carthage/Carthage) / [punic](https://github.com/schwa/punic): ```ogdl github "JanGorman/MapleBacon" ``` +and [Swift Package Manager](https://swift.org/package-manager). + ## Usage ### UIImageView