diff --git a/SKPhotoBrowser.xcodeproj/project.pbxproj b/SKPhotoBrowser.xcodeproj/project.pbxproj index f1ec711..0c7f538 100644 --- a/SKPhotoBrowser.xcodeproj/project.pbxproj +++ b/SKPhotoBrowser.xcodeproj/project.pbxproj @@ -199,6 +199,7 @@ TargetAttributes = { 8909B52F1BC791280060A053 = { CreatedOnToolsVersion = 7.0; + LastSwiftMigration = 0800; }; A64B89321CB04222000071B9 = { CreatedOnToolsVersion = 7.3; @@ -402,6 +403,7 @@ PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 2.3; }; name = Debug; }; @@ -420,6 +422,7 @@ PRODUCT_BUNDLE_IDENTIFIER = com.keishi.suzuki.SKPhotoBrowser; PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; + SWIFT_VERSION = 2.3; }; name = Release; }; diff --git a/SKPhotoBrowser/SKPhotoBrowser.swift b/SKPhotoBrowser/SKPhotoBrowser.swift index 7681137..4b91e79 100644 --- a/SKPhotoBrowser/SKPhotoBrowser.swift +++ b/SKPhotoBrowser/SKPhotoBrowser.swift @@ -948,7 +948,7 @@ public class SKPhotoBrowser: UIViewController, UIScrollViewDelegate { sender.layer.renderInContext(UIGraphicsGetCurrentContext()!) let result = UIGraphicsGetImageFromCurrentImageContext() UIGraphicsEndImageContext() - return result + return result! } // MARK: - paging diff --git a/SKPhotoBrowser/extensions/UIImage+Rotation.swift b/SKPhotoBrowser/extensions/UIImage+Rotation.swift index 09ed323..be342a6 100644 --- a/SKPhotoBrowser/extensions/UIImage+Rotation.swift +++ b/SKPhotoBrowser/extensions/UIImage+Rotation.swift @@ -52,21 +52,21 @@ extension UIImage { // Now we draw the underlying CGImage into a new context, applying the transform // calculated above. let ctx = CGBitmapContextCreate(nil, Int(self.size.width), Int(self.size.height), - CGImageGetBitsPerComponent(self.CGImage), 0, - CGImageGetColorSpace(self.CGImage), - CGImageGetBitmapInfo(self.CGImage).rawValue) - CGContextConcatCTM(ctx, transform) + CGImageGetBitsPerComponent(self.CGImage!), 0, + CGImageGetColorSpace(self.CGImage!)!, + CGImageGetBitmapInfo(self.CGImage!).rawValue) + CGContextConcatCTM(ctx!, transform) switch self.imageOrientation { case .Left, .LeftMirrored, .Right, .RightMirrored: - CGContextDrawImage(ctx, CGRect(x: 0, y: 0, width: size.height, height: size.width), self.CGImage) + CGContextDrawImage(ctx!, CGRect(x: 0, y: 0, width: size.height, height: size.width), self.CGImage!) default: - CGContextDrawImage(ctx, CGRect(x: 0, y: 0, width: size.width, height: size.height), self.CGImage) + CGContextDrawImage(ctx!, CGRect(x: 0, y: 0, width: size.width, height: size.height), self.CGImage!) } // And now we just create a new UIImage from the drawing context - if let cgImage = CGBitmapContextCreateImage(ctx) { + if let cgImage = CGBitmapContextCreateImage(ctx!) { return UIImage(CGImage: cgImage) } else { return self