Giter Site home page Giter Site logo

Comments (8)

alhafoudh avatar alhafoudh commented on July 28, 2024

I think you need to specify type for the user variable, so instead of this:

performRequest(request: req) { (user) -> () in

do this:

performRequest(request: req) { (user: User) -> () in

Creators of this repo started to work on Argo framework using same principles: https://github.com/thoughtbot/Argo

from functionaljson-swift.

Reak45 avatar Reak45 commented on July 28, 2024

Unfortunatley your solution does not work. Now I get the following error:

/Users/SM/Downloads/FunctionalJSON-swift-d3fcf771c20813e57cb54472dd8c55ee33e87ae4/FunctionalJSON/ViewController.swift:19:9: Type '(request: @lvalue NSURLRequest, (User) -> ())' does not conform to protocol 'JSONDecodable'

And regarding to Argo, as far as I can see there is not a single callback used in the Agro's code

from functionaljson-swift.

alhafoudh avatar alhafoudh commented on July 28, 2024

Did you make an extension to User with JSONDecodable protocol like this?

extension User : JSONDecodable {
...
}

from functionaljson-swift.

Reak45 avatar Reak45 commented on July 28, 2024

Yes, there is an extension to User. I am struggling with this for over 3 days now. I have tried every thing and nothing works. Could be some change in language?

from functionaljson-swift.

alhafoudh avatar alhafoudh commented on July 28, 2024

I got that working yesterday, but failed on xcode crashing and swift compiler hanging. Can you paste more code?

from functionaljson-swift.

Reak45 avatar Reak45 commented on July 28, 2024

Yeah sure but I haven't made many changes from default state of project. In fact I added only performRequest method in ViewController class. Here the code:

import UIKit

class ViewController: UIViewController {

override func viewDidLoad() {
    super.viewDidLoad()

    var req = NSURLRequest() //I create empty request cause it is not needed for successful build


    performRequest(request: req) { (user : User) -> () in
        println("user callback raised!")
    }
}

override func didReceiveMemoryWarning() {
    super.didReceiveMemoryWarning()
    // Dispose of any resources that can be recreated.
}

}

from functionaljson-swift.

alhafoudh avatar alhafoudh commented on July 28, 2024

The mapping code would help more..

from functionaljson-swift.

Reak45 avatar Reak45 commented on July 28, 2024

The mapping code? Could you explain what that is? I am quite new to Swift and I may be missing some things

from functionaljson-swift.

Related Issues (4)

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.