Skip to content

Commit

Permalink
Updated project and podspec so all files are compiled on all platforms.
Browse files Browse the repository at this point in the history
  • Loading branch information
cnoon committed Oct 2, 2016
1 parent 3a866ec commit 33c6615
Show file tree
Hide file tree
Showing 10 changed files with 61 additions and 29 deletions.
9 changes: 0 additions & 9 deletions AlamofireImage.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,6 @@ Pod::Spec.new do |s|
s.source = { :git => 'https://github.com/Alamofire/AlamofireImage.git', :tag => s.version }
s.source_files = 'Source/*.swift'

s.osx.exclude_files = [
'Source/UIButton+AlamofireImage.swift',
'Source/UIImage*.swift'
]
s.watchos.exclude_files = [
'Source/UIButton+AlamofireImage.swift',
'Source/UIImageView+AlamofireImage.swift'
]

s.ios.deployment_target = '9.0'
s.osx.deployment_target = '10.11'
s.tvos.deployment_target = '9.0'
Expand Down
20 changes: 20 additions & 0 deletions AlamofireImage.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -468,6 +468,16 @@
4C82907B1B927CE6005E24C8 /* Image.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4C8290791B927CE6005E24C8 /* Image.swift */; };
4C82907C1B927D13005E24C8 /* ImageDownloader.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4C96A4771AAE9488008AE0B6 /* ImageDownloader.swift */; };
4C82907D1B927DA9005E24C8 /* ImageFilter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4CFC0A081AB52BD90004D0B8 /* ImageFilter.swift */; };
4C86C10A1DA0B30D0032ECC3 /* UIButton+AlamofireImage.swift in Sources */ = {isa = PBXBuildFile; fileRef = CF24CF411C253CB100904E85 /* UIButton+AlamofireImage.swift */; };
4C86C10B1DA0B30E0032ECC3 /* UIButton+AlamofireImage.swift in Sources */ = {isa = PBXBuildFile; fileRef = CF24CF411C253CB100904E85 /* UIButton+AlamofireImage.swift */; };
4C86C10C1DA0B3110032ECC3 /* UIImage+AlamofireImage.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4C53084F1AB561BF0051DBAC /* UIImage+AlamofireImage.swift */; };
4C86C10D1DA0B3150032ECC3 /* UIImageView+AlamofireImage.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4C78EA711AACD28C002C0569 /* UIImageView+AlamofireImage.swift */; };
4C86C10E1DA0B3160032ECC3 /* UIImageView+AlamofireImage.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4C78EA711AACD28C002C0569 /* UIImageView+AlamofireImage.swift */; };
4C86C10F1DA0B3340032ECC3 /* ImageFilterTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4C5872C91B93DEAC00407E58 /* ImageFilterTests.swift */; };
4C86C1101DA0B3390032ECC3 /* UIButtonTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = CF24CF3C1C253CA000904E85 /* UIButtonTests.swift */; };
4C86C1111DA0B33C0032ECC3 /* UIImageTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4C0893F41B937404005125D9 /* UIImageTests.swift */; };
4C86C1121DA0B3400032ECC3 /* UIImageViewTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4C62D30F1B96C1500011B036 /* UIImageViewTests.swift */; };
4C86C1131DA0B3440032ECC3 /* UIImage+AlamofireImageTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4C0893EB1B936A7A005125D9 /* UIImage+AlamofireImageTests.swift */; };
4C96A4781AAE9488008AE0B6 /* ImageDownloader.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4C96A4771AAE9488008AE0B6 /* ImageDownloader.swift */; };
4CB2DBEC1C632D3E000CC9C2 /* unicorn-blurred-8.png in Resources */ = {isa = PBXBuildFile; fileRef = 4CB2DBE51C632D3E000CC9C2 /* unicorn-blurred-8.png */; };
4CB2DBED1C632D3E000CC9C2 /* unicorn-blurred-8.png in Resources */ = {isa = PBXBuildFile; fileRef = 4CB2DBE51C632D3E000CC9C2 /* unicorn-blurred-8.png */; };
Expand Down Expand Up @@ -2010,8 +2020,10 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
4C86C10A1DA0B30D0032ECC3 /* UIButton+AlamofireImage.swift in Sources */,
4C4D4ECB1B9297BB00C96855 /* ImageCache.swift in Sources */,
4CD5BCED1D7F9D1E0055E232 /* AFIError.swift in Sources */,
4C86C10E1DA0B3160032ECC3 /* UIImageView+AlamofireImage.swift in Sources */,
4C4D4ECE1B9297BB00C96855 /* Request+AlamofireImage.swift in Sources */,
4C4D4ECF1B9297BB00C96855 /* UIImage+AlamofireImage.swift in Sources */,
4C4D4ECD1B9297BB00C96855 /* ImageFilter.swift in Sources */,
Expand Down Expand Up @@ -2060,9 +2072,12 @@
4C8290781B926F19005E24C8 /* ImageCache.swift in Sources */,
4C82907D1B927DA9005E24C8 /* ImageFilter.swift in Sources */,
4C82907B1B927CE6005E24C8 /* Image.swift in Sources */,
4C86C10D1DA0B3150032ECC3 /* UIImageView+AlamofireImage.swift in Sources */,
4C82907C1B927D13005E24C8 /* ImageDownloader.swift in Sources */,
4CE611561AABC8D900D35044 /* Request+AlamofireImage.swift in Sources */,
4CD5BCEB1D7F9D1E0055E232 /* AFIError.swift in Sources */,
4C86C10C1DA0B3110032ECC3 /* UIImage+AlamofireImage.swift in Sources */,
4C86C10B1DA0B30E0032ECC3 /* UIButton+AlamofireImage.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand All @@ -2071,9 +2086,14 @@
buildActionMask = 2147483647;
files = (
4CD5BCF61D7FBE380055E232 /* AFError+AlamofireImageTests.swift in Sources */,
4C86C1111DA0B33C0032ECC3 /* UIImageTests.swift in Sources */,
4C86C10F1DA0B3340032ECC3 /* ImageFilterTests.swift in Sources */,
4C86C1101DA0B3390032ECC3 /* UIButtonTests.swift in Sources */,
4C1624861AABE8E600A0385D /* BaseTestCase.swift in Sources */,
4CEBB5411B93C622001391DE /* ImageCacheTests.swift in Sources */,
4C86C1121DA0B3400032ECC3 /* UIImageViewTests.swift in Sources */,
4C5874871B93F81800407E58 /* ImageDownloaderTests.swift in Sources */,
4C86C1131DA0B3440032ECC3 /* UIImage+AlamofireImageTests.swift in Sources */,
4C0897EC1B93BC0D005125D9 /* RequestTests.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand Down
5 changes: 5 additions & 0 deletions Source/UIButton+AlamofireImage.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@

import Alamofire
import Foundation

#if os(iOS) || os(tvOS)

import UIKit

extension UIButton {
Expand Down Expand Up @@ -452,3 +455,5 @@ extension UIButton {
return urlRequest
}
}

#endif
30 changes: 11 additions & 19 deletions Source/UIImage+AlamofireImage.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,12 @@
// THE SOFTWARE.
//

#if os(iOS) || os(tvOS) || os(watchOS)

import CoreGraphics
import Foundation
import UIKit

#if os(iOS) || os(tvOS)
import CoreImage
#endif

// MARK: Initialization

private let lock = NSLock()
Expand Down Expand Up @@ -137,7 +135,7 @@ extension UIImage {
UIGraphicsBeginImageContextWithOptions(size, af_isOpaque, 0.0)
draw(in: CGRect(origin: CGPoint.zero, size: size))

let scaledImage = UIGraphicsGetImageFromCurrentImageContextUnwrapped()
let scaledImage = UIGraphicsGetImageFromCurrentImageContext()!
UIGraphicsEndImageContext()

return scaledImage
Expand Down Expand Up @@ -172,7 +170,7 @@ extension UIImage {
UIGraphicsBeginImageContextWithOptions(size, false, 0.0)
draw(in: CGRect(origin: origin, size: scaledSize))

let scaledImage = UIGraphicsGetImageFromCurrentImageContextUnwrapped()
let scaledImage = UIGraphicsGetImageFromCurrentImageContext()!
UIGraphicsEndImageContext()

return scaledImage
Expand Down Expand Up @@ -202,7 +200,7 @@ extension UIImage {
UIGraphicsBeginImageContextWithOptions(size, af_isOpaque, 0.0)
draw(in: CGRect(origin: origin, size: scaledSize))

let scaledImage = UIGraphicsGetImageFromCurrentImageContextUnwrapped()
let scaledImage = UIGraphicsGetImageFromCurrentImageContext()!
UIGraphicsEndImageContext()

return scaledImage
Expand Down Expand Up @@ -232,7 +230,7 @@ extension UIImage {

draw(in: CGRect(origin: CGPoint.zero, size: size))

let roundedImage = UIGraphicsGetImageFromCurrentImageContextUnwrapped()
let roundedImage = UIGraphicsGetImageFromCurrentImageContext()!
UIGraphicsEndImageContext()

return roundedImage
Expand Down Expand Up @@ -262,15 +260,19 @@ extension UIImage {

squareImage.draw(in: CGRect(origin: CGPoint.zero, size: squareImage.size))

let roundedImage = UIGraphicsGetImageFromCurrentImageContextUnwrapped()
let roundedImage = UIGraphicsGetImageFromCurrentImageContext()!
UIGraphicsEndImageContext()

return roundedImage
}
}

#endif

#if os(iOS) || os(tvOS)

import CoreImage

// MARK: - Core Image Filters

extension UIImage {
Expand Down Expand Up @@ -304,13 +306,3 @@ extension UIImage {
}

#endif

// MARK: - Private - Graphics Context Helpers

private func UIGraphicsGetImageFromCurrentImageContextUnwrapped() -> UIImage {
#if swift(>=2.3)
return UIGraphicsGetImageFromCurrentImageContext()!
#else
return UIGraphicsGetImageFromCurrentImageContext()
#endif
}
5 changes: 5 additions & 0 deletions Source/UIImageView+AlamofireImage.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@

import Alamofire
import Foundation

#if os(iOS) || os(tvOS)

import UIKit

extension UIImageView {
Expand Down Expand Up @@ -374,3 +377,5 @@ extension UIImageView {
return false
}
}

#endif
4 changes: 4 additions & 0 deletions Tests/ImageFilterTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
// THE SOFTWARE.
//

#if !os(macOS)

import AlamofireImage
import Foundation
import UIKit
Expand Down Expand Up @@ -287,3 +289,5 @@ class ImageFilterTestCase: BaseTestCase {
XCTAssertTrue(filteredImage.af_isEqualToImage(expectedFilteredImage), "filtered image pixels do not match")
}
}

#endif
4 changes: 4 additions & 0 deletions Tests/UIButtonTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
// THE SOFTWARE.
//

#if !os(macOS)

@testable import Alamofire
@testable import AlamofireImage
import UIKit
Expand Down Expand Up @@ -942,3 +944,5 @@ class UIButtonTests: BaseTestCase {
}
}
}

#endif
5 changes: 4 additions & 1 deletion Tests/UIImage+AlamofireImageTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@
// THE SOFTWARE.
//

import Foundation
#if !os(macOS)

import UIKit

extension UIImage {
Expand Down Expand Up @@ -119,3 +120,5 @@ extension UIImage {
return image
}
}

#endif
4 changes: 4 additions & 0 deletions Tests/UIImageTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
// THE SOFTWARE.
//

#if !os(macOS)

import AlamofireImage
import Foundation
import UIKit
Expand Down Expand Up @@ -379,3 +381,5 @@ class UIImageTestCase: BaseTestCase {
XCTAssertNil(filteredImage, "filtered image should be nil")
}
}

#endif
4 changes: 4 additions & 0 deletions Tests/UIImageViewTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
// THE SOFTWARE.
//

#if !os(macOS)

@testable import Alamofire
@testable import AlamofireImage
import Foundation
Expand Down Expand Up @@ -707,3 +709,5 @@ class UIImageViewTestCase: BaseTestCase {
}
}
}

#endif

0 comments on commit 33c6615

Please sign in to comment.