-
-
Notifications
You must be signed in to change notification settings - Fork 7.6k
Description
Alamofire - Swift 3.0
The initial migration to Swift 3.0 has been completed, and can be found in the swift3
branch. Many thanks to the Apple Engineers in the labs at WWDC who assisted with some of the migration issues. 🍻
Please file Github issues for any problems discovered while using this branch.
This branch should be considered a work in progress, and will be updated as future Xcode 8 and Swift 3 seeds are released by Apple.
Official support for Swift 3.0 and Xcode 8 will be not available until the fall when Apple releases both.
Migration Notes
-
Many Foundation types are now value types, instead of reference types. Please audit your code to ensure all references to
NSMutableURLRequest
are now properly handled asvar
and are of typeURLRequest
. -
Due to the Swift 3.0 naming conventions, many Alamofire API parameters that referenced an object in the URL Foundation loading system and began with capital letters now begin with lowercase letters. For example,
URLRequest
parameter names are nowurlRequest
to prevent confusion.More notes will be added as issues are discovered.
Radars
The following radars were filed as a result of this migration and are currently being tracked by the ASF team.
- 26850776:
CharacterSet
crashes when attempting to remove an item from the set in Swift 3.0 - 26849668:
NSURLProtocol
APIs still containNSMutableURLRequest
parameter types and do not support the Swift 3.0 value types - 26870455:
NSURLSession
with background configuration does not function on the iOS simulator inside of test targets
TODO
- Update Project Recommended SettingsUpdate ExampleTravis CI SupportUpdate Documentation/READMETo pick up a draggable item, press the space bar. While dragging, use the arrow keys to move the item. Press space again to drop the item in its new position, or press escape to cancel.
Activity
agates4 commentedon Jun 19, 2016
install compatibility with cocoapods? @kcharwood
EDIT: use
connormlewis commentedon Jun 23, 2016
Using the provided code on the Alamofire page, when creating a generic ResponseObjectSerializable, I get the following error:
Member 'failure' in 'Result<T, NSError>' produces result of type 'Result<Value, Error>', but context expects 'Result<T, NSError>'
. This occurs on the following line:return .failure(.ObjectSerialization(reason: "JSON could not be serialized into response object"))
. I am using the swift 3.0 branch.enagorny commentedon Jul 14, 2016
Could it be installed via carthage? As I'm getting compile errors
chriscombs commentedon Jul 14, 2016
I am able to install using carthage, have you set the correct version of XCode in Terminal?
sudo xcode-select -s /Applications/Xcode-beta.app/Contents/Developer/
enagorny commentedon Jul 14, 2016
Indeed. Forgot to switch XCode version. All works fine.
Cartfile:
github "Alamofire/Alamofire" "swift3"
fancytapsio commentedon Jul 14, 2016
I am stuck with "error: Found an unexpected Mach-O header code: 0x72613c21" because of the pod, ideas will be highly appreciated.
ronaldmannak commentedon Jul 14, 2016
@fancytapsio That is a CocoaPods issue, try https://github.com/CocoaPods/CocoaPods/issues/5598#issuecomment-230662508
fancytapsio commentedon Jul 15, 2016
@ronaldmannak Thank you, I needed that, it finally worked!
dipang90 commentedon Jul 18, 2016
I have installed Cocoa pods in xcode 8.1. I add like this:
pod 'Alamofire',
:git => 'https://github.com/Alamofire/Alamofire.git',
:branch => 'swift3'
when I complie my app, Its getting so many error.
jshier commentedon Jul 19, 2016
Branch has been updated for beta 3.
@dipang90 You likely need to update your version of Xcode 8 to the latest beta.
vladgon commentedon Jul 19, 2016
Xcode Beta3, using pod and getting ...
“Use Legacy Swift Language Version” (SWIFT_VERSION) is required to be configured correctly for targets which use Swift. Use the [Edit > Convert > To Current Swift Syntax…] menu to choose a Swift version or use the Build Settings editor to configure the build setting directly.
grosch commentedon Jul 19, 2016
Can you explain how to use this please? I created a brand new project and used the Pod configuration that @dipang90 showed. When Xcode starts it immediately wants to do a conversion to Swift 3, and I get 346 issues in Alamofire framework.
I'm using Xcode 8 Beta 3
70 remaining items
gabrielPeart commentedon Aug 31, 2016
@thebluepotato you are right!
fprosper commentedon Aug 31, 2016
Thank you @thebluepotato, just noted, thanks!
cnoon commentedon Sep 7, 2016
I'm going to go ahead and close this issue out. Thank you everyone for all your feedback and reporting and especially you @kcharwood 🍻 for kicking all this off in the first place! We're getting really close to having everything locked down and will be starting on all the documentation updates here shortly.
AF 4 is coming!!! 🎉🎉🎉
mychaelgo commentedon Sep 15, 2016
@thebluepotato but i get error :
any suggestion?
jshier commentedon Sep 15, 2016
@mychaelgo
Method
has been renamed toHTTPMethod
, to disambiguate it from the type you're seeing.mychaelgo commentedon Sep 15, 2016
@jshier oh thank you for mention it!
Rahulpatil710 commentedon Sep 18, 2016
How to call POST method with encoding as JSON, with some header and Passing some parameter
How can I call this method with JSON response?
Thanks for any help in advance
sonysum commentedon Sep 19, 2016
[!] /usr/bin/git clone https://github.com/Alamofire/Alamofire.git /var/folders/_2/cfgf2q2x7n7g3881kmbqvh4m0000gp/T/d20160919-5162-1u99gbn --template= --single-branch --depth 1 --branch swift3
Cloning into '/var/folders/_2/cfgf2q2x7n7g3881kmbqvh4m0000gp/T/d20160919-5162-1u99gbn'...
warning: Could not find remote branch swift3 to clone.
fatal: Remote branch swift3 not found in upstream origin