Skip to content

Commit

Permalink
Merge pull request #2 from EFPrefix/ef
Browse files Browse the repository at this point in the history
0.9.3
  • Loading branch information
EyreFree authored Oct 6, 2019
2 parents c4f5644 + c619f32 commit 7d18be9
Show file tree
Hide file tree
Showing 10 changed files with 40 additions and 33 deletions.
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,18 @@

-----

## [0.9.3](https://github.com/EFPrefix/EFFoundation/releases/tag/0.9.3) (2019-10-06)

- Use canImport instead of platform.

---

## [0.9.2](https://github.com/EFPrefix/EFFoundation/releases/tag/0.9.2) (2019-09-28)

- Fix.

---

## [0.9.1](https://github.com/EFPrefix/EFFoundation/releases/tag/0.9.1) (2019-09-28)

- Add support for the new September 2019 devices.
Expand Down
2 changes: 1 addition & 1 deletion EFFoundation.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'EFFoundation'
s.version = '0.9.2'
s.version = '0.9.3'
s.summary = 'EFFoundation.'

s.description = <<-DESC
Expand Down
8 changes: 4 additions & 4 deletions EFFoundation/Core/CGColor+.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,23 @@

import CoreGraphics

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

#if os(iOS) || os(tvOS) || os(watchOS)
#if canImport(UIKit)
import UIKit
#endif

public extension CGColor {

#if os(iOS) || os(tvOS) || os(macOS)
#if canImport(CoreImage)
var ciColor: CIColor {
return CIColor(cgColor: self)
}
#endif

#if os(iOS) || os(tvOS) || os(watchOS)
#if canImport(UIKit)
var uiColor: UIColor {
return UIColor(cgColor: self)
}
Expand Down
1 change: 1 addition & 0 deletions EFFoundation/Core/CGFloat+.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
//

import CoreGraphics

#if os(iOS)
import UIKit
#endif
Expand Down
8 changes: 4 additions & 4 deletions EFFoundation/Core/CGImage.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,23 @@

import CoreGraphics

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

#if os(iOS) || os(tvOS) || os(watchOS)
#if canImport(UIKit)
import UIKit
#endif

public extension CGImage {

#if os(iOS) || os(tvOS) || os(macOS)
#if canImport(CoreImage)
func ciImage() -> CIImage {
return CIImage(cgImage: self)
}
#endif

#if os(iOS) || os(tvOS) || os(watchOS)
#if canImport(UIKit)
func uiImage() -> UIImage {
return UIImage(cgImage: self)
}
Expand Down
6 changes: 3 additions & 3 deletions EFFoundation/Core/CIColor+.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
// Created by EyreFree on 2019/8/28.
//

#if os(iOS) || os(tvOS) || os(macOS)
#if canImport(CoreImage)
import CoreImage

#if os(iOS) || os(tvOS) || os(watchOS)
#if canImport(UIKit)
import UIKit
#endif

Expand All @@ -18,7 +18,7 @@ public extension CIColor {
return CGColor(colorSpace: colorSpace, components: components)
}

#if os(iOS) || os(tvOS) || os(watchOS)
#if canImport(UIKit)
var uiColor: UIColor {
return UIColor(ciColor: self)
}
Expand Down
20 changes: 4 additions & 16 deletions EFFoundation/Core/CIImage+.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,37 +5,25 @@
// Created by EyreFree on 2019/8/28.
//

#if os(iOS) || os(tvOS) || os(macOS)
#if canImport(CoreImage)
import CoreImage

#if os(iOS) || os(tvOS) || os(watchOS)
#if canImport(UIKit)
import UIKit
#endif

public extension CIImage {

func cgImage() -> CGImage? {
#if os(iOS)
if #available(iOS 10, *) {
if #available(iOS 10, macOS 10.12, tvOS 10, watchOS 2, *) {
if let cgImage = cgImage {
return cgImage
}
}
#elseif os(tvOS)
if #available(tvOS 10, *) {
if let cgImage = cgImage {
return cgImage
}
}
#elseif os(watchOS)
if let cgImage = cgImage {
return cgImage
}
#endif
return CIContext().createCGImage(self, from: extent)
}

#if os(iOS) || os(tvOS) || os(watchOS)
#if canImport(UIKit)
func uiImage() -> UIImage {
return UIImage(ciImage: self)
}
Expand Down
2 changes: 1 addition & 1 deletion EFFoundation/Core/UIColor+.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// Created by EyreFree on 2019/8/15.
//

#if os(iOS) || os(tvOS) || os(watchOS)
#if canImport(UIKit)
import UIKit
import CoreGraphics

Expand Down
2 changes: 1 addition & 1 deletion EFFoundation/Core/UIFont+.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// Created by EyreFree on 2019/8/15.
//

#if os(iOS) || os(tvOS) || os(watchOS)
#if canImport(UIKit)
import UIKit
import CoreGraphics

Expand Down
12 changes: 9 additions & 3 deletions EFFoundation/Core/UIImage+.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,15 @@
// Created by EyreFree on 2019/8/15.
//

#if os(iOS)

import CoreGraphics
import CoreImage
import ImageIO

#if canImport(UIKit)
import UIKit
import ImageIO

#if canImport(CoreImage)
import CoreImage

public extension UIImage {

Expand All @@ -22,7 +25,9 @@ public extension UIImage {
return cgImage ?? ciImage()?.cgImage()
}
}
#endif

#if os(iOS)
public extension UIImage {

static let appIcon: UIImage? = {
Expand Down Expand Up @@ -243,3 +248,4 @@ public extension UIImage {
}
}
#endif
#endif

0 comments on commit 7d18be9

Please sign in to comment.