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

Merge pull request #270 from onevcat/rain2540-master

Compatible with Swift 2.2
Wei Wang 10 лет назад
Родитель
Сommit
3656c98811

+ 1 - 1
.travis.yml

@@ -1,6 +1,6 @@
 language: objective-c
 os: osx
-osx_image: xcode7.2
+osx_image: xcode7.3
 
 env:
   matrix:

+ 1 - 1
Demo/Kingfisher-watchOS-Demo Extension/InterfaceController.swift

@@ -41,7 +41,7 @@ class InterfaceController: WKInterfaceController {
         super.awakeWithContext(context)
         
         currentIndex = count
-        count++
+        count += 1
     }
     
     func refreshImage() {

+ 2 - 2
Sources/Image.swift

@@ -286,8 +286,8 @@ extension Image {
         let imageRef = self.CGImage
         let colorSpace = CGColorSpaceCreateDeviceRGB()
         let bitmapInfo = CGBitmapInfo(rawValue: CGImageAlphaInfo.PremultipliedLast.rawValue).rawValue
-        let contextHolder = UnsafeMutablePointer<Void>()
-        let context = CGBitmapContextCreate(contextHolder, CGImageGetWidth(imageRef), CGImageGetHeight(imageRef), 8, 0, colorSpace, bitmapInfo)
+        
+        let context = CGBitmapContextCreate(nil, CGImageGetWidth(imageRef), CGImageGetHeight(imageRef), 8, 0, colorSpace, bitmapInfo)
         if let context = context {
             let rect = CGRect(x: 0, y: 0, width: CGImageGetWidth(imageRef), height: CGImageGetHeight(imageRef))
             CGContextDrawImage(context, rect, imageRef)

+ 3 - 3
Sources/ImageCache.swift

@@ -130,9 +130,9 @@ public class ImageCache {
         })
         
 #if !os(OSX) && !os(watchOS)
-        NSNotificationCenter.defaultCenter().addObserver(self, selector: "clearMemoryCache", name: UIApplicationDidReceiveMemoryWarningNotification, object: nil)
-        NSNotificationCenter.defaultCenter().addObserver(self, selector: "cleanExpiredDiskCache", name: UIApplicationWillTerminateNotification, object: nil)
-        NSNotificationCenter.defaultCenter().addObserver(self, selector: "backgroundCleanExpiredDiskCache", name: UIApplicationDidEnterBackgroundNotification, object: nil)
+        NSNotificationCenter.defaultCenter().addObserver(self, selector: #selector(ImageCache.clearMemoryCache), name: UIApplicationDidReceiveMemoryWarningNotification, object: nil)
+        NSNotificationCenter.defaultCenter().addObserver(self, selector: #selector(ImageCache.cleanExpiredDiskCache), name: UIApplicationWillTerminateNotification, object: nil)
+        NSNotificationCenter.defaultCenter().addObserver(self, selector: #selector(ImageCache.backgroundCleanExpiredDiskCache), name: UIApplicationDidEnterBackgroundNotification, object: nil)
 #endif
     }
     

+ 1 - 1
Sources/String+MD5.swift

@@ -112,7 +112,7 @@ private func CS_AnyGenerator<Element>(body: () -> Element?) -> AnyGenerator<Elem
     #if os(Linux)
         return AnyGenerator(body: body)
     #else
-        return anyGenerator(body)
+        return AnyGenerator(body: body)
     #endif
 }