Closed penland365 closed 9 years ago
@penland365 Hello, What version of Argo are you using? The global decode
function might not be available in your version. If it is, you should be able to decode the json into the array like so:
let people: People? = decode(j)
The decode
function takes the AnyObject
and returns the decoded type/types, which, in this case, is People
or [Person]
. If that isn't working for you, would you mind posting more code around the issue so I can see what might be wrong?
Hi @tonyd256 - I'm currently on Using Argo (0.4.3)
according to my Podfile
- what version do I need to be at?
Hmm, this may be a cocoa pods
issue, I'm not sure - decode.swift
is in the project, but Swift swears by all the compiler gods that it cannot find it. decode
is the only thing I haven't been able to find however.
Can you share your podfile? ( Or at least the relevant line?)
On Apr 13, 2015, at 18:26, Jeffrey N. Davis notifications@github.com wrote:
Hmm, this may be a cocoa pods issue, I'm not sure - decode.swift is in the project, but Swift swears by all the compiler gods that it cannot find it. decode is the only thing I haven't been able to find however.
— Reply to this email directly or view it on GitHub.
platform :ios, '8.0'
use_frameworks!
target 'jonah' do
pod 'Argo'
end
target 'jonahTests' do
pod 'Argo'
end
I've excluded additional pods, but that's the meat of it. That could be wrong format - I'm a Scala guy dipping in to another world here. But I do have access ( and do use ) most if not all of the operators in both JSONOperators.swift
and Operators.swift
Running pod install
gives Using Argo 0.4.3 (was 0.4.3)
A bit more information - I tried running off of master w/ the following:
platform :ios, '8.0'
use_frameworks!
target 'jonah' do
pod 'Argo', :git => 'https://github.com/thoughtbot/Argo.git'
end
target 'jonahTests' do
pod 'Argo', :git => 'https://github.com/thoughtbot/Argo.git'
end
In this case, I can see the decode.swift
file:
The compiler is still confused however and it can't see it. Running pod install
gives the version here at 0.4.2
To give a bit of an update, I can't compile w/ Swift 1.2
off of master, 0.4.2
. I'm being told that no such module Box
has been found in the file Decoded.swift
You really shouldn't be pointed at master
. We'd rather you point at a specific release.
The reason you aren't finding Box
is because it hasn't been added to the Podfile
RIP penland365, stung by a build tool.
Hahaha. Glad that helped, sorry it took so long to get there.
Howdy, first I wanted to say thanks so much for this library - we are getting a huge amount of use out of it.
We're hitting a third party API that is returning a root array much like how you have in your test suite. Currently, we are typealiasing the plural of the Model like so:
My question is, is there an easy to way to decode into this? We haven't been able to figure it out syntactically yet. For the
Person
type, the syntax goes like thisWe even tried giving up on the
typealias People = [Person]
and used a simple struct w/ one data type and the JSONDecodable extension, but I just can't quite grasp how the globaldecode
function works -Swift 1.2
is most certainly not a fan, claiming it can't find it.Thanks!