Pārlūkot izejas kodu

Merge branch 'swift-2'

* swift-2:
  Add *.xcscmblueprint to .gitignore
  osx_image: xcode7
  Update to recommended settings by Xcode 7 beta 6
  Convert to latest swift syntax and omit some external parameter name
  carthage update
  Update to swift on XCode 7 Beta 6
  Update to Swift 2.0
Norio Nomura 10 gadi atpakaļ
vecāks
revīzija
5f05b90974

+ 1 - 0
.gitignore

@@ -16,6 +16,7 @@ DerivedData
 *.hmap
 *.hmap
 *.ipa
 *.ipa
 *.xcuserstate
 *.xcuserstate
+*.xcscmblueprint
 
 
 Carthage.pkg
 Carthage.pkg
 Carthage/Build
 Carthage/Build

+ 1 - 1
.travis.yml

@@ -1,5 +1,5 @@
 language: objective-c
 language: objective-c
-osx_image: xcode6.4
+osx_image: xcode7
 cache:
 cache:
   directories:
   directories:
   - vendor/bundle
   - vendor/bundle

+ 18 - 1
Base32.xcodeproj/project.pbxproj

@@ -422,7 +422,9 @@
 		6CA0A78F1A74E80600AC539F /* Project object */ = {
 		6CA0A78F1A74E80600AC539F /* Project object */ = {
 			isa = PBXProject;
 			isa = PBXProject;
 			attributes = {
 			attributes = {
-				LastUpgradeCheck = 0610;
+				LastSwiftMigration = 0700;
+				LastSwiftUpdateCheck = 0700;
+				LastUpgradeCheck = 0700;
 				ORGANIZATIONNAME = "Norio Nomura";
 				ORGANIZATIONNAME = "Norio Nomura";
 				TargetAttributes = {
 				TargetAttributes = {
 					6CA0A7971A74E80600AC539F = {
 					6CA0A7971A74E80600AC539F = {
@@ -581,6 +583,7 @@
 			buildSettings = {
 			buildSettings = {
 				"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
 				"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
 				CURRENT_PROJECT_VERSION = 1;
 				CURRENT_PROJECT_VERSION = 1;
+				ENABLE_TESTABILITY = YES;
 				GCC_NO_COMMON_BLOCKS = YES;
 				GCC_NO_COMMON_BLOCKS = YES;
 				IPHONEOS_DEPLOYMENT_TARGET = 8.0;
 				IPHONEOS_DEPLOYMENT_TARGET = 8.0;
 				MACOSX_DEPLOYMENT_TARGET = 10.9;
 				MACOSX_DEPLOYMENT_TARGET = 10.9;
@@ -610,9 +613,11 @@
 			isa = XCBuildConfiguration;
 			isa = XCBuildConfiguration;
 			baseConfigurationReference = 6CA0A7CB1A74E88E00AC539F /* Mac-Framework.xcconfig */;
 			baseConfigurationReference = 6CA0A7CB1A74E88E00AC539F /* Mac-Framework.xcconfig */;
 			buildSettings = {
 			buildSettings = {
+				APPLICATION_EXTENSION_API_ONLY = YES;
 				DYLIB_COMPATIBILITY_VERSION = 1;
 				DYLIB_COMPATIBILITY_VERSION = 1;
 				DYLIB_CURRENT_VERSION = 1;
 				DYLIB_CURRENT_VERSION = 1;
 				INFOPLIST_FILE = Base32/Info.plist;
 				INFOPLIST_FILE = Base32/Info.plist;
+				PRODUCT_BUNDLE_IDENTIFIER = "io.github.norio-nomura.$(PRODUCT_NAME:rfc1034identifier)";
 			};
 			};
 			name = Debug;
 			name = Debug;
 		};
 		};
@@ -620,9 +625,11 @@
 			isa = XCBuildConfiguration;
 			isa = XCBuildConfiguration;
 			baseConfigurationReference = 6CA0A7CB1A74E88E00AC539F /* Mac-Framework.xcconfig */;
 			baseConfigurationReference = 6CA0A7CB1A74E88E00AC539F /* Mac-Framework.xcconfig */;
 			buildSettings = {
 			buildSettings = {
+				APPLICATION_EXTENSION_API_ONLY = YES;
 				DYLIB_COMPATIBILITY_VERSION = 1;
 				DYLIB_COMPATIBILITY_VERSION = 1;
 				DYLIB_CURRENT_VERSION = 1;
 				DYLIB_CURRENT_VERSION = 1;
 				INFOPLIST_FILE = Base32/Info.plist;
 				INFOPLIST_FILE = Base32/Info.plist;
+				PRODUCT_BUNDLE_IDENTIFIER = "io.github.norio-nomura.$(PRODUCT_NAME:rfc1034identifier)";
 			};
 			};
 			name = Release;
 			name = Release;
 		};
 		};
@@ -631,6 +638,7 @@
 			baseConfigurationReference = 6CA0A7C81A74E88E00AC539F /* Mac-Application.xcconfig */;
 			baseConfigurationReference = 6CA0A7C81A74E88E00AC539F /* Mac-Application.xcconfig */;
 			buildSettings = {
 			buildSettings = {
 				INFOPLIST_FILE = Base32Tests/Info.plist;
 				INFOPLIST_FILE = Base32Tests/Info.plist;
+				PRODUCT_BUNDLE_IDENTIFIER = "io.github.norio-nomura.$(PRODUCT_NAME:rfc1034identifier)";
 				PRODUCT_NAME = "$(TARGET_NAME)";
 				PRODUCT_NAME = "$(TARGET_NAME)";
 			};
 			};
 			name = Debug;
 			name = Debug;
@@ -640,6 +648,7 @@
 			baseConfigurationReference = 6CA0A7C81A74E88E00AC539F /* Mac-Application.xcconfig */;
 			baseConfigurationReference = 6CA0A7C81A74E88E00AC539F /* Mac-Application.xcconfig */;
 			buildSettings = {
 			buildSettings = {
 				INFOPLIST_FILE = Base32Tests/Info.plist;
 				INFOPLIST_FILE = Base32Tests/Info.plist;
+				PRODUCT_BUNDLE_IDENTIFIER = "io.github.norio-nomura.$(PRODUCT_NAME:rfc1034identifier)";
 				PRODUCT_NAME = "$(TARGET_NAME)";
 				PRODUCT_NAME = "$(TARGET_NAME)";
 			};
 			};
 			name = Release;
 			name = Release;
@@ -648,9 +657,11 @@
 			isa = XCBuildConfiguration;
 			isa = XCBuildConfiguration;
 			baseConfigurationReference = 6CA0A7C51A74E88E00AC539F /* iOS-Framework.xcconfig */;
 			baseConfigurationReference = 6CA0A7C51A74E88E00AC539F /* iOS-Framework.xcconfig */;
 			buildSettings = {
 			buildSettings = {
+				APPLICATION_EXTENSION_API_ONLY = YES;
 				DYLIB_COMPATIBILITY_VERSION = 1;
 				DYLIB_COMPATIBILITY_VERSION = 1;
 				DYLIB_CURRENT_VERSION = 1;
 				DYLIB_CURRENT_VERSION = 1;
 				INFOPLIST_FILE = Base32/Info.plist;
 				INFOPLIST_FILE = Base32/Info.plist;
+				PRODUCT_BUNDLE_IDENTIFIER = "io.github.norio-nomura.$(PRODUCT_NAME:rfc1034identifier)";
 			};
 			};
 			name = Debug;
 			name = Debug;
 		};
 		};
@@ -658,9 +669,11 @@
 			isa = XCBuildConfiguration;
 			isa = XCBuildConfiguration;
 			baseConfigurationReference = 6CA0A7C51A74E88E00AC539F /* iOS-Framework.xcconfig */;
 			baseConfigurationReference = 6CA0A7C51A74E88E00AC539F /* iOS-Framework.xcconfig */;
 			buildSettings = {
 			buildSettings = {
+				APPLICATION_EXTENSION_API_ONLY = YES;
 				DYLIB_COMPATIBILITY_VERSION = 1;
 				DYLIB_COMPATIBILITY_VERSION = 1;
 				DYLIB_CURRENT_VERSION = 1;
 				DYLIB_CURRENT_VERSION = 1;
 				INFOPLIST_FILE = Base32/Info.plist;
 				INFOPLIST_FILE = Base32/Info.plist;
+				PRODUCT_BUNDLE_IDENTIFIER = "io.github.norio-nomura.$(PRODUCT_NAME:rfc1034identifier)";
 			};
 			};
 			name = Release;
 			name = Release;
 		};
 		};
@@ -669,6 +682,7 @@
 			baseConfigurationReference = 6CA0A7C31A74E88E00AC539F /* iOS-Application.xcconfig */;
 			baseConfigurationReference = 6CA0A7C31A74E88E00AC539F /* iOS-Application.xcconfig */;
 			buildSettings = {
 			buildSettings = {
 				INFOPLIST_FILE = Base32Tests/Info.plist;
 				INFOPLIST_FILE = Base32Tests/Info.plist;
+				PRODUCT_BUNDLE_IDENTIFIER = "io.github.norio-nomura.$(PRODUCT_NAME:rfc1034identifier)";
 				PRODUCT_NAME = "$(TARGET_NAME)";
 				PRODUCT_NAME = "$(TARGET_NAME)";
 			};
 			};
 			name = Debug;
 			name = Debug;
@@ -678,6 +692,7 @@
 			baseConfigurationReference = 6CA0A7C31A74E88E00AC539F /* iOS-Application.xcconfig */;
 			baseConfigurationReference = 6CA0A7C31A74E88E00AC539F /* iOS-Application.xcconfig */;
 			buildSettings = {
 			buildSettings = {
 				INFOPLIST_FILE = Base32Tests/Info.plist;
 				INFOPLIST_FILE = Base32Tests/Info.plist;
+				PRODUCT_BUNDLE_IDENTIFIER = "io.github.norio-nomura.$(PRODUCT_NAME:rfc1034identifier)";
 				PRODUCT_NAME = "$(TARGET_NAME)";
 				PRODUCT_NAME = "$(TARGET_NAME)";
 			};
 			};
 			name = Release;
 			name = Release;
@@ -687,6 +702,7 @@
 			baseConfigurationReference = 6CA0A7C81A74E88E00AC539F /* Mac-Application.xcconfig */;
 			baseConfigurationReference = 6CA0A7C81A74E88E00AC539F /* Mac-Application.xcconfig */;
 			buildSettings = {
 			buildSettings = {
 				INFOPLIST_FILE = SecEncodeTransformTests/Info.plist;
 				INFOPLIST_FILE = SecEncodeTransformTests/Info.plist;
+				PRODUCT_BUNDLE_IDENTIFIER = "io.github.norio-nomura.$(PRODUCT_NAME:rfc1034identifier)";
 				PRODUCT_NAME = "$(TARGET_NAME)";
 				PRODUCT_NAME = "$(TARGET_NAME)";
 				SWIFT_OBJC_BRIDGING_HEADER = "SecEncodeTransformTests/SecEncodeTransformTests-Bridging-Header.h";
 				SWIFT_OBJC_BRIDGING_HEADER = "SecEncodeTransformTests/SecEncodeTransformTests-Bridging-Header.h";
 			};
 			};
@@ -697,6 +713,7 @@
 			baseConfigurationReference = 6CA0A7C81A74E88E00AC539F /* Mac-Application.xcconfig */;
 			baseConfigurationReference = 6CA0A7C81A74E88E00AC539F /* Mac-Application.xcconfig */;
 			buildSettings = {
 			buildSettings = {
 				INFOPLIST_FILE = SecEncodeTransformTests/Info.plist;
 				INFOPLIST_FILE = SecEncodeTransformTests/Info.plist;
+				PRODUCT_BUNDLE_IDENTIFIER = "io.github.norio-nomura.$(PRODUCT_NAME:rfc1034identifier)";
 				PRODUCT_NAME = "$(TARGET_NAME)";
 				PRODUCT_NAME = "$(TARGET_NAME)";
 				SWIFT_OBJC_BRIDGING_HEADER = "SecEncodeTransformTests/SecEncodeTransformTests-Bridging-Header.h";
 				SWIFT_OBJC_BRIDGING_HEADER = "SecEncodeTransformTests/SecEncodeTransformTests-Bridging-Header.h";
 			};
 			};

+ 8 - 5
Base32.xcodeproj/xcshareddata/xcschemes/Base32-Mac.xcscheme

@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <?xml version="1.0" encoding="UTF-8"?>
 <Scheme
 <Scheme
-   LastUpgradeVersion = "0610"
+   LastUpgradeVersion = "0700"
    version = "1.3">
    version = "1.3">
    <BuildAction
    <BuildAction
       parallelizeBuildables = "YES"
       parallelizeBuildables = "YES"
@@ -37,10 +37,10 @@
       </BuildActionEntries>
       </BuildActionEntries>
    </BuildAction>
    </BuildAction>
    <TestAction
    <TestAction
+      buildConfiguration = "Release"
       selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
       selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
       selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
       selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
-      shouldUseLaunchSchemeArgsEnv = "YES"
-      buildConfiguration = "Release">
+      shouldUseLaunchSchemeArgsEnv = "YES">
       <Testables>
       <Testables>
          <TestableReference
          <TestableReference
             skipped = "NO">
             skipped = "NO">
@@ -67,15 +67,18 @@
             ReferencedContainer = "container:Base32.xcodeproj">
             ReferencedContainer = "container:Base32.xcodeproj">
          </BuildableReference>
          </BuildableReference>
       </MacroExpansion>
       </MacroExpansion>
+      <AdditionalOptions>
+      </AdditionalOptions>
    </TestAction>
    </TestAction>
    <LaunchAction
    <LaunchAction
+      buildConfiguration = "Debug"
       selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
       selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
       selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
       selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
       launchStyle = "0"
       launchStyle = "0"
       useCustomWorkingDirectory = "NO"
       useCustomWorkingDirectory = "NO"
-      buildConfiguration = "Debug"
       ignoresPersistentStateOnLaunch = "NO"
       ignoresPersistentStateOnLaunch = "NO"
       debugDocumentVersioning = "YES"
       debugDocumentVersioning = "YES"
+      debugServiceExtension = "internal"
       allowLocationSimulation = "YES">
       allowLocationSimulation = "YES">
       <MacroExpansion>
       <MacroExpansion>
          <BuildableReference
          <BuildableReference
@@ -90,10 +93,10 @@
       </AdditionalOptions>
       </AdditionalOptions>
    </LaunchAction>
    </LaunchAction>
    <ProfileAction
    <ProfileAction
+      buildConfiguration = "Release"
       shouldUseLaunchSchemeArgsEnv = "YES"
       shouldUseLaunchSchemeArgsEnv = "YES"
       savedToolIdentifier = ""
       savedToolIdentifier = ""
       useCustomWorkingDirectory = "NO"
       useCustomWorkingDirectory = "NO"
-      buildConfiguration = "Release"
       debugDocumentVersioning = "YES">
       debugDocumentVersioning = "YES">
       <MacroExpansion>
       <MacroExpansion>
          <BuildableReference
          <BuildableReference

+ 8 - 5
Base32.xcodeproj/xcshareddata/xcschemes/Base32-iOS.xcscheme

@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <?xml version="1.0" encoding="UTF-8"?>
 <Scheme
 <Scheme
-   LastUpgradeVersion = "0610"
+   LastUpgradeVersion = "0700"
    version = "1.3">
    version = "1.3">
    <BuildAction
    <BuildAction
       parallelizeBuildables = "YES"
       parallelizeBuildables = "YES"
@@ -37,10 +37,10 @@
       </BuildActionEntries>
       </BuildActionEntries>
    </BuildAction>
    </BuildAction>
    <TestAction
    <TestAction
+      buildConfiguration = "Release"
       selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
       selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
       selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
       selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
-      shouldUseLaunchSchemeArgsEnv = "YES"
-      buildConfiguration = "Release">
+      shouldUseLaunchSchemeArgsEnv = "YES">
       <Testables>
       <Testables>
          <TestableReference
          <TestableReference
             skipped = "NO">
             skipped = "NO">
@@ -62,15 +62,18 @@
             ReferencedContainer = "container:Base32.xcodeproj">
             ReferencedContainer = "container:Base32.xcodeproj">
          </BuildableReference>
          </BuildableReference>
       </MacroExpansion>
       </MacroExpansion>
+      <AdditionalOptions>
+      </AdditionalOptions>
    </TestAction>
    </TestAction>
    <LaunchAction
    <LaunchAction
+      buildConfiguration = "Debug"
       selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
       selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
       selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
       selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
       launchStyle = "0"
       launchStyle = "0"
       useCustomWorkingDirectory = "NO"
       useCustomWorkingDirectory = "NO"
-      buildConfiguration = "Debug"
       ignoresPersistentStateOnLaunch = "NO"
       ignoresPersistentStateOnLaunch = "NO"
       debugDocumentVersioning = "YES"
       debugDocumentVersioning = "YES"
+      debugServiceExtension = "internal"
       allowLocationSimulation = "YES">
       allowLocationSimulation = "YES">
       <MacroExpansion>
       <MacroExpansion>
          <BuildableReference
          <BuildableReference
@@ -85,10 +88,10 @@
       </AdditionalOptions>
       </AdditionalOptions>
    </LaunchAction>
    </LaunchAction>
    <ProfileAction
    <ProfileAction
+      buildConfiguration = "Release"
       shouldUseLaunchSchemeArgsEnv = "YES"
       shouldUseLaunchSchemeArgsEnv = "YES"
       savedToolIdentifier = ""
       savedToolIdentifier = ""
       useCustomWorkingDirectory = "NO"
       useCustomWorkingDirectory = "NO"
-      buildConfiguration = "Release"
       debugDocumentVersioning = "YES">
       debugDocumentVersioning = "YES">
       <MacroExpansion>
       <MacroExpansion>
          <BuildableReference
          <BuildableReference

+ 8 - 5
Base32.xcodeproj/xcshareddata/xcschemes/SecEncodeTransformTests.xcscheme

@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <?xml version="1.0" encoding="UTF-8"?>
 <Scheme
 <Scheme
-   LastUpgradeVersion = "0610"
+   LastUpgradeVersion = "0700"
    version = "1.3">
    version = "1.3">
    <BuildAction
    <BuildAction
       parallelizeBuildables = "YES"
       parallelizeBuildables = "YES"
@@ -23,10 +23,10 @@
       </BuildActionEntries>
       </BuildActionEntries>
    </BuildAction>
    </BuildAction>
    <TestAction
    <TestAction
+      buildConfiguration = "Release"
       selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
       selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
       selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
       selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
-      shouldUseLaunchSchemeArgsEnv = "YES"
-      buildConfiguration = "Release">
+      shouldUseLaunchSchemeArgsEnv = "YES">
       <Testables>
       <Testables>
          <TestableReference
          <TestableReference
             skipped = "NO">
             skipped = "NO">
@@ -48,15 +48,18 @@
             ReferencedContainer = "container:Base32.xcodeproj">
             ReferencedContainer = "container:Base32.xcodeproj">
          </BuildableReference>
          </BuildableReference>
       </MacroExpansion>
       </MacroExpansion>
+      <AdditionalOptions>
+      </AdditionalOptions>
    </TestAction>
    </TestAction>
    <LaunchAction
    <LaunchAction
+      buildConfiguration = "Debug"
       selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
       selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
       selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
       selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
       launchStyle = "0"
       launchStyle = "0"
       useCustomWorkingDirectory = "NO"
       useCustomWorkingDirectory = "NO"
-      buildConfiguration = "Debug"
       ignoresPersistentStateOnLaunch = "NO"
       ignoresPersistentStateOnLaunch = "NO"
       debugDocumentVersioning = "YES"
       debugDocumentVersioning = "YES"
+      debugServiceExtension = "internal"
       allowLocationSimulation = "YES">
       allowLocationSimulation = "YES">
       <MacroExpansion>
       <MacroExpansion>
          <BuildableReference
          <BuildableReference
@@ -71,10 +74,10 @@
       </AdditionalOptions>
       </AdditionalOptions>
    </LaunchAction>
    </LaunchAction>
    <ProfileAction
    <ProfileAction
+      buildConfiguration = "Release"
       shouldUseLaunchSchemeArgsEnv = "YES"
       shouldUseLaunchSchemeArgsEnv = "YES"
       savedToolIdentifier = ""
       savedToolIdentifier = ""
       useCustomWorkingDirectory = "NO"
       useCustomWorkingDirectory = "NO"
-      buildConfiguration = "Release"
       debugDocumentVersioning = "YES">
       debugDocumentVersioning = "YES">
       <MacroExpansion>
       <MacroExpansion>
          <BuildableReference
          <BuildableReference

+ 4 - 4
Base32/Base16.swift

@@ -93,9 +93,9 @@ extension NSData {
 }
 }
 
 
 // MARK: encode
 // MARK: encode
-private func base16encode(data: UnsafePointer<Void>, length: Int, _ uppercase: Bool = true) -> String {
+private func base16encode(data: UnsafePointer<Void>, _ length: Int, _ uppercase: Bool = true) -> String {
     let array = UnsafeBufferPointer<UInt8>(start: UnsafePointer<UInt8>(data), count: length)
     let array = UnsafeBufferPointer<UInt8>(start: UnsafePointer<UInt8>(data), count: length)
-    return map(array) { String(format: uppercase ? "%02X" : "%02x", $0) }.reduce("", combine: +)
+    return array.map { String(format: uppercase ? "%02X" : "%02x", $0) }.reduce("", combine: +)
 }
 }
 
 
 // MARK: decode
 // MARK: decode
@@ -106,7 +106,7 @@ extension UnicodeScalar {
         case "a"..."f": return UInt8(value - UnicodeScalar("a").value + 0xa)
         case "a"..."f": return UInt8(value - UnicodeScalar("a").value + 0xa)
         case "A"..."F": return UInt8(value - UnicodeScalar("A").value + 0xa)
         case "A"..."F": return UInt8(value - UnicodeScalar("A").value + 0xa)
         default:
         default:
-            println("base16decode: Invalid hex character \(self)")
+            print("base16decode: Invalid hex character \(self)")
             return nil
             return nil
         }
         }
     }
     }
@@ -116,7 +116,7 @@ private func base16decode(string: String) -> [UInt8]? {
     // validate length
     // validate length
     let lenght = string.nulTerminatedUTF8.count - 1
     let lenght = string.nulTerminatedUTF8.count - 1
     if lenght % 2 != 0 {
     if lenght % 2 != 0 {
-        println("base16decode: String must contain even number of characters")
+        print("base16decode: String must contain even number of characters")
         return nil
         return nil
     }
     }
     var g = string.unicodeScalars.generate()
     var g = string.unicodeScalars.generate()

+ 7 - 12
Base32/Base32.swift

@@ -164,7 +164,7 @@ let alphabetEncodeTable: [Int8] = ["A","B","C","D","E","F","G","H","I","J","K","
 
 
 let extendedHexAlphabetEncodeTable: [Int8] = ["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V"]
 let extendedHexAlphabetEncodeTable: [Int8] = ["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V"]
 
 
-private func base32encode(data: UnsafePointer<Void>, var length: Int, table: [Int8]) -> String {
+private func base32encode(data: UnsafePointer<Void>, var _ length: Int, _ table: [Int8]) -> String {
     if length == 0 {
     if length == 0 {
         return ""
         return ""
     }
     }
@@ -290,17 +290,12 @@ let extendedHexAlphabetDecodeTable: [UInt8] = [
 ]
 ]
 
 
 
 
-private func base32decode(string: String, table: [UInt8]) -> [UInt8]? {
-    let length = count(string.unicodeScalars)
+private func base32decode(string: String, _ table: [UInt8]) -> [UInt8]? {
+    let length = string.unicodeScalars.count
     if length == 0 {
     if length == 0 {
         return []
         return []
     }
     }
     
     
-    // search element index that condition is true.
-    func index_of<C : CollectionType where C.Generator.Element : Equatable>(domain: C, condition: C.Generator.Element -> Bool) -> C.Index? {
-        return find(lazy(domain).map(condition), true)
-    }
-    
     // calc padding length
     // calc padding length
     func getLeastPaddingLength(string: String) -> Int {
     func getLeastPaddingLength(string: String) -> Int {
         if string.hasSuffix("======") {
         if string.hasSuffix("======") {
@@ -318,12 +313,12 @@ private func base32decode(string: String, table: [UInt8]) -> [UInt8]? {
     
     
     // validate string
     // validate string
     let leastPaddingLength = getLeastPaddingLength(string)
     let leastPaddingLength = getLeastPaddingLength(string)
-    if let index = index_of(string.unicodeScalars, {$0.value > 0xff || table[Int($0.value)] > 31}) {
+    if let index = string.unicodeScalars.indexOf({$0.value > 0xff || table[Int($0.value)] > 31}) {
         // index points padding "=" or invalid character that table does not contain.
         // index points padding "=" or invalid character that table does not contain.
-        let pos = distance(string.unicodeScalars.startIndex, index)
+        let pos = string.unicodeScalars.startIndex.distanceTo(index)
         // if pos points padding "=", it's valid.
         // if pos points padding "=", it's valid.
         if pos != length - leastPaddingLength {
         if pos != length - leastPaddingLength {
-            println("string contains some invalid characters.")
+            print("string contains some invalid characters.")
             return nil
             return nil
         }
         }
     }
     }
@@ -338,7 +333,7 @@ private func base32decode(string: String, table: [UInt8]) -> [UInt8]? {
     case 5: additionalBytes = 3
     case 5: additionalBytes = 3
     case 7: additionalBytes = 4
     case 7: additionalBytes = 4
     default:
     default:
-        println("string length is invalid.")
+        print("string length is invalid.")
         return nil
         return nil
     }
     }
     
     

+ 1 - 1
Base32/Info.plist

@@ -7,7 +7,7 @@
 	<key>CFBundleExecutable</key>
 	<key>CFBundleExecutable</key>
 	<string>$(EXECUTABLE_NAME)</string>
 	<string>$(EXECUTABLE_NAME)</string>
 	<key>CFBundleIdentifier</key>
 	<key>CFBundleIdentifier</key>
-	<string>io.github.norio-nomura.$(PRODUCT_NAME:rfc1034identifier)</string>
+	<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
 	<key>CFBundleInfoDictionaryVersion</key>
 	<key>CFBundleInfoDictionaryVersion</key>
 	<string>6.0</string>
 	<string>6.0</string>
 	<key>CFBundleName</key>
 	<key>CFBundleName</key>

+ 1 - 1
Base32Tests/Info.plist

@@ -7,7 +7,7 @@
 	<key>CFBundleExecutable</key>
 	<key>CFBundleExecutable</key>
 	<string>$(EXECUTABLE_NAME)</string>
 	<string>$(EXECUTABLE_NAME)</string>
 	<key>CFBundleIdentifier</key>
 	<key>CFBundleIdentifier</key>
-	<string>io.github.norio-nomura.$(PRODUCT_NAME:rfc1034identifier)</string>
+	<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
 	<key>CFBundleInfoDictionaryVersion</key>
 	<key>CFBundleInfoDictionaryVersion</key>
 	<string>6.0</string>
 	<string>6.0</string>
 	<key>CFBundleName</key>
 	<key>CFBundleName</key>

+ 1 - 1
Cartfile.resolved

@@ -1 +1 @@
-github "jspahrsummers/xcconfigs" "99624a6af366c015b678a1135e4c558776a59be6"
+github "jspahrsummers/xcconfigs" "0.8.1"

+ 1 - 1
SecEncodeTransformTests/Info.plist

@@ -7,7 +7,7 @@
 	<key>CFBundleExecutable</key>
 	<key>CFBundleExecutable</key>
 	<string>$(EXECUTABLE_NAME)</string>
 	<string>$(EXECUTABLE_NAME)</string>
 	<key>CFBundleIdentifier</key>
 	<key>CFBundleIdentifier</key>
-	<string>io.github.norio-nomura.$(PRODUCT_NAME:rfc1034identifier)</string>
+	<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
 	<key>CFBundleInfoDictionaryVersion</key>
 	<key>CFBundleInfoDictionaryVersion</key>
 	<string>6.0</string>
 	<string>6.0</string>
 	<key>CFBundleName</key>
 	<key>CFBundleName</key>

+ 12 - 12
SecEncodeTransformTests/SecEncodeTransformTests.swift

@@ -40,8 +40,8 @@ class SecEncodeTransformTests: XCTestCase {
 
 
     // MARK: Using SecEncodeTransform
     // MARK: Using SecEncodeTransform
     func test_RFC4648_Encode_UsingSecEncodeTransform() {
     func test_RFC4648_Encode_UsingSecEncodeTransform() {
-        var results = Array<String>(count: count(convertedVectors), repeatedValue: "")
-        let vectorsAndIndices = Zip2(convertedVectors, indices(results))
+        var results = Array<String>(count: convertedVectors.count, repeatedValue: "")
+        let vectorsAndIndices = Zip2Sequence(convertedVectors, results.indices)
         self.measureBlock{
         self.measureBlock{
             for _ in 0...100 {
             for _ in 0...100 {
                 for ((test, _, _), index) in vectorsAndIndices {
                 for ((test, _, _), index) in vectorsAndIndices {
@@ -49,14 +49,14 @@ class SecEncodeTransformTests: XCTestCase {
                 }
                 }
             }
             }
         }
         }
-        for ((test, expect, _), result) in Zip2(convertedVectors, results) {
+        for ((test, expect, _), result) in Zip2Sequence(convertedVectors, results) {
             XCTAssertEqual(result, expect, "TTTBase32EncodedStringFromData for \(test)")
             XCTAssertEqual(result, expect, "TTTBase32EncodedStringFromData for \(test)")
         }
         }
     }
     }
     
     
     func test_RFC4648_Decode_UsingSecEncodeTransform() {
     func test_RFC4648_Decode_UsingSecEncodeTransform() {
-        var results = Array<NSData>(count: count(convertedVectors), repeatedValue: NSData())
-        let vectorsAndIndices = Zip2(convertedVectors, indices(results))
+        var results = Array<NSData>(count: convertedVectors.count, repeatedValue: NSData())
+        let vectorsAndIndices = Zip2Sequence(convertedVectors, results.indices)
         self.measureBlock{
         self.measureBlock{
             for _ in 0...100 {
             for _ in 0...100 {
                 for ((_, test, _), index) in vectorsAndIndices {
                 for ((_, test, _), index) in vectorsAndIndices {
@@ -64,15 +64,15 @@ class SecEncodeTransformTests: XCTestCase {
                 }
                 }
             }
             }
         }
         }
-        for ((expect, test, _), result) in Zip2(convertedVectors, results) {
+        for ((expect, test, _), result) in Zip2Sequence(convertedVectors, results) {
             XCTAssertEqual(result, expect, "TTTDataFromBase32EncodedString for \(test)")
             XCTAssertEqual(result, expect, "TTTDataFromBase32EncodedString for \(test)")
         }
         }
     }
     }
     
     
     // MARK: Using Base32
     // MARK: Using Base32
     func test_RFC4648_Encode_UsingBase32() {
     func test_RFC4648_Encode_UsingBase32() {
-        var results = Array<String>(count: count(convertedVectors), repeatedValue: "")
-        let vectorsAndIndices = Zip2(convertedVectors, indices(results))
+        var results = Array<String>(count: convertedVectors.count, repeatedValue: "")
+        let vectorsAndIndices = Zip2Sequence(convertedVectors, results.indices)
         self.measureBlock{
         self.measureBlock{
             for _ in 0...100 {
             for _ in 0...100 {
                 for ((test, _, _), index) in vectorsAndIndices {
                 for ((test, _, _), index) in vectorsAndIndices {
@@ -80,14 +80,14 @@ class SecEncodeTransformTests: XCTestCase {
                 }
                 }
             }
             }
         }
         }
-        for ((test, expect, _), result) in Zip2(convertedVectors, results) {
+        for ((test, expect, _), result) in Zip2Sequence(convertedVectors, results) {
             XCTAssertEqual(result, expect, "base32Encode for \(test)")
             XCTAssertEqual(result, expect, "base32Encode for \(test)")
         }
         }
     }
     }
     
     
     func test_RFC4648_Decode_UsingBase32() {
     func test_RFC4648_Decode_UsingBase32() {
-        var results = Array<NSData>(count: count(convertedVectors), repeatedValue: NSData())
-        let vectorsAndIndices = Zip2(convertedVectors, indices(results))
+        var results = Array<NSData>(count: convertedVectors.count, repeatedValue: NSData())
+        let vectorsAndIndices = Zip2Sequence(convertedVectors, results.indices)
         self.measureBlock{
         self.measureBlock{
             for _ in 0...100 {
             for _ in 0...100 {
                 for ((_, test, _), index) in vectorsAndIndices {
                 for ((_, test, _), index) in vectorsAndIndices {
@@ -95,7 +95,7 @@ class SecEncodeTransformTests: XCTestCase {
                 }
                 }
             }
             }
         }
         }
-        for ((expect, test, _), result) in Zip2(convertedVectors, results) {
+        for ((expect, test, _), result) in Zip2Sequence(convertedVectors, results) {
             XCTAssertEqual(result, expect, "base32Decode for \(test)")
             XCTAssertEqual(result, expect, "base32Decode for \(test)")
         }
         }
     }
     }