Просмотр исходного кода

Move Kingfisher.swift to right place

onevcat 9 лет назад
Родитель
Сommit
ecc81a3591
3 измененных файлов с 82 добавлено и 64 удалено
  1. 0 54
      Kingfisher.swift
  2. 10 10
      Kingfisher.xcodeproj/project.pbxproj
  3. 72 0
      Sources/Kingfisher.swift

+ 0 - 54
Kingfisher.swift

@@ -1,54 +0,0 @@
-//
-//  Kingfisher.swift
-//  Kingfisher
-//
-//  Created by WANG WEI on 2016/09/14.
-//  Copyright © 2016年 Wei Wang. All rights reserved.
-//
-
-import Foundation
-import ImageIO
-
-#if os(macOS)
-    import AppKit
-    public typealias Image = NSImage
-    public typealias Color = NSColor
-    public typealias ImageView = NSImageView
-    typealias Button = NSButton
-#else
-    import UIKit
-    public typealias Image = UIImage
-    public typealias Color = UIColor
-    #if !os(watchOS)
-    public typealias ImageView = UIImageView
-    typealias Button = UIButton
-    #endif
-#endif
-
-public struct Kingfisher<Base> {
-    public let base: Base
-    public init(_ base: Base) {
-        self.base = base
-    }
-}
-
-/**
- A type that has Kingfisher extensions.
- */
-public protocol KingfisherCompatible {
-    associatedtype CompatibleType
-    var kf: CompatibleType { get }
-}
-
-public extension KingfisherCompatible {
-    public var kf: Kingfisher<Self> {
-        get { return Kingfisher(self) }
-        set { }
-    }
-}
-
-extension Image: KingfisherCompatible { }
-#if !os(watchOS)
-extension ImageView: KingfisherCompatible { }
-extension Button: KingfisherCompatible { }
-#endif

+ 10 - 10
Kingfisher.xcodeproj/project.pbxproj

@@ -33,10 +33,6 @@
 		4B7742481D87E42E0077024E /* loader.gif in Resources */ = {isa = PBXBuildFile; fileRef = 4B7742461D87E42E0077024E /* loader.gif */; };
 		4B98674F1CD1CF42003ADAC7 /* AnimatedImageView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4B98674E1CD1CF42003ADAC7 /* AnimatedImageView.swift */; };
 		4B9867501CD1CF42003ADAC7 /* AnimatedImageView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4B98674E1CD1CF42003ADAC7 /* AnimatedImageView.swift */; };
-		4BA6E2101D891C1D000ED91A /* Kingfisher.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4BA6E20F1D891C1D000ED91A /* Kingfisher.swift */; };
-		4BA6E2111D892AB0000ED91A /* Kingfisher.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4BA6E20F1D891C1D000ED91A /* Kingfisher.swift */; };
-		4BA6E2121D892AB1000ED91A /* Kingfisher.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4BA6E20F1D891C1D000ED91A /* Kingfisher.swift */; };
-		4BA6E2131D892AB2000ED91A /* Kingfisher.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4BA6E20F1D891C1D000ED91A /* Kingfisher.swift */; };
 		4BB24C3D1D79215A00CD5F9C /* CacheSerializer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4BB24C3C1D79215A00CD5F9C /* CacheSerializer.swift */; };
 		4BB24C3E1D79215A00CD5F9C /* CacheSerializer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4BB24C3C1D79215A00CD5F9C /* CacheSerializer.swift */; };
 		4BB24C3F1D79215A00CD5F9C /* CacheSerializer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4BB24C3C1D79215A00CD5F9C /* CacheSerializer.swift */; };
@@ -46,6 +42,10 @@
 		4BCCF33F1D5B02F8003387C2 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 4BCCF3381D5B02F8003387C2 /* Main.storyboard */; };
 		4BCCF3401D5B02F8003387C2 /* Cell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 4BCCF33A1D5B02F8003387C2 /* Cell.xib */; };
 		4BCCF3421D5B02F8003387C2 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4BCCF33C1D5B02F8003387C2 /* ViewController.swift */; };
+		4BD8E04C1D9237E200A091BE /* Kingfisher.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4BD8E04B1D9237E200A091BE /* Kingfisher.swift */; };
+		4BD8E04D1D9237E200A091BE /* Kingfisher.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4BD8E04B1D9237E200A091BE /* Kingfisher.swift */; };
+		4BD8E04E1D9237E200A091BE /* Kingfisher.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4BD8E04B1D9237E200A091BE /* Kingfisher.swift */; };
+		4BD8E04F1D9237E200A091BE /* Kingfisher.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4BD8E04B1D9237E200A091BE /* Kingfisher.swift */; };
 		4BE3BD0A1D756A77000BFA17 /* kingfisher-b&w-mac.jpg in Resources */ = {isa = PBXBuildFile; fileRef = 4BE3BCC11D756A77000BFA17 /* kingfisher-b&w-mac.jpg */; };
 		4BE3BD0B1D756A77000BFA17 /* kingfisher-b&w-mac.jpg in Resources */ = {isa = PBXBuildFile; fileRef = 4BE3BCC11D756A77000BFA17 /* kingfisher-b&w-mac.jpg */; };
 		4BE3BD0C1D756A77000BFA17 /* kingfisher-b&w-mac.jpg in Resources */ = {isa = PBXBuildFile; fileRef = 4BE3BCC11D756A77000BFA17 /* kingfisher-b&w-mac.jpg */; };
@@ -492,7 +492,6 @@
 		4B7742421D87E2AA0077024E /* Box.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = Box.swift; path = Sources/Box.swift; sourceTree = "<group>"; };
 		4B7742461D87E42E0077024E /* loader.gif */ = {isa = PBXFileReference; lastKnownFileType = image.gif; path = loader.gif; sourceTree = "<group>"; };
 		4B98674E1CD1CF42003ADAC7 /* AnimatedImageView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = AnimatedImageView.swift; path = Sources/AnimatedImageView.swift; sourceTree = "<group>"; };
-		4BA6E20F1D891C1D000ED91A /* Kingfisher.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Kingfisher.swift; sourceTree = "<group>"; };
 		4BB24C3C1D79215A00CD5F9C /* CacheSerializer.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = CacheSerializer.swift; path = Sources/CacheSerializer.swift; sourceTree = "<group>"; };
 		4BCCF3361D5B02F8003387C2 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
 		4BCCF3371D5B02F8003387C2 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
@@ -501,6 +500,7 @@
 		4BCCF33B1D5B02F8003387C2 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
 		4BCCF33C1D5B02F8003387C2 /* ViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = "<group>"; };
 		4BCCF3441D5B0457003387C2 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
+		4BD8E04B1D9237E200A091BE /* Kingfisher.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = Kingfisher.swift; path = Sources/Kingfisher.swift; sourceTree = "<group>"; };
 		4BE3BCC11D756A77000BFA17 /* kingfisher-b&w-mac.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = "kingfisher-b&w-mac.jpg"; sourceTree = "<group>"; };
 		4BE3BCC21D756A77000BFA17 /* kingfisher-b&w.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = "kingfisher-b&w.jpg"; sourceTree = "<group>"; };
 		4BE3BCC31D756A77000BFA17 /* onevcat-b&w-mac.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = "onevcat-b&w-mac.jpg"; sourceTree = "<group>"; };
@@ -900,7 +900,7 @@
 				D10945F21C526B6C001408EB /* KingfisherOptionsInfo.swift */,
 				4B6313F31D766BEF0078E017 /* Filter.swift */,
 				D10945F31C526B6C001408EB /* Resource.swift */,
-				4BA6E20F1D891C1D000ED91A /* Kingfisher.swift */,
+				4BD8E04B1D9237E200A091BE /* Kingfisher.swift */,
 			);
 			name = Core;
 			sourceTree = "<group>";
@@ -2076,7 +2076,7 @@
 				D10946211C526C61001408EB /* Resource.swift in Sources */,
 				4BB24C3F1D79215A00CD5F9C /* CacheSerializer.swift in Sources */,
 				D9638BA21C7DBA660046523D /* ImagePrefetcher.swift in Sources */,
-				4BA6E2121D892AB1000ED91A /* Kingfisher.swift in Sources */,
+				4BD8E04E1D9237E200A091BE /* Kingfisher.swift in Sources */,
 				D10946221C526C61001408EB /* String+MD5.swift in Sources */,
 				D10946231C526C61001408EB /* ThreadHelper.swift in Sources */,
 			);
@@ -2146,7 +2146,7 @@
 				4B7742441D87E2AA0077024E /* Box.swift in Sources */,
 				4B6313F51D766BEF0078E017 /* Filter.swift in Sources */,
 				4B9867501CD1CF42003ADAC7 /* AnimatedImageView.swift in Sources */,
-				4BA6E2111D892AB0000ED91A /* Kingfisher.swift in Sources */,
+				4BD8E04D1D9237E200A091BE /* Kingfisher.swift in Sources */,
 				D109460F1C526C0D001408EB /* ImageCache.swift in Sources */,
 				D10946101C526C0D001408EB /* ImageDownloader.swift in Sources */,
 				4B2B8E4B1D70140F00FC4749 /* ImageProcessor.swift in Sources */,
@@ -2177,7 +2177,7 @@
 				4BFBEE801D7D0C3600699FD3 /* RequrstModifier.swift in Sources */,
 				D10946271C526CE8001408EB /* ImageDownloader.swift in Sources */,
 				D10946281C526CE8001408EB /* KingfisherManager.swift in Sources */,
-				4BA6E2131D892AB2000ED91A /* Kingfisher.swift in Sources */,
+				4BD8E04F1D9237E200A091BE /* Kingfisher.swift in Sources */,
 				D10946291C526CE8001408EB /* KingfisherOptionsInfo.swift in Sources */,
 				D109462A1C526CE8001408EB /* Resource.swift in Sources */,
 				D109462B1C526CE8001408EB /* String+MD5.swift in Sources */,
@@ -2213,7 +2213,7 @@
 				4B7742431D87E2AA0077024E /* Box.swift in Sources */,
 				4B6313F41D766BEF0078E017 /* Filter.swift in Sources */,
 				4B98674F1CD1CF42003ADAC7 /* AnimatedImageView.swift in Sources */,
-				4BA6E2101D891C1D000ED91A /* Kingfisher.swift in Sources */,
+				4BD8E04C1D9237E200A091BE /* Kingfisher.swift in Sources */,
 				D10945F81C526B86001408EB /* ImageCache.swift in Sources */,
 				D10945F91C526B86001408EB /* ImageDownloader.swift in Sources */,
 				4B2B8E4A1D70128200FC4749 /* ImageProcessor.swift in Sources */,

+ 72 - 0
Sources/Kingfisher.swift

@@ -0,0 +1,72 @@
+//
+//  Kingfisher.swift
+//  Kingfisher
+//
+//  Created by Wei Wang on 16/9/14.
+//
+//  Copyright (c) 2016 Wei Wang <onevcat@gmail.com>
+//
+//  Permission is hereby granted, free of charge, to any person obtaining a copy
+//  of this software and associated documentation files (the "Software"), to deal
+//  in the Software without restriction, including without limitation the rights
+//  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+//  copies of the Software, and to permit persons to whom the Software is
+//  furnished to do so, subject to the following conditions:
+//
+//  The above copyright notice and this permission notice shall be included in
+//  all copies or substantial portions of the Software.
+//
+//  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+//  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+//  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+//  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+//  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+//  THE SOFTWARE.
+
+import Foundation
+import ImageIO
+
+#if os(macOS)
+    import AppKit
+    public typealias Image = NSImage
+    public typealias Color = NSColor
+    public typealias ImageView = NSImageView
+    typealias Button = NSButton
+#else
+    import UIKit
+    public typealias Image = UIImage
+    public typealias Color = UIColor
+    #if !os(watchOS)
+    public typealias ImageView = UIImageView
+    typealias Button = UIButton
+    #endif
+#endif
+
+public struct Kingfisher<Base> {
+    public let base: Base
+    public init(_ base: Base) {
+        self.base = base
+    }
+}
+
+/**
+ A type that has Kingfisher extensions.
+ */
+public protocol KingfisherCompatible {
+    associatedtype CompatibleType
+    var kf: CompatibleType { get }
+}
+
+public extension KingfisherCompatible {
+    public var kf: Kingfisher<Self> {
+        get { return Kingfisher(self) }
+        set { }
+    }
+}
+
+extension Image: KingfisherCompatible { }
+#if !os(watchOS)
+extension ImageView: KingfisherCompatible { }
+extension Button: KingfisherCompatible { }
+#endif