Skip to content

Commit

Permalink
Merge pull request #96 from JanGorman/SPM
Browse files Browse the repository at this point in the history
SPM
  • Loading branch information
JanGorman authored Nov 26, 2019
2 parents 014d110 + b247d97 commit eaecb08
Show file tree
Hide file tree
Showing 11 changed files with 37 additions and 43 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,7 @@ DerivedData/
.DS_Store

# End of https://www.gitignore.io/api/Xcode,Carthage

.build/
.swiftpm/

4 changes: 0 additions & 4 deletions MapleBacon.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -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 */; };
Expand Down Expand Up @@ -61,7 +60,6 @@
77B73D541F553A8700874885 /* MapleBaconCacheTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MapleBaconCacheTests.swift; sourceTree = "<group>"; };
77B73D561F553A8700874885 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
77B73D601F553AE800874885 /* MapleBaconCache.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MapleBaconCache.swift; sourceTree = "<group>"; };
77B73D651F553F4800874885 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
77CA13101FA233260017C949 /* ImageTransformer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ImageTransformer.swift; sourceTree = "<group>"; };
77CA13141FA2391B0017C949 /* ImageTransformerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ImageTransformerTests.swift; sourceTree = "<group>"; };
F26EECAD21BD9A4500454B3E /* Nimble.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Nimble.framework; path = Carthage/Build/iOS/Nimble.framework; sourceTree = "<group>"; };
Expand Down Expand Up @@ -153,7 +151,6 @@
77B73D531F553A8700874885 /* MapleBaconTests */ = {
isa = PBXGroup;
children = (
77B73D651F553F4800874885 /* Assets.xcassets */,
777691581F5C238F00BCDFF9 /* DownloaderTests.swift */,
77CA13141FA2391B0017C949 /* ImageTransformerTests.swift */,
77B73D561F553A8700874885 /* Info.plist */,
Expand Down Expand Up @@ -281,7 +278,6 @@
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
77B73D661F553F4800874885 /* Assets.xcassets in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down
2 changes: 1 addition & 1 deletion MapleBacon/Core/DiskCache.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Copyright © 2019 Jan Gorman. All rights reserved.
//

import Foundation
import UIKit

final class DiskCache {

Expand Down
6 changes: 0 additions & 6 deletions MapleBaconTests/Assets.xcassets/Contents.json

This file was deleted.

21 changes: 0 additions & 21 deletions MapleBaconTests/Assets.xcassets/MapleBacon.imageset/Contents.json

This file was deleted.

Binary file not shown.
2 changes: 1 addition & 1 deletion MapleBaconTests/DownloaderTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
Expand Down
2 changes: 1 addition & 1 deletion MapleBaconTests/MapleBaconTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}

Expand Down
12 changes: 6 additions & 6 deletions MapleBaconTests/TestHelper.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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()!
}

}

Expand Down
19 changes: 19 additions & 0 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -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")
]
)
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)

<p align="center"><img src="https://www.dropbox.com/s/mlquw9k6ogvspox/MapleBacon.png?raw=1" height="210"/></p>

Expand All @@ -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
Expand Down

0 comments on commit eaecb08

Please sign in to comment.