Skip to content

Commit

Permalink
Upgrade to Swift 2 (Xcode7-beta1)
Browse files Browse the repository at this point in the history
  • Loading branch information
inamiy committed Jun 21, 2015
1 parent c964fdf commit 52b976d
Show file tree
Hide file tree
Showing 26 changed files with 234 additions and 210 deletions.
4 changes: 2 additions & 2 deletions Cartfile.private
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
github "Alamofire/Alamofire" ~> 1.2.0
github "duemunk/Async" "2f0c5b69e3ff0e41c9391016b7855cd319000515"
github "Alamofire/Alamofire" "swift-2.0"
github "duemunk/Async" "feature/Swift_2.0"
4 changes: 2 additions & 2 deletions Cartfile.resolved
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
github "Alamofire/Alamofire" "1.2.0"
github "duemunk/Async" "2f0c5b69e3ff0e41c9391016b7855cd319000515"
github "Alamofire/Alamofire" "fd71afb3a0af2042b9f05a6b9f29317ad4903703"
github "duemunk/Async" "23aaf8d7f2e4dc593e87db739b68c58ecb9d19ac"
2 changes: 1 addition & 1 deletion Carthage/Checkouts/Alamofire
Submodule Alamofire updated 41 files
+6 −1 .gitignore
+29 −11 .travis.yml
+4 −17 Alamofire.playground/section-1.swift
+1 −1 Alamofire.podspec
+132 −26 Alamofire.xcodeproj/project.pbxproj
+4 −1 Alamofire.xcodeproj/xcshareddata/xcschemes/Alamofire OSX.xcscheme
+4 −1 Alamofire.xcodeproj/xcshareddata/xcschemes/Alamofire iOS.xcscheme
+471 −0 CHANGELOG.md
+91 −0 CONTRIBUTING.md
+3 −3 Example/AppDelegate.swift
+4 −6 Example/DetailViewController.swift
+2 −2 Example/HTTPBin.swift
+1 −1 Example/Info.plist
+7 −7 Example/MasterViewController.swift
+1 −1 LICENSE
+31 −26 README.md
+1 −1 Source/Alamofire.h
+54 −1,485 Source/Alamofire.swift
+185 −0 Source/Download.swift
+2 −2 Source/Info.plist
+404 −0 Source/Manager.swift
+199 −0 Source/ParameterEncoding.swift
+503 −0 Source/Request.swift
+154 −0 Source/ResponseSerialization.swift
+190 −0 Source/Upload.swift
+147 −0 Source/Validation.swift
+153 −52 Tests/AuthenticationTests.swift
+29 −0 Tests/BaseTestCase.swift
+349 −0 Tests/CacheTests.swift
+121 −47 Tests/DownloadTests.swift
+1 −1 Tests/Info.plist
+40 −10 Tests/ManagerTests.swift
+313 −112 Tests/ParameterEncodingTests.swift
+283 −65 Tests/RequestTests.swift
+257 −26 Tests/ResponseTests.swift
+48 −0 Tests/TLSEvaluationTests.swift
+168 −0 Tests/URLProtocolTests.swift
+86 −26 Tests/UploadTests.swift
+173 −122 Tests/ValidationTests.swift
+38 −4 iOS Example.xcodeproj/project.pbxproj
+8 −3 iOS Example.xcodeproj/xcshareddata/xcschemes/iOS Example.xcscheme
2 changes: 1 addition & 1 deletion Playgrounds/03-Alamofire.playground/Contents.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ XCPSetExecutionShouldContinueIndefinitely()
// define task
let task = AlamofireTask { progress, fulfill, reject, configure in

let request = Alamofire.download(.GET, "http://httpbin.org/stream/100", Request.suggestedDownloadDestination(directory: .DocumentDirectory, domain: .UserDomainMask))
let request = Alamofire.download(.GET, URLString: "http://httpbin.org/stream/100", destination: Request.suggestedDownloadDestination(directory: .DocumentDirectory, domain: .UserDomainMask))

request
.progress { (bytesWritten, totalBytesWritten, totalBytesExpectedToWrite) in
Expand Down
2 changes: 1 addition & 1 deletion Playgrounds/03-Alamofire.playground/contents.xcplayground
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<playground version='5.0' target-platform='osx'>
<playground version='5.0' target-platform='osx' requires-full-environment='true'>
<timeline fileName='timeline.xctimeline'/>
</playground>
8 changes: 4 additions & 4 deletions Playgrounds/03-Alamofire.playground/timeline.xctimeline
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,22 @@
version = "3.0">
<TimelineItems>
<LoggerValueHistoryTimelineItem
documentLocation = "#CharacterRangeLen=19&amp;CharacterRangeLoc=1785&amp;EndingColumnNumber=23&amp;EndingLineNumber=58&amp;StartingColumnNumber=9&amp;StartingLineNumber=58&amp;Timestamp=450426052.187599"
documentLocation = "#CharacterRangeLen=19&amp;CharacterRangeLoc=1809&amp;EndingColumnNumber=23&amp;EndingLineNumber=58&amp;StartingColumnNumber=9&amp;StartingLineNumber=58&amp;Timestamp=456586371.622818"
selectedRepresentationIndex = "0"
shouldTrackSuperviewWidth = "NO">
</LoggerValueHistoryTimelineItem>
<LoggerValueHistoryTimelineItem
documentLocation = "#CharacterRangeLen=0&amp;CharacterRangeLoc=1804&amp;EndingColumnNumber=42&amp;EndingLineNumber=58&amp;StartingColumnNumber=9&amp;StartingLineNumber=58&amp;Timestamp=450426052.18781"
documentLocation = "#CharacterRangeLen=0&amp;CharacterRangeLoc=1828&amp;EndingColumnNumber=42&amp;EndingLineNumber=58&amp;StartingColumnNumber=9&amp;StartingLineNumber=58&amp;Timestamp=456586371.623101"
selectedRepresentationIndex = "1"
shouldTrackSuperviewWidth = "NO">
</LoggerValueHistoryTimelineItem>
<LoggerValueHistoryTimelineItem
documentLocation = "#CharacterRangeLen=29&amp;CharacterRangeLoc=1776&amp;EndingColumnNumber=38&amp;EndingLineNumber=58&amp;StartingColumnNumber=9&amp;StartingLineNumber=58&amp;Timestamp=450426052.187982"
documentLocation = "#CharacterRangeLen=29&amp;CharacterRangeLoc=1800&amp;EndingColumnNumber=38&amp;EndingLineNumber=58&amp;StartingColumnNumber=9&amp;StartingLineNumber=58&amp;Timestamp=456586371.623335"
selectedRepresentationIndex = "0"
shouldTrackSuperviewWidth = "NO">
</LoggerValueHistoryTimelineItem>
<LoggerValueHistoryTimelineItem
documentLocation = "#CharacterRangeLen=24&amp;CharacterRangeLoc=1743&amp;EndingColumnNumber=33&amp;EndingLineNumber=57&amp;StartingColumnNumber=9&amp;StartingLineNumber=57&amp;Timestamp=450426052.188093"
documentLocation = "#CharacterRangeLen=24&amp;CharacterRangeLoc=1767&amp;EndingColumnNumber=33&amp;EndingLineNumber=57&amp;StartingColumnNumber=9&amp;StartingLineNumber=57&amp;Timestamp=456586371.623562"
selectedRepresentationIndex = "0"
shouldTrackSuperviewWidth = "NO">
</LoggerValueHistoryTimelineItem>
Expand Down
31 changes: 26 additions & 5 deletions SwiftTask.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@
1FB3B8F31B0A194F00F78900 /* _Atomic.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1FB3B8F21B0A194F00F78900 /* _Atomic.swift */; };
1FB3B8F41B0A194F00F78900 /* _Atomic.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1FB3B8F21B0A194F00F78900 /* _Atomic.swift */; };
1FCF71121AD8CD2B007079C2 /* Alamofire.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1FCF71111AD8CD2B007079C2 /* Alamofire.framework */; };
1FCF71141AD8CD2F007079C2 /* Async.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1FCF71131AD8CD2F007079C2 /* Async.framework */; };
1FCF71161AD8CD38007079C2 /* Alamofire.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1FCF71151AD8CD38007079C2 /* Alamofire.framework */; };
1FCF71181AD8CD3C007079C2 /* Async.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1FCF71171AD8CD3C007079C2 /* Async.framework */; };
1FD7197B1AFE387C00BC38C4 /* Cancellable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1FD7197A1AFE387C00BC38C4 /* Cancellable.swift */; };
1FD7197C1AFE387C00BC38C4 /* Cancellable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1FD7197A1AFE387C00BC38C4 /* Cancellable.swift */; };
1FE79EDB1B36F329008569AA /* Async.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1FE79E561B36F329008569AA /* Async.swift */; };
1FE79EDC1B36F329008569AA /* Async.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1FE79E561B36F329008569AA /* Async.swift */; };
1FF52EB41A4C395A00B4BA28 /* _InterruptableTask.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1FF52EB31A4C395A00B4BA28 /* _InterruptableTask.swift */; };
1FF52EB51A4C395A00B4BA28 /* _InterruptableTask.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1FF52EB31A4C395A00B4BA28 /* _InterruptableTask.swift */; };
4822F0DC19D00B2300F5F572 /* _TestCase.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1F46DEFC199EE2C200F97868 /* _TestCase.swift */; };
Expand Down Expand Up @@ -64,6 +64,7 @@
1FCF71151AD8CD38007079C2 /* Alamofire.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Alamofire.framework; path = ../Carthage/Checkouts/Alamofire/build/Debug/Alamofire.framework; sourceTree = "<group>"; };
1FCF71171AD8CD3C007079C2 /* Async.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Async.framework; path = ../Carthage/Checkouts/Async/build/Debug/Async.framework; sourceTree = "<group>"; };
1FD7197A1AFE387C00BC38C4 /* Cancellable.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Cancellable.swift; sourceTree = "<group>"; };
1FE79E561B36F329008569AA /* Async.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Async.swift; sourceTree = "<group>"; };
1FF52EB31A4C395A00B4BA28 /* _InterruptableTask.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = _InterruptableTask.swift; sourceTree = "<group>"; };
4822F0D019D00ABF00F5F572 /* SwiftTask-iOSTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "SwiftTask-iOSTests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; };
48511C5A19C17563002FE03C /* RetainCycleTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RetainCycleTests.swift; sourceTree = "<group>"; };
Expand All @@ -85,7 +86,6 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
1FCF71181AD8CD3C007079C2 /* Async.framework in Frameworks */,
1FCF71161AD8CD38007079C2 /* Alamofire.framework in Frameworks */,
48A1E8221A366F9C007619EB /* SwiftTask.framework in Frameworks */,
);
Expand All @@ -95,7 +95,6 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
1FCF71141AD8CD2F007079C2 /* Async.framework in Frameworks */,
1FCF71121AD8CD2B007079C2 /* Alamofire.framework in Frameworks */,
48A1E8231A366FA8007619EB /* SwiftTask.framework in Frameworks */,
);
Expand Down Expand Up @@ -156,6 +155,7 @@
1F46DEE0199EDF1000F97868 /* SwiftTaskTests */ = {
isa = PBXGroup;
children = (
1FE79E521B36F329008569AA /* Async */,
1FF52EB31A4C395A00B4BA28 /* _InterruptableTask.swift */,
1F46DEFC199EE2C200F97868 /* _TestCase.swift */,
1F20250119ADA8FD00DE0495 /* BasicTests.swift */,
Expand All @@ -182,6 +182,15 @@
name = "Supporting Files";
sourceTree = "<group>";
};
1FE79E521B36F329008569AA /* Async */ = {
isa = PBXGroup;
children = (
1FE79E561B36F329008569AA /* Async.swift */,
);
name = Async;
path = Carthage/Checkouts/Async;
sourceTree = SOURCE_ROOT;
};
/* End PBXGroup section */

/* Begin PBXHeadersBuildPhase section */
Expand Down Expand Up @@ -280,7 +289,8 @@
1F46DECB199EDF1000F97868 /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 0600;
LastSwiftUpdateCheck = 0700;
LastUpgradeCheck = 0700;
ORGANIZATIONNAME = "Yasuhiro Inami";
TargetAttributes = {
1F46DED3199EDF1000F97868 = {
Expand Down Expand Up @@ -368,6 +378,7 @@
files = (
1F20250219ADA8FD00DE0495 /* BasicTests.swift in Sources */,
1FF52EB41A4C395A00B4BA28 /* _InterruptableTask.swift in Sources */,
1FE79EDB1B36F329008569AA /* Async.swift in Sources */,
1F218D5B1AFC3FFD00C849FF /* RemoveHandlerTests.swift in Sources */,
1F6A8CA319A4E4F200369A5D /* SwiftTaskTests.swift in Sources */,
1F29F6421B115EF500F476AF /* MultipleErrorTypesTests.swift in Sources */,
Expand All @@ -384,6 +395,7 @@
files = (
4822F0DE19D00B2300F5F572 /* SwiftTaskTests.swift in Sources */,
4822F0DD19D00B2300F5F572 /* BasicTests.swift in Sources */,
1FE79EDC1B36F329008569AA /* Async.swift in Sources */,
1F218D5C1AFC3FFD00C849FF /* RemoveHandlerTests.swift in Sources */,
1FF52EB51A4C395A00B4BA28 /* _InterruptableTask.swift in Sources */,
1F29F6431B115EF500F476AF /* MultipleErrorTypesTests.swift in Sources */,
Expand Down Expand Up @@ -431,6 +443,7 @@
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 1;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_DYNAMIC_NO_PIC = NO;
GCC_OPTIMIZATION_LEVEL = 0;
Expand Down Expand Up @@ -512,6 +525,7 @@
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks";
MACOSX_DEPLOYMENT_TARGET = 10.9;
PRODUCT_BUNDLE_IDENTIFIER = "com.inamiy.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(PROJECT_NAME)";
SDKROOT = macosx;
SKIP_INSTALL = YES;
Expand All @@ -534,6 +548,7 @@
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks";
MACOSX_DEPLOYMENT_TARGET = 10.9;
PRODUCT_BUNDLE_IDENTIFIER = "com.inamiy.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(PROJECT_NAME)";
SDKROOT = macosx;
SKIP_INSTALL = YES;
Expand All @@ -555,6 +570,7 @@
INFOPLIST_FILE = SwiftTaskTests/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks";
MACOSX_DEPLOYMENT_TARGET = 10.10;
PRODUCT_BUNDLE_IDENTIFIER = "com.inamiy.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = macosx;
};
Expand All @@ -571,6 +587,7 @@
INFOPLIST_FILE = SwiftTaskTests/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks";
MACOSX_DEPLOYMENT_TARGET = 10.10;
PRODUCT_BUNDLE_IDENTIFIER = "com.inamiy.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = macosx;
};
Expand All @@ -590,6 +607,7 @@
INFOPLIST_FILE = SwiftTaskTests/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "com.inamiy.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = iphoneos;
};
Expand All @@ -605,6 +623,7 @@
INFOPLIST_FILE = SwiftTaskTests/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "com.inamiy.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = iphoneos;
VALIDATE_PRODUCT = YES;
Expand All @@ -627,6 +646,7 @@
INFOPLIST_FILE = SwiftTask/Info.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "com.inamiy.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(PROJECT_NAME)";
SDKROOT = iphoneos;
SKIP_INSTALL = YES;
Expand All @@ -646,6 +666,7 @@
INFOPLIST_FILE = SwiftTask/Info.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "com.inamiy.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(PROJECT_NAME)";
SDKROOT = iphoneos;
SKIP_INSTALL = YES;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0610"
LastUpgradeVersion = "0700"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down Expand Up @@ -48,6 +48,8 @@
ReferencedContainer = "container:SwiftTask.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
Expand All @@ -57,6 +59,7 @@
buildConfiguration = "Debug"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<MacroExpansion>
<BuildableReference
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0600"
LastUpgradeVersion = "0700"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down Expand Up @@ -48,6 +48,8 @@
ReferencedContainer = "container:SwiftTask.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
Expand All @@ -57,6 +59,7 @@
buildConfiguration = "Debug"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<MacroExpansion>
<BuildableReference
Expand Down
7 changes: 0 additions & 7 deletions SwiftTask.xcworkspace/contents.xcworkspacedata

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions SwiftTask/Cancellable.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public protocol Cancellable
// but two overloaded methods are required for SwiftTask ver 3.x API compatibility.
//
func cancel() -> Bool
func cancel(#error: Error) -> Bool
func cancel(error error: Error) -> Bool
}

public class Canceller: Cancellable
Expand All @@ -35,7 +35,7 @@ public class Canceller: Cancellable
return self.cancel(error: ())
}

public func cancel(#error: Void) -> Bool
public func cancel(error error: Void) -> Bool
{
if let cancelHandler = self.cancelHandler {
self.cancelHandler = nil
Expand Down
2 changes: 1 addition & 1 deletion SwiftTask/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>com.inamiy.$(PRODUCT_NAME:rfc1034identifier)</string>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
Expand Down
Loading

0 comments on commit 52b976d

Please sign in to comment.