Browse Source

Xcode 8 Compatibility for Travis CI

- Updated Test Runners for Travis
- Updated project settings for Xcode 8
- Updated macOS example platform
Kevin Harwood 9 years ago
parent
commit
89b79c53a0
27 changed files with 117 additions and 96 deletions
  1. 8 18
      .travis.yml
  2. 17 1
      AFNetworking.xcodeproj/project.pbxproj
  3. 1 1
      AFNetworking.xcodeproj/xcshareddata/xcschemes/AFNetworking OS X.xcscheme
  4. 10 2
      AFNetworking.xcodeproj/xcshareddata/xcschemes/AFNetworking iOS.xcscheme
  5. 22 2
      AFNetworking.xcodeproj/xcshareddata/xcschemes/AFNetworking tvOS.xcscheme
  6. 1 1
      AFNetworking.xcodeproj/xcshareddata/xcschemes/AFNetworking watchOS.xcscheme
  7. 3 0
      Example/AFNetworking Example.xcodeproj/project.pbxproj
  8. 1 1
      Example/AFNetworking Example.xcodeproj/xcshareddata/xcschemes/OS X Example.xcscheme
  9. 1 1
      Example/AFNetworking Example.xcodeproj/xcshareddata/xcschemes/Today Extension Example.xcscheme
  10. 1 1
      Example/AFNetworking Example.xcodeproj/xcshareddata/xcschemes/iOS Example.xcscheme
  11. 4 4
      Example/AFNetworking Example.xcodeproj/xcshareddata/xcschemes/tvOS Example.xcscheme
  12. 1 1
      Example/AFNetworking Example.xcodeproj/xcshareddata/xcschemes/watchOS Example.xcscheme
  13. 6 6
      Example/tvOS Example/AppDelegate.swift
  14. 17 17
      Example/tvOS Example/Gravatar.swift
  15. 8 8
      Example/tvOS Example/ViewController.swift
  16. 4 4
      fastlane/.env.default
  17. 3 0
      fastlane/.env.ios10_xcode8
  18. 3 3
      fastlane/.env.ios81_xcode7
  19. 0 2
      fastlane/.env.ios83
  20. 0 2
      fastlane/.env.ios84
  21. 0 3
      fastlane/.env.ios90_xcode7
  22. 0 3
      fastlane/.env.ios91_xcode71
  23. 0 3
      fastlane/.env.ios92_xcode72
  24. 3 2
      fastlane/.env.ios93_xcode73
  25. 1 2
      fastlane/.env.osx
  26. 2 2
      fastlane/.env.tvos10_xcode8
  27. 0 6
      fastlane/.env.tvos90_xcode71

+ 8 - 18
.travis.yml

@@ -8,28 +8,18 @@ env:
   - FASTLANE_LANE=ci_commit
 matrix:
   include:
-    - osx_image: xcode7.3
+    - osx_image: xcode8
       env: FASTLANE_LANE=code_coverage FASTLANE_ENV=default
-    - osx_image: xcode7.3
-      env: FASTLANE_ENV=ios83
-    - osx_image: xcode7.3
-      env: FASTLANE_ENV=ios84
-    - osx_image: xcode7.3
-      env: FASTLANE_ENV=tvos91	  
-    - osx_image: xcode7.3
+    - osx_image: xcode8
+      env: FASTLANE_ENV=ios10_xcode8
+    - osx_image: xcode8
+      env: FASTLANE_ENV=tvos10_xcode8
+    - osx_image: xcode8
       env: FASTLANE_ENV=osx
     - osx_image: xcode7.3
-      env: FASTLANE_ENV=ios93
-    - osx_image: xcode7.2
-      env: FASTLANE_ENV=ios92_xcode72	  
-    - osx_image: xcode7.1
-      env: FASTLANE_ENV=ios91_xcode71	  
-    - osx_image: xcode7.1
-      env: FASTLANE_ENV=tvos90_xcode71
-    - osx_image: xcode7
-      env: FASTLANE_ENV=ios81_xcode7	  
+      env: FASTLANE_ENV=ios93_xcode73
     - osx_image: xcode7
-      env: FASTLANE_ENV=ios90_xcode7	  
+      env: FASTLANE_ENV=ios81_xcode7
 before_install:
   # Force bundler 1.12.5 because version 1.13 has issues, see https://github.com/fastlane/fastlane/issues/6065#issuecomment-246044617
   - gem uninstall bundler -v '>1.12.5' --force || echo "bundler >1.12.5 is not installed"

+ 17 - 1
AFNetworking.xcodeproj/project.pbxproj

@@ -768,7 +768,7 @@
 		299522301BBF104D00859F49 /* Project object */ = {
 			isa = PBXProject;
 			attributes = {
-				LastUpgradeCheck = 0700;
+				LastUpgradeCheck = 0800;
 				ORGANIZATIONNAME = AFNetworking;
 				TargetAttributes = {
 					2987B0A41BC408A200179A4C = {
@@ -776,9 +776,11 @@
 					};
 					2987B0AD1BC408A200179A4C = {
 						CreatedOnToolsVersion = 7.1;
+						ProvisioningStyle = Manual;
 					};
 					298D7C3A1BC2C79500FD3B3E = {
 						CreatedOnToolsVersion = 7.0.1;
+						ProvisioningStyle = Manual;
 					};
 					298D7C491BC2C7B200FD3B3E = {
 						CreatedOnToolsVersion = 7.0.1;
@@ -1087,6 +1089,7 @@
 			isa = XCBuildConfiguration;
 			buildSettings = {
 				BITCODE_GENERATION_MODE = marker;
+				"CODE_SIGN_IDENTITY[sdk=appletvos*]" = "";
 				DEFINES_MODULE = YES;
 				DYLIB_COMPATIBILITY_VERSION = 1;
 				DYLIB_CURRENT_VERSION = 1;
@@ -1109,6 +1112,7 @@
 			isa = XCBuildConfiguration;
 			buildSettings = {
 				BITCODE_GENERATION_MODE = bitcode;
+				"CODE_SIGN_IDENTITY[sdk=appletvos*]" = "";
 				DEFINES_MODULE = YES;
 				DYLIB_COMPATIBILITY_VERSION = 1;
 				DYLIB_CURRENT_VERSION = 1;
@@ -1130,6 +1134,7 @@
 		2987B0B81BC408A200179A4C /* Debug */ = {
 			isa = XCBuildConfiguration;
 			buildSettings = {
+				DEVELOPMENT_TEAM = "";
 				INFOPLIST_FILE = ./Tests/Info.plist;
 				LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
 				PRODUCT_BUNDLE_IDENTIFIER = "com.alamofire.AFNetworking-tvOSTests";
@@ -1142,6 +1147,7 @@
 		2987B0B91BC408A200179A4C /* Release */ = {
 			isa = XCBuildConfiguration;
 			buildSettings = {
+				DEVELOPMENT_TEAM = "";
 				INFOPLIST_FILE = ./Tests/Info.plist;
 				LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
 				PRODUCT_BUNDLE_IDENTIFIER = "com.alamofire.AFNetworking-tvOSTests";
@@ -1155,6 +1161,7 @@
 			isa = XCBuildConfiguration;
 			buildSettings = {
 				CODE_SIGN_IDENTITY = "iPhone Developer";
+				DEVELOPMENT_TEAM = "";
 				GCC_PREFIX_HEADER = "$(PROJECT_DIR)/Tests/Tests-Prefix.pch";
 				INFOPLIST_FILE = ./Tests/Info.plist;
 				IPHONEOS_DEPLOYMENT_TARGET = 8.0;
@@ -1168,6 +1175,7 @@
 			isa = XCBuildConfiguration;
 			buildSettings = {
 				CODE_SIGN_IDENTITY = "iPhone Developer";
+				DEVELOPMENT_TEAM = "";
 				GCC_PREFIX_HEADER = "$(PROJECT_DIR)/Tests/Tests-Prefix.pch";
 				INFOPLIST_FILE = ./Tests/Info.plist;
 				IPHONEOS_DEPLOYMENT_TARGET = 8.0;
@@ -1224,11 +1232,13 @@
 				CLANG_WARN_EMPTY_BODY = YES;
 				CLANG_WARN_ENUM_CONVERSION = YES;
 				CLANG_WARN_IMPLICIT_SIGN_CONVERSION = YES;
+				CLANG_WARN_INFINITE_RECURSION = YES;
 				CLANG_WARN_INT_CONVERSION = YES;
 				CLANG_WARN_OBJC_EXPLICIT_OWNERSHIP_TYPE = YES;
 				CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
 				CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = YES;
 				CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
+				CLANG_WARN_SUSPICIOUS_MOVE = YES;
 				CLANG_WARN_UNREACHABLE_CODE = YES;
 				CLANG_WARN__ARC_BRIDGE_CAST_NONARC = YES;
 				CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
@@ -1296,11 +1306,13 @@
 				CLANG_WARN_EMPTY_BODY = YES;
 				CLANG_WARN_ENUM_CONVERSION = YES;
 				CLANG_WARN_IMPLICIT_SIGN_CONVERSION = YES;
+				CLANG_WARN_INFINITE_RECURSION = YES;
 				CLANG_WARN_INT_CONVERSION = YES;
 				CLANG_WARN_OBJC_EXPLICIT_OWNERSHIP_TYPE = YES;
 				CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
 				CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = YES;
 				CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
+				CLANG_WARN_SUSPICIOUS_MOVE = YES;
 				CLANG_WARN_UNREACHABLE_CODE = YES;
 				CLANG_WARN__ARC_BRIDGE_CAST_NONARC = YES;
 				CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
@@ -1350,6 +1362,7 @@
 			buildSettings = {
 				BITCODE_GENERATION_MODE = marker;
 				CODE_SIGN_IDENTITY = "iPhone Developer";
+				"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "";
 				DEFINES_MODULE = YES;
 				DYLIB_COMPATIBILITY_VERSION = 1;
 				DYLIB_CURRENT_VERSION = 1;
@@ -1371,6 +1384,7 @@
 			buildSettings = {
 				BITCODE_GENERATION_MODE = bitcode;
 				CODE_SIGN_IDENTITY = "iPhone Developer";
+				"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "";
 				DEFINES_MODULE = YES;
 				DYLIB_COMPATIBILITY_VERSION = 1;
 				DYLIB_CURRENT_VERSION = 1;
@@ -1392,6 +1406,7 @@
 			buildSettings = {
 				APPLICATION_EXTENSION_API_ONLY = YES;
 				BITCODE_GENERATION_MODE = marker;
+				"CODE_SIGN_IDENTITY[sdk=watchos*]" = "";
 				DEFINES_MODULE = YES;
 				DYLIB_COMPATIBILITY_VERSION = 1;
 				DYLIB_CURRENT_VERSION = 1;
@@ -1414,6 +1429,7 @@
 			buildSettings = {
 				APPLICATION_EXTENSION_API_ONLY = YES;
 				BITCODE_GENERATION_MODE = bitcode;
+				"CODE_SIGN_IDENTITY[sdk=watchos*]" = "";
 				DEFINES_MODULE = YES;
 				DYLIB_COMPATIBILITY_VERSION = 1;
 				DYLIB_CURRENT_VERSION = 1;

+ 1 - 1
AFNetworking.xcodeproj/xcshareddata/xcschemes/AFNetworking OS X.xcscheme

@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <Scheme
-   LastUpgradeVersion = "0700"
+   LastUpgradeVersion = "0800"
    version = "1.3">
    <BuildAction
       parallelizeBuildables = "YES"

+ 10 - 2
AFNetworking.xcodeproj/xcshareddata/xcschemes/AFNetworking iOS.xcscheme

@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <Scheme
-   LastUpgradeVersion = "0700"
+   LastUpgradeVersion = "0800"
    version = "1.3">
    <BuildAction
       parallelizeBuildables = "YES"
@@ -41,7 +41,8 @@
       selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
       selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
       shouldUseLaunchSchemeArgsEnv = "YES"
-      codeCoverageEnabled = "YES">
+      codeCoverageEnabled = "YES"
+      enableAddressSanitizer = "YES">
       <Testables>
          <TestableReference
             skipped = "NO">
@@ -90,6 +91,13 @@
             ReferencedContainer = "container:AFNetworking.xcodeproj">
          </BuildableReference>
       </MacroExpansion>
+      <EnvironmentVariables>
+         <EnvironmentVariable
+            key = "OS_ACTIVITY_MODE"
+            value = "disable"
+            isEnabled = "YES">
+         </EnvironmentVariable>
+      </EnvironmentVariables>
       <AdditionalOptions>
       </AdditionalOptions>
    </LaunchAction>

+ 22 - 2
AFNetworking.xcodeproj/xcshareddata/xcschemes/AFNetworking tvOS.xcscheme

@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <Scheme
-   LastUpgradeVersion = "0710"
+   LastUpgradeVersion = "0800"
    version = "1.3">
    <BuildAction
       parallelizeBuildables = "YES"
@@ -26,7 +26,8 @@
       buildConfiguration = "Debug"
       selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
       selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
-      shouldUseLaunchSchemeArgsEnv = "YES">
+      shouldUseLaunchSchemeArgsEnv = "YES"
+      enableAddressSanitizer = "YES">
       <Testables>
          <TestableReference
             skipped = "NO">
@@ -54,6 +55,11 @@
          </BuildableReference>
       </MacroExpansion>
       <AdditionalOptions>
+         <AdditionalOption
+            key = "NSZombieEnabled"
+            value = "YES"
+            isEnabled = "YES">
+         </AdditionalOption>
       </AdditionalOptions>
    </TestAction>
    <LaunchAction
@@ -64,6 +70,8 @@
       useCustomWorkingDirectory = "NO"
       ignoresPersistentStateOnLaunch = "NO"
       debugDocumentVersioning = "YES"
+      enableThreadSanitizer = "YES"
+      stopOnEveryThreadSanitizerIssue = "YES"
       debugServiceExtension = "internal"
       allowLocationSimulation = "YES">
       <MacroExpansion>
@@ -75,7 +83,19 @@
             ReferencedContainer = "container:AFNetworking.xcodeproj">
          </BuildableReference>
       </MacroExpansion>
+      <EnvironmentVariables>
+         <EnvironmentVariable
+            key = "OS_ACTIVITY_MODE"
+            value = "disable"
+            isEnabled = "YES">
+         </EnvironmentVariable>
+      </EnvironmentVariables>
       <AdditionalOptions>
+         <AdditionalOption
+            key = "NSZombieEnabled"
+            value = "YES"
+            isEnabled = "YES">
+         </AdditionalOption>
       </AdditionalOptions>
    </LaunchAction>
    <ProfileAction

+ 1 - 1
AFNetworking.xcodeproj/xcshareddata/xcschemes/AFNetworking watchOS.xcscheme

@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <Scheme
-   LastUpgradeVersion = "0710"
+   LastUpgradeVersion = "0800"
    version = "1.3">
    <BuildAction
       parallelizeBuildables = "YES"

+ 3 - 0
Example/AFNetworking Example.xcodeproj/project.pbxproj

@@ -513,6 +513,7 @@
 					};
 					291BFE141BB9ECEE00FFB029 = {
 						CreatedOnToolsVersion = 7.1;
+						LastSwiftMigration = 0800;
 					};
 					29E6F1741BB9DCB500A4466C = {
 						CreatedOnToolsVersion = 7.1;
@@ -1019,6 +1020,7 @@
 				SDKROOT = appletvos;
 				SWIFT_OBJC_BRIDGING_HEADER = "$(PROJECT_DIR)/tvOS Example/AFNetworking tvOS Example-Bridging-Header.h";
 				SWIFT_OPTIMIZATION_LEVEL = "-Onone";
+				SWIFT_VERSION = 3.0;
 				TARGETED_DEVICE_FAMILY = 3;
 				TVOS_DEPLOYMENT_TARGET = 9.0;
 			};
@@ -1062,6 +1064,7 @@
 				PRODUCT_NAME = "$(TARGET_NAME)";
 				SDKROOT = appletvos;
 				SWIFT_OBJC_BRIDGING_HEADER = "$(PROJECT_DIR)/tvOS Example/AFNetworking tvOS Example-Bridging-Header.h";
+				SWIFT_VERSION = 3.0;
 				TARGETED_DEVICE_FAMILY = 3;
 				TVOS_DEPLOYMENT_TARGET = 9.0;
 				VALIDATE_PRODUCT = YES;

+ 1 - 1
Example/AFNetworking Example.xcodeproj/xcshareddata/xcschemes/OS X Example.xcscheme

@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <Scheme
-   LastUpgradeVersion = "0710"
+   LastUpgradeVersion = "0800"
    version = "1.3">
    <BuildAction
       parallelizeBuildables = "YES"

+ 1 - 1
Example/AFNetworking Example.xcodeproj/xcshareddata/xcschemes/Today Extension Example.xcscheme

@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <Scheme
-   LastUpgradeVersion = "0710"
+   LastUpgradeVersion = "0800"
    wasCreatedForAppExtension = "YES"
    version = "2.0">
    <BuildAction

+ 1 - 1
Example/AFNetworking Example.xcodeproj/xcshareddata/xcschemes/iOS Example.xcscheme

@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <Scheme
-   LastUpgradeVersion = "0710"
+   LastUpgradeVersion = "0800"
    version = "1.3">
    <BuildAction
       parallelizeBuildables = "YES"

+ 4 - 4
Example/AFNetworking Example.xcodeproj/xcshareddata/xcschemes/tvOS Example.xcscheme

@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <Scheme
-   LastUpgradeVersion = "0710"
+   LastUpgradeVersion = "0800"
    version = "1.3">
    <BuildAction
       parallelizeBuildables = "YES"
@@ -14,9 +14,9 @@
             buildForAnalyzing = "YES">
             <BuildableReference
                BuildableIdentifier = "primary"
-               BlueprintIdentifier = "298D7C3A1BC2C79500FD3B3E"
-               BuildableName = "AFNetworking iOS Tests.xctest"
-               BlueprintName = "AFNetworking iOS Tests"
+               BlueprintIdentifier = "2987B0AD1BC408A200179A4C"
+               BuildableName = "AFNetworking tvOS Tests.xctest"
+               BlueprintName = "AFNetworking tvOS Tests"
                ReferencedContainer = "container:../AFNetworking.xcodeproj">
             </BuildableReference>
          </BuildActionEntry>

+ 1 - 1
Example/AFNetworking Example.xcodeproj/xcshareddata/xcschemes/watchOS Example.xcscheme

@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <Scheme
-   LastUpgradeVersion = "0710"
+   LastUpgradeVersion = "0800"
    version = "1.3">
    <BuildAction
       parallelizeBuildables = "YES"

+ 6 - 6
Example/tvOS Example/AppDelegate.swift

@@ -27,30 +27,30 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
     var window: UIWindow?
 
 
-    func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
+    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
         // Override point for customization after application launch.
         return true
     }
 
-    func applicationWillResignActive(application: UIApplication) {
+    func applicationWillResignActive(_ application: UIApplication) {
         // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
         // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
     }
 
-    func applicationDidEnterBackground(application: UIApplication) {
+    func applicationDidEnterBackground(_ application: UIApplication) {
         // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
         // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
     }
 
-    func applicationWillEnterForeground(application: UIApplication) {
+    func applicationWillEnterForeground(_ application: UIApplication) {
         // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
     }
 
-    func applicationDidBecomeActive(application: UIApplication) {
+    func applicationDidBecomeActive(_ application: UIApplication) {
         // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
     }
 
-    func applicationWillTerminate(application: UIApplication) {
+    func applicationWillTerminate(_ application: UIApplication) {
         // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
     }
 

+ 17 - 17
Example/tvOS Example/Gravatar.swift

@@ -25,11 +25,11 @@ import UIKit
 
 private extension String  {
     var md5_hash: String {
-        let trimmedString = lowercaseString.stringByTrimmingCharactersInSet(NSCharacterSet.whitespaceCharacterSet())
-        let utf8String = trimmedString.cStringUsingEncoding(NSUTF8StringEncoding)!
-        let stringLength = CC_LONG(trimmedString.lengthOfBytesUsingEncoding(NSUTF8StringEncoding))
+        let trimmedString = lowercased().trimmingCharacters(in: CharacterSet.whitespaces)
+        let utf8String = trimmedString.cString(using: String.Encoding.utf8)!
+        let stringLength = CC_LONG(trimmedString.lengthOfBytes(using: String.Encoding.utf8))
         let digestLength = Int(CC_MD5_DIGEST_LENGTH)
-        let result = UnsafeMutablePointer<CUnsignedChar>.alloc(digestLength)
+        let result = UnsafeMutablePointer<CUnsignedChar>.allocate(capacity: digestLength)
 
         CC_MD5(utf8String, stringLength, result)
 
@@ -39,7 +39,7 @@ private extension String  {
             hash += String(format: "%02x", result[i])
         }
 
-        result.dealloc(digestLength)
+        result.deallocate(capacity: digestLength)
 
         return String(format: hash)
     }
@@ -48,7 +48,7 @@ private extension String  {
 // MARK: - QueryItemConvertible
 
 private protocol QueryItemConvertible {
-    var queryItem: NSURLQueryItem {get}
+    var queryItem: URLQueryItem {get}
 }
 
 // MARK: -
@@ -63,8 +63,8 @@ public struct Gravatar {
         case Retro = "retro"
         case Blank = "blank"
 
-        var queryItem: NSURLQueryItem {
-            return NSURLQueryItem(name: "d", value: rawValue)
+        var queryItem: URLQueryItem {
+            return URLQueryItem(name: "d", value: rawValue)
         }
     }
 
@@ -74,8 +74,8 @@ public struct Gravatar {
         case R = "r"
         case X = "x"
 
-        var queryItem: NSURLQueryItem {
-            return NSURLQueryItem(name: "r", value: rawValue)
+        var queryItem: URLQueryItem {
+            return URLQueryItem(name: "r", value: rawValue)
         }
     }
 
@@ -84,7 +84,7 @@ public struct Gravatar {
     public let defaultImage: DefaultImage
     public let rating: Rating
 
-    private static let baseURL = NSURL(string: "https://secure.gravatar.com/avatar")!
+    fileprivate static let baseURL = Foundation.URL(string: "https://secure.gravatar.com/avatar")!
 
     public init(
         emailAddress: String,
@@ -98,16 +98,16 @@ public struct Gravatar {
         self.rating = rating
     }
 
-    public func URL(size size: CGFloat, scale: CGFloat = UIScreen.mainScreen().scale) -> NSURL {
-        let URL = Gravatar.baseURL.URLByAppendingPathComponent(email.md5_hash)
-        let components = NSURLComponents(URL: URL, resolvingAgainstBaseURL: false)!
+    public func URL(size: CGFloat, scale: CGFloat = UIScreen.main.scale) -> Foundation.URL {
+        let URL = Gravatar.baseURL.appendingPathComponent(email.md5_hash)
+        var components = URLComponents(url: URL, resolvingAgainstBaseURL: false)!
 
         var queryItems = [defaultImage.queryItem, rating.queryItem]
-        queryItems.append(NSURLQueryItem(name: "f", value: forceDefault ? "y" : "n"))
-        queryItems.append(NSURLQueryItem(name: "s", value: String(format: "%.0f",size * scale)))
+        queryItems.append(URLQueryItem(name: "f", value: forceDefault ? "y" : "n"))
+        queryItems.append(URLQueryItem(name: "s", value: String(format: "%.0f",size * scale)))
 
         components.queryItems = queryItems
 
-        return components.URL!
+        return components.url!
     }
 }

+ 8 - 8
Example/tvOS Example/ViewController.swift

@@ -31,7 +31,7 @@ class ViewController: UIViewController, UICollectionViewDataSource, UICollection
 
         for _ in 1...100 {
             let gravatar = Gravatar(
-                emailAddress: NSUUID().UUIDString,
+                emailAddress: UUID().uuidString,
                 defaultImage: Gravatar.DefaultImage.Identicon,
                 forceDefault: true
             )
@@ -45,21 +45,21 @@ class ViewController: UIViewController, UICollectionViewDataSource, UICollection
         // Dispose of any resources that can be recreated.
     }
 
-    func collectionView(collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
+    func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
         return gravatars.count
     }
 
-    func numberOfSectionsInCollectionView(collectionView: UICollectionView) -> Int {
+    func numberOfSections(in collectionView: UICollectionView) -> Int {
         return 1
     }
 
-    func collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -> UICollectionViewCell {
-        let cell = collectionView.dequeueReusableCellWithReuseIdentifier("CollectionViewCell", forIndexPath: indexPath) as! CollectionViewCell
-        cell.update(forGravatar: gravatars[indexPath.item])
+    func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
+        let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "CollectionViewCell", for: indexPath) as! CollectionViewCell
+        cell.update(forGravatar: gravatars[(indexPath as NSIndexPath).item])
         return cell
     }
 
-    func collectionView(collectionView: UICollectionView, canFocusItemAtIndexPath indexPath: NSIndexPath) -> Bool {
+    func collectionView(_ collectionView: UICollectionView, canFocusItemAt indexPath: IndexPath) -> Bool {
         return true
     }
 
@@ -73,7 +73,7 @@ class CollectionViewCell : UICollectionViewCell {
     }
 
     func update(forGravatar gravatar:Gravatar) {
-        self.avatarView.setImageWithURL(gravatar.URL(size: self.bounds.size.width))
+        self.avatarView.setImageWith(gravatar.URL(size: self.bounds.size.width) as URL)
     }
 }
 

+ 4 - 4
fastlane/.env.default

@@ -1,15 +1,15 @@
-AF_IOS_SDK=iphonesimulator9.3
+AF_IOS_SDK=iphonesimulator10.0
 AF_MAC_SDK=macosx10.11
-AF_TVOS_SDK=appletvsimulator9.2
+AF_TVOS_SDK=appletvsimulator10.0
 
 AF_CONFIGURATION=Release
 
 SCAN_WORKSPACE=$AF_WORKSPACE
 SCAN_SCHEME=$AF_IOS_FRAMEWORK_SCHEME
-SCAN_DESTINATION="OS=9.2,name=iPhone 6s"
+SCAN_DEVICE="iPhone 7"
 SCAN_SDK=$AF_IOS_SDK
 SCAN_OUTPUT_DIRECTORY=fastlane/test-output
 
 EXAMPLE_WORKSPACE=$AF_WORKSPACE
 EXAMPLE_SCHEME=$AF_IOS_EXAMPLE_SCHEME
-EXAMPLE_DESTINATION=$SCAN_DESTINATION
+EXAMPLE_DESTINATION="platform=iOS Simulator,name=iPhone 7"

+ 3 - 0
fastlane/.env.ios10_xcode8

@@ -0,0 +1,3 @@
+SCAN_DEVICE="iPhone 7"
+SCAN_SDK=$AF_IOS_SDK
+EXAMPLE_DESTINATION="platform=iOS Simulator,name=iPhone 7"

+ 3 - 3
fastlane/.env.ios81_xcode7

@@ -1,3 +1,3 @@
-SCAN_DESTINATION="OS=8.1,name=iPhone 4S"
-EXAMPLE_DESTINATION=$SCAN_DESTINATION
-SCAN_SDK=iphonesimulator9.0
+SCAN_DEVICE="iPhone 4S"
+SCAN_SDK=iphonesimulator9.0
+EXAMPLE_DESTINATION="platform=iOS Simulator,name=iPhone 4S"

+ 0 - 2
fastlane/.env.ios83

@@ -1,2 +0,0 @@
-SCAN_DESTINATION="OS=8.3,name=iPhone 5S"
-EXAMPLE_DESTINATION=$SCAN_DESTINATION

+ 0 - 2
fastlane/.env.ios84

@@ -1,2 +0,0 @@
-SCAN_DESTINATION="OS=8.4,name=iPhone 6"
-EXAMPLE_DESTINATION=$SCAN_DESTINATION

+ 0 - 3
fastlane/.env.ios90_xcode7

@@ -1,3 +0,0 @@
-SCAN_DESTINATION="OS=9.0,name=iPhone 6 Plus"
-EXAMPLE_DESTINATION=$SCAN_DESTINATION
-SCAN_SDK=iphonesimulator9.0

+ 0 - 3
fastlane/.env.ios91_xcode71

@@ -1,3 +0,0 @@
-SCAN_DESTINATION="OS=9.1,name=iPhone 6s"
-EXAMPLE_DESTINATION=$SCAN_DESTINATION
-SCAN_SDK=iphonesimulator9.1

+ 0 - 3
fastlane/.env.ios92_xcode72

@@ -1,3 +0,0 @@
-SCAN_DESTINATION="OS=9.2,name=iPhone 6s"
-EXAMPLE_DESTINATION=$SCAN_DESTINATION
-SCAN_SDK=iphonesimulator9.2

+ 3 - 2
fastlane/.env.ios93_xcode73

@@ -1,2 +1,3 @@
-SCAN_DESTINATION="OS=9.3,name=iPhone 6s"
-EXAMPLE_DESTINATION=$SCAN_DESTINATION
+SCAN_DEVICE="iPhone 6s"
+SCAN_SDK=iphonesimulator9.3
+EXAMPLE_DESTINATION="platform=iOS Simulator,name=iPhone 6s"

+ 1 - 2
fastlane/.env.osx

@@ -1,6 +1,5 @@
 SCAN_SCHEME=$AF_OSX_FRAMEWORK_SCHEME
-SCAN_DESTINATION="arch=x86_64"
 SCAN_SDK=$AF_OSX_SDK
 
 EXAMPLE_SCHEME=$AF_OSX_EXAMPLE_SCHEME
-EXAMPLE_DESTINATION=$SCAN_DESTINATION
+EXAMPLE_DESTINATION="platform=macOS"

+ 2 - 2
fastlane/.env.tvos92 → fastlane/.env.tvos10_xcode8

@@ -1,6 +1,6 @@
 SCAN_SCHEME=$AF_TVOS_FRAMEWORK_SCHEME
-SCAN_DESTINATION="OS=9.2,name=Apple TV 1080p"
+SCAN_DEVICE="Apple TV 1080p"
 SCAN_SDK=$AF_TVOS_SDK
 
 EXAMPLE_SCHEME=$AF_TVOS_EXAMPLE_SCHEME
-EXAMPLE_DESTINATION=$SCAN_DESTINATION
+EXAMPLE_DESTINATION="platform=tvOS Simulator,name=Apple TV 1080p"

+ 0 - 6
fastlane/.env.tvos90_xcode71

@@ -1,6 +0,0 @@
-SCAN_SCHEME=$AF_TVOS_FRAMEWORK_SCHEME
-SCAN_DESTINATION="OS=9.0,name=Apple TV 1080p"
-SCAN_SDK=appletvsimulator9.0
-
-EXAMPLE_SCHEME=$AF_TVOS_EXAMPLE_SCHEME
-EXAMPLE_DESTINATION=$SCAN_DESTINATION