Coder Social home page Coder Social logo

swiftyjson / alamofire-swiftyjson Goto Github PK

View Code? Open in Web Editor NEW
1.4K 57.0 173.0 47 KB

Alamofire extension for serialize NSData to SwiftyJSON

License: MIT License

Ruby 11.46% Swift 78.28% Objective-C 10.25%
alamofire swiftyjson alamofire-swiftyjson swift

alamofire-swiftyjson's Introduction

Alamofire-SwiftyJSON

An extension to make serializing Alamofire's response with SwiftyJSON easily.

⚠️ To use with Swift 3.x please ensure you are using >= 2.0.0 ⚠️

⚠️ To use with Swift 4.x please ensure you are using >= 3.0.0 ⚠️

Swift version

Alamofire-SwiftyJSON Swift version Alamofire SwiftyJSON
2.x Swift 3.x 4.x 3.x
3.x Swift 4.x 4.5.x 4.x

Requirements

  • iOS 8.0+ / Mac OS X 10.9+
  • Xcode 8.0+
  • Swift 3.0+

Install

CocoaPods:

pod 'Alamofire-SwiftyJSON'

Carthage:

github "SwiftyJSON/Alamofire-SwiftyJSON" "master"

Usage

import Alamofire_SwiftyJSON
Alamofire.request(URL, method: .get, parameters: parameters, encoding: URLEncoding.default)
         .responseSwiftyJSON { dataResponse in
                     print(dataResponse.request)
                     print(dataResponse.response)
                     print(dataResponse.error)
                     print(dataResponse.value)
                  })

alamofire-swiftyjson's People

Contributors

endel avatar jregnauld avatar luketangpl avatar nubek avatar perryprog avatar rnitta avatar rokgregoric avatar rromanchuk avatar thomasdegry avatar trungungtoan-agilityio avatar wongzigii avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

alamofire-swiftyjson's Issues

The bundle contains disallowed nested bundles.

When submitting ios build with XCode 9.4, Swift 4.1.2 and Carthage I got this error:
Invalid Bundle. The bundle at 'MyApp.app/Frameworks/AlamofireSwiftyJSON.framework' contains disallowed nested bundles. An unknown error occurred.

Ambiguous use of 'responseSwiftyJSON'

Hello,

after installing Xcode 6.3 the following code

Alamofire .request(.POST, url, parameters: data) .responseSwiftyJSON { (_, _, json, error) in
    if (error != nil) {
        println("Error with registration: \(error?.localizedDescription)")
     } else {
        println("Success!")
    }
}

produces the problem "Ambiguous use of 'responseSwiftyJSON'".

Ambigous Error in Swift 1.2

在 Swift 1.2中下面两个方法的签名是等价的:

   public func responseSwiftyJSON(completionHandler: (NSURLRequest, NSHTTPURLResponse?, JSON, NSError?) -> Void) -> Self 
// VS
    public func responseSwiftyJSON(queue: dispatch_queue_t? = nil, options: NSJSONReadingOptions = .AllowFragments, completionHandler: (NSURLRequest, NSHTTPURLResponse?, JSON, NSError?) -> Void) -> Self 

Please update for Alamofire 3.0

In alamofire 3.0, they using

Response<T.SerializedObject, T.ErrorObject> -> Void

instead of

(request, response, result) -> Void

support JSON as parameter?

Alamofire.request(method: Method, URLString: URLStringConvertible, parameters: JSON String?, encoding: ParameterEncoding)

Push to cocoapods

I see there is a podspec file but Alamofire-SwiftyJSON is not a available on cocoapods.org. It seems to be possible to have swift dependencies on cocoapods using cocoapods 0.36.0.

Could you push it?

Compile time issue

Hi,

I am getting an error on line 40 with missing parameter for completionHandler.
Subsequent errors follow after correction.

Please review with xcode 7.6 beta and Alamofire 1.3.1 on deployment target 8.4

Regards,

Brian Minnaar

Unable to build using Xcode9

I'm using carthage to pull in Alamofire-SwiftyJSON and when trying to build with Xcode 9 GM, I get the following build error:

*** Building scheme "AlamofireSwiftyJSON" in Alamofire-SwiftyJSON.xcodeproj
*** Building scheme "AWSCore" in AWSiOSSDKv2.xcodeproj
Build Failed
Task failed with exit code 65:
/usr/bin/xcrun xcodebuild -project /Users/troyibm/git/WPA4Auto-iPadApp-ios11/WPAAutoDemo/Carthage/Checkouts/aws-sdk-ios/AWSiOSSDKv2.xcodeproj -scheme AWSCore -configuration Release -derivedDataPath /Users/troyibm/Library/Caches/org.carthage.CarthageKit/DerivedData/9.0_9A235/aws-sdk-ios/40c7d5d60e0b80d70cd1502ef0cf8507f023f8d5 -sdk iphoneos ONLY_ACTIVE_ARCH=NO BITCODE_GENERATION_MODE=bitcode CODE_SIGNING_REQUIRED=NO CODE_SIGN_IDENTITY= CARTHAGE=YES build (launched in /Users/troyibm/git/WPA4Auto-iPadApp-ios11/WPAAutoDemo/Carthage/Checkouts/aws-sdk-ios)

I'm using the following in my Cartfile:

github "Alamofire/Alamofire" ~> 4.5
github "SwiftyJSON/SwiftyJSON"
github "SwiftyJSON/Alamofire-SwiftyJSON" "master"

Cannot call value of non-function type NSHTTPURLResponse

Hello ! I have installed Alamofire 3.0 and SwiftyJSON 2.3 via CocoaPods and then I have just brough Alamofire-SwiftyJSON manually in my XCode project.

When I try building it I get an error on line 40 in Alamofire-SwiftyJSON.swift yelling at me like the following:

Cannot call value of non-function type NSHTTPURLResponse

Any idea how to fix this ?

'JSON' is not convertible to 'JSON'

I added the files of all the 3 Projects (alamofire, swiftyjson, alamofire-swiftyjson) to my project. When launching the app i get a compile error in:

/Users/ABCDEF/Documents/ios/Stream/Libraries/Alamofire-SwiftyJSON/Alamofire-SwiftyJSON.swift:51:47: 'JSON' is not convertible to 'JSON'

Does someone have any hints how to integrate the projects to a custom project?

Thanks in advance.
Greetings

how to use in XCode 6.1

compile failed

'JSON.Type' does not have a member named 'Null'

                if error != nil {
                    responseJSON = SwiftyJSON.JSON.Null(error)
                } else if object != nil {
                    responseJSON = SwiftyJSON.JSON(object: object!)
                } else {
                    responseJSON = SwiftyJSON.JSON.Null(nil)
                }

Error!

captura de pantalla 2014-11-01 a las 5 52 43 p m

I have tried to use the library but when I try I get Error .responseSwiftyJSON place, also I have a warring not as removed.
Can you help me?

Support for Carthage

I'm not sure if there is support, but when I add to my Cartfile the line github "SwiftyJSON/Alamofire-SwiftyJSON", I get the error:

*** Skipped building Alamofire-SwiftyJSON due to the error:
Dependency "Alamofire-SwiftyJSON" has no shared framework schemes

If you believe this to be an error, please file an issue with the maintainers at https://github.com/SwiftyJSON/Alamofire-SwiftyJSON/issues/new

Wrong PLIST entry in version 3.0.0

Inside the info.plist the bundle version string is still set to 2.0.0-beta.1 and not to 3.0.0:

screenshot01

This causes, that you get the following kind of error, when you try to upload an app with this framework to the App Store (or TestFlight):

screenshot02

Remove submodules

Use a Cocoapods as dependencies and fetch them for the test Examples project

Getting wrong

New to Swift, but when followed the usage example in readme, still not get correct execution order:

Alamofire.request(.GET, "http://httpbin.org/get", parameters: ["foo": "bar"])
            .responseSwiftyJSON { (request, response, json, error) in
    println("first")
}
println("second")

the "second" got printed before "first".

Is there something I missed?

Thanks.

SPM support please

SwiftyJSON and Alamofire both support Swift Package Manager.
So it's useful if this repo support SPM.

Installation instruction

For now I just copied swift file into project. Could you add instruction for normal installation or PR to Alamofire, please?

SwiftyJSON @ 11fdc5c doesn't exist

I'm trying to use this repo in CocoaPods but there's an error retrieving the mentioned version of SwiftyJSON. I think it's just matter of pointing to the right tree.

No Such Module SwiftyJSON in AlamofireSwiftyJSON.swift

I have been using Alamofire without issue, and I also have SwiftyJSON working. When I attempt to add this extension, I get an error within AlamofireSwiftyJSON.swift like this:

swiftyjson

I get that if I have included the .swift file in my project, I don't need to have the import SwiftyJSON bit, but if I remove it, I get more errors throughout this same file.

Any idea what I'm doing wrong?

Can't compile with Xcode 10.2

Xcode 10.2 was released today, which made Swift 5 the latest version, and dropped support for Swift 3. However, this project's Swift version is still set to Swift 3, so this project can't be compiled with Xcode 10.2 or be used with Swift 5 targets

Adapt to Alamofire 1.3.0

The parameter name for serializer from the response function has change to responseSerializer.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.