Skip to content
This repository has been archived by the owner on Mar 18, 2021. It is now read-only.

Commit

Permalink
Migrate to swift 3 (#7)
Browse files Browse the repository at this point in the history
* Migrate to swift 3

* Update tests

* Update project settings

* Update docs

* Update readme

* Update for Unbox 2

* Specify Swift versions

* Update Travis CI config

* Minor project updates

* Update podspec
  • Loading branch information
serejahh authored Oct 4, 2016
1 parent de0b3a6 commit bf5f0ae
Show file tree
Hide file tree
Showing 19 changed files with 172 additions and 144 deletions.
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
url = https://github.com/JohnSundell/Unbox.git
[submodule "Carthage/Checkouts/Alamofire"]
path = Carthage/Checkouts/Alamofire
url = https://github.com/Alamofire/Alamofire
url = https://github.com/Alamofire/Alamofire.git
1 change: 1 addition & 0 deletions .swift-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.0
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
language: objective-c
osx_image: xcode7.3
osx_image: xcode8

env:
global:
Expand Down
4 changes: 2 additions & 2 deletions Cartfile
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
github "Alamofire/Alamofire" ~> 3.0
github "JohnSundell/Unbox" ~> 1.5
github "Alamofire/Alamofire" ~> 4.0
github "JohnSundell/Unbox" ~> 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" "3.4.1"
github "JohnSundell/Unbox" "1.9"
github "Alamofire/Alamofire" "4.0.1"
github "JohnSundell/Unbox" "2.0"
2 changes: 1 addition & 1 deletion Carthage/Checkouts/Alamofire
Submodule Alamofire updated 79 files
+1 −0 .swift-version
+23 −22 .travis.yml
+3 −3 Alamofire.podspec
+342 −200 Alamofire.xcodeproj/project.pbxproj
+9 −3 Alamofire.xcodeproj/xcshareddata/xcschemes/Alamofire iOS.xcscheme
+10 −11 Alamofire.xcodeproj/xcshareddata/xcschemes/Alamofire macOS.xcscheme
+9 −3 Alamofire.xcodeproj/xcshareddata/xcschemes/Alamofire tvOS.xcscheme
+2 −3 Alamofire.xcodeproj/xcshareddata/xcschemes/Alamofire watchOS.xcscheme
+80 −0 Alamofire.xcodeproj/xcshareddata/xcschemes/Cleanup Whitespace.xcscheme
+368 −16 CHANGELOG.md
+1 −1 CONTRIBUTING.md
+930 −0 Documentation/Alamofire 4.0 Migration Guide.md
+11 −10 Example/Source/AppDelegate.swift
+51 −43 Example/Source/DetailViewController.swift
+16 −16 Example/Source/MasterViewController.swift
+25 −7 Example/iOS Example.xcodeproj/project.pbxproj
+8 −1 Example/iOS Example.xcodeproj/xcshareddata/xcschemes/iOS Example.xcscheme
+1,071 −624 README.md
+450 −0 Source/AFError.swift
+346 −260 Source/Alamofire.swift
+14 −10 Source/DispatchQueue+Alamofire.swift
+0 −248 Source/Download.swift
+0 −88 Source/Error.swift
+1 −1 Source/Info-tvOS.plist
+1 −1 Source/Info.plist
+0 −778 Source/Manager.swift
+281 −359 Source/MultipartFormData.swift
+75 −79 Source/NetworkReachabilityManager.swift
+20 −15 Source/Notifications.swift
+299 −187 Source/ParameterEncoding.swift
+438 −406 Source/Request.swift
+228 −29 Source/Response.swift
+533 −195 Source/ResponseSerialization.swift
+21 −22 Source/Result.swift
+116 −127 Source/ServerTrustPolicy.swift
+681 −0 Source/SessionDelegate.swift
+776 −0 Source/SessionManager.swift
+0 −182 Source/Stream.swift
+449 −0 Source/TaskDelegate.swift
+19 −21 Source/Timeline.swift
+0 −376 Source/Upload.swift
+231 −136 Source/Validation.swift
+332 −0 Tests/AFError+AlamofireTests.swift
+70 −99 Tests/AuthenticationTests.swift
+14 −4 Tests/BaseTestCase.swift
+140 −167 Tests/CacheTests.swift
+349 −293 Tests/DownloadTests.swift
+88 −0 Tests/FileManager+AlamofireTests.swift
+0 −282 Tests/ManagerTests.swift
+354 −386 Tests/MultipartFormDataTests.swift
+21 −21 Tests/NetworkReachabilityManagerTests.swift
+559 −442 Tests/ParameterEncodingTests.swift
+242 −360 Tests/RequestTests.swift
+ Tests/Resources/Certificates/disig.sk/intermediate-ca-disig.cer
+ Tests/Resources/Certificates/disig.sk/root-ca-disig.cer
+ Tests/Resources/Certificates/disig.sk/testssl-expire.disig.sk.cer
+ Tests/Resources/Certificates/expired.badssl.com/expired.badssl.com-intermediate-ca-1.cer
+ Tests/Resources/Certificates/expired.badssl.com/expired.badssl.com-intermediate-ca-2.cer
+ Tests/Resources/Certificates/expired.badssl.com/expired.badssl.com-leaf.cer
+ Tests/Resources/Certificates/expired.badssl.com/expired.badssl.com-root-ca.cer
+0 −0 Tests/Resources/Responses/JSON/empty_data.json
+6 −0 Tests/Resources/Responses/JSON/invalid_data.json
+4 −0 Tests/Resources/Responses/JSON/valid_data.json
+0 −0 Tests/Resources/Responses/Property List/empty.data
+6 −0 Tests/Resources/Responses/Property List/invalid.data
+26 −0 Tests/Resources/Responses/Property List/valid.data
+0 −0 Tests/Resources/Responses/String/empty_string.txt
+ Tests/Resources/Responses/String/utf32_string.txt
+1 −0 Tests/Resources/Responses/String/utf8_string.txt
+835 −224 Tests/ResponseSerializationTests.swift
+195 −142 Tests/ResponseTests.swift
+13 −13 Tests/ResultTests.swift
+348 −348 Tests/ServerTrustPolicyTests.swift
+186 −259 Tests/SessionDelegateTests.swift
+727 −0 Tests/SessionManagerTests.swift
+166 −155 Tests/TLSEvaluationTests.swift
+51 −60 Tests/URLProtocolTests.swift
+305 −379 Tests/UploadTests.swift
+670 −256 Tests/ValidationTests.swift
12 changes: 7 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
- [x] Mapping response to array of objects
- [x] Keypaths
- [x] Nested keypaths
- [x] For Swift 2.x use v. `1.x` and [swift2](https://github.com/serejahh/UnboxedAlamofire/tree/swift2) branch
- [x] For Swift 3.x use v. `2.x`

## Usage

Expand All @@ -23,15 +25,15 @@ Objects you request have to conform [Unboxable](https://github.com/JohnSundell/U
### Get an object

``` swift
Alamofire.request(.GET, url).responseObject { (response: Response<Candy, NSError>) in
Alamofire.request(url, method: .get).responseObject { (response: DataResponse<Candy>) in
let candy = response.result.value
}
```

### Get an array

``` swift
Alamofire.request(.GET, url).responseArray { (response: Response<[Candy], NSError>) in
Alamofire.request(url, method: .get).responseArray { (response: DataResponse<[Candy]>) in
let candies = response.result.value
}
```
Expand All @@ -41,7 +43,7 @@ Alamofire.request(.GET, url).responseArray { (response: Response<[Candy], NSErro
Also you can specify a keypath in both requests:

``` swift
Alamofire.request(.GET, url).responseObject(keyPath: "response") { (response: Response<Candy, NSError>) in
Alamofire.request(url, method: .get).responseObject(keyPath: "response") { (response: DataResponse<Candy>) in
let candy = response.result.value
}
```
Expand All @@ -51,11 +53,11 @@ Alamofire.request(.GET, url).responseObject(keyPath: "response") { (response: Re
### [CocoaPods](https://cocoapods.org/)

```
pod 'UnboxedAlamofire', '~> 1.0'
pod 'UnboxedAlamofire', '~> 2.0'
```

### [Carthage](https://github.com/Carthage/Carthage)

```
github "serejahh/UnboxedAlamofire" ~> 1.0
github "serejahh/UnboxedAlamofire" ~> 2.0
```
12 changes: 6 additions & 6 deletions UnboxedAlamofire.podspec
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
Pod::Spec.new do |s|
s.name = "UnboxedAlamofire"
s.version = "1.0.1"
s.version = "2.0"
s.license = { :type => "MIT", :file => "LICENSE" }
s.summary = "Alamofire + Unbox: the easiest way to download and decode JSON into swift objects."
s.homepage = "https://github.com/serejahh/UnboxedAlamofire"
s.author = { "Serhii Butenko" => "[email protected]" }
s.source = { :git => 'https://github.com/serejahh/UnboxedAlamofire.git', :tag => s.version.to_s }
s.source = { :git => 'https://github.com/serejahh/UnboxedAlamofire.git', :tag => s.version }

s.ios.deployment_target = '8.0'
s.osx.deployment_target = '10.10'
s.ios.deployment_target = '9.0'
s.osx.deployment_target = '10.11'
s.watchos.deployment_target = '2.0'
s.tvos.deployment_target = '9.0'

s.requires_arc = 'true'
s.source_files = 'UnboxedAlamofire/**/*.swift'
s.dependency 'Alamofire', '~> 3.0'
s.dependency 'Unbox', '~> 1.5'
s.dependency 'Alamofire', '~> 4.0'
s.dependency 'Unbox', '~> 2.0'
end
123 changes: 73 additions & 50 deletions UnboxedAlamofire.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0730"
LastUpgradeVersion = "0800"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand All @@ -15,7 +15,7 @@
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "C52A5D331D4F699100AB86C6"
BuildableName = "UnboxedAlamofire_iOS.framework"
BuildableName = "UnboxedAlamofire.framework"
BlueprintName = "UnboxedAlamofire_iOS"
ReferencedContainer = "container:UnboxedAlamofire.xcodeproj">
</BuildableReference>
Expand Down Expand Up @@ -43,7 +43,7 @@
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "C52A5D331D4F699100AB86C6"
BuildableName = "UnboxedAlamofire_iOS.framework"
BuildableName = "UnboxedAlamofire.framework"
BlueprintName = "UnboxedAlamofire_iOS"
ReferencedContainer = "container:UnboxedAlamofire.xcodeproj">
</BuildableReference>
Expand All @@ -65,7 +65,7 @@
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "C52A5D331D4F699100AB86C6"
BuildableName = "UnboxedAlamofire_iOS.framework"
BuildableName = "UnboxedAlamofire.framework"
BlueprintName = "UnboxedAlamofire_iOS"
ReferencedContainer = "container:UnboxedAlamofire.xcodeproj">
</BuildableReference>
Expand All @@ -83,7 +83,7 @@
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "C52A5D331D4F699100AB86C6"
BuildableName = "UnboxedAlamofire_iOS.framework"
BuildableName = "UnboxedAlamofire.framework"
BlueprintName = "UnboxedAlamofire_iOS"
ReferencedContainer = "container:UnboxedAlamofire.xcodeproj">
</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 = "0730"
LastUpgradeVersion = "0800"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand All @@ -15,7 +15,7 @@
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "C5CDBA261D50A5E000992A82"
BuildableName = "UnboxedAlamofire_macOS.framework"
BuildableName = "UnboxedAlamofire.framework"
BlueprintName = "UnboxedAlamofire_macOS"
ReferencedContainer = "container:UnboxedAlamofire.xcodeproj">
</BuildableReference>
Expand Down Expand Up @@ -46,7 +46,7 @@
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "C5CDBA261D50A5E000992A82"
BuildableName = "UnboxedAlamofire_macOS.framework"
BuildableName = "UnboxedAlamofire.framework"
BlueprintName = "UnboxedAlamofire_macOS"
ReferencedContainer = "container:UnboxedAlamofire.xcodeproj">
</BuildableReference>
Expand All @@ -64,7 +64,7 @@
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "C5CDBA261D50A5E000992A82"
BuildableName = "UnboxedAlamofire_macOS.framework"
BuildableName = "UnboxedAlamofire.framework"
BlueprintName = "UnboxedAlamofire_macOS"
ReferencedContainer = "container:UnboxedAlamofire.xcodeproj">
</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 = "0730"
LastUpgradeVersion = "0800"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand All @@ -15,7 +15,7 @@
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "C5CDBA421D50A5F000992A82"
BuildableName = "UnboxedAlamofire_tvOS.framework"
BuildableName = "UnboxedAlamofire.framework"
BlueprintName = "UnboxedAlamofire_tvOS"
ReferencedContainer = "container:UnboxedAlamofire.xcodeproj">
</BuildableReference>
Expand Down Expand Up @@ -46,7 +46,7 @@
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "C5CDBA421D50A5F000992A82"
BuildableName = "UnboxedAlamofire_tvOS.framework"
BuildableName = "UnboxedAlamofire.framework"
BlueprintName = "UnboxedAlamofire_tvOS"
ReferencedContainer = "container:UnboxedAlamofire.xcodeproj">
</BuildableReference>
Expand All @@ -64,7 +64,7 @@
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "C5CDBA421D50A5F000992A82"
BuildableName = "UnboxedAlamofire_tvOS.framework"
BuildableName = "UnboxedAlamofire.framework"
BlueprintName = "UnboxedAlamofire_tvOS"
ReferencedContainer = "container:UnboxedAlamofire.xcodeproj">
</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 = "0730"
LastUpgradeVersion = "0800"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand All @@ -15,7 +15,7 @@
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "C5CDBA341D50A5E900992A82"
BuildableName = "UnboxedAlamofire_watchOS.framework"
BuildableName = "UnboxedAlamofire.framework"
BlueprintName = "UnboxedAlamofire_watchOS"
ReferencedContainer = "container:UnboxedAlamofire.xcodeproj">
</BuildableReference>
Expand Down Expand Up @@ -46,7 +46,7 @@
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "C5CDBA341D50A5E900992A82"
BuildableName = "UnboxedAlamofire_watchOS.framework"
BuildableName = "UnboxedAlamofire.framework"
BlueprintName = "UnboxedAlamofire_watchOS"
ReferencedContainer = "container:UnboxedAlamofire.xcodeproj">
</BuildableReference>
Expand All @@ -64,7 +64,7 @@
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "C5CDBA341D50A5E900992A82"
BuildableName = "UnboxedAlamofire_watchOS.framework"
BuildableName = "UnboxedAlamofire.framework"
BlueprintName = "UnboxedAlamofire_watchOS"
ReferencedContainer = "container:UnboxedAlamofire.xcodeproj">
</BuildableReference>
Expand Down
2 changes: 1 addition & 1 deletion UnboxedAlamofire/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<string>2.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
Expand Down
4 changes: 1 addition & 3 deletions UnboxedAlamofire/UnboxedAlamofire.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// Copyright © 2016 Serhii Butenko. All rights reserved.
//

#import <UIKit/UIKit.h>
#import <Foundation/Foundation.h>

//! Project version number for UnboxedAlamofire.
FOUNDATION_EXPORT double UnboxedAlamofireVersionNumber;
Expand All @@ -15,5 +15,3 @@ FOUNDATION_EXPORT double UnboxedAlamofireVersionNumber;
FOUNDATION_EXPORT const unsigned char UnboxedAlamofireVersionString[];

// In this header, you should import all the public headers of your framework using statements like #import <UnboxedAlamofire/PublicHeader.h>


Loading

0 comments on commit bf5f0ae

Please sign in to comment.