Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Compile Error In Loop Array #107

Closed
codetalks-new opened this issue Dec 9, 2014 · 1 comment
Closed

Compile Error In Loop Array #107

codetalks-new opened this issue Dec 9, 2014 · 1 comment

Comments

@codetalks-new
Copy link

code is

        if let arr = json["timetable"].array {
            for (index:String,subJson:JSON) in arr {
                timetable.append(SectionTime(subJson))
            }
        }

error is:

swiftyjson 'JSON' is not convertible to '(String, JSON)'

in line for (index:String,subJson:JSON) in arr

@LukeTangPL
Copy link
Member

Replace your cod to:

for ((index:String,subJson:JSON) in json["timetable"] ) {
    timetable.append(SectionTime(subJson))
}

In your code the arr is Array not JSON

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants