martin
martin

Reputation: 1974

SwiftyJSON not working / Swift 1.2 SwiftyJSON file

When I added my SwiftyJSON file to my project, it had like 45 errors where about 44 of them were changing as to as!. Now I'm stuck at the last one on line 238 before I'm good to go. The error says:

Cannot assign a value of type 'AnyObject' to a value of type 'AnyObject!'

and the code looks like this:

    set {
            if self.type == .Array {
                var array_: AnyObject = self.object as![AnyObject]
                if array_.count > index {
                    array_[index] = newValue.object
                    self.object = array_
                }
            }
        }

The error is in the line with array_[index] = newValue.object.

Please help me figure this one out, thanks in advance.

Upvotes: 4

Views: 1758

Answers (1)

Aodh
Aodh

Reputation: 682

There's a branch named 'xcode6.3' which seems to be compatible. If using Cocoapods, you can change the Podfile to point at the branch as follows:

pod 'SwiftyJSON', :git => 'https://github.com/SwiftyJSON/SwiftyJSON.git', :branch => 'xcode6.3'

Upvotes: 4

Related Questions