Comments (8)
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.
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.
Did you make an extension to User with JSONDecodable protocol like this?
extension User : JSONDecodable {
...
}
from functionaljson-swift.
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.
I got that working yesterday, but failed on xcode crashing and swift compiler hanging. Can you paste more code?
from functionaljson-swift.
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.
The mapping code would help more..
from functionaljson-swift.
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)
- License? HOT 1
- Nested model parsing HOT 1
- Tests are not failing
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from functionaljson-swift.