Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Revert "Added rawObject method for unwrapping JSONValue enum to objects" #56

Merged
merged 1 commit into from
Sep 24, 2014

Conversation

LukeTangPL
Copy link
Member

Reverts #45
Now use object method

LukeTangPL added a commit that referenced this pull request Sep 24, 2014
Revert "Added rawObject method for unwrapping JSONValue enum to objects"
@LukeTangPL LukeTangPL merged commit 0934001 into master Sep 24, 2014
@LukeTangPL LukeTangPL deleted the revert-45-master branch September 24, 2014 06:28
@k06a
Copy link
Contributor

k06a commented Sep 27, 2014

Right now I can't see any var object in SwiftyJSON

@k06a
Copy link
Contributor

k06a commented Sep 27, 2014

I need this piece of code:

//MARK: - Object
extension JSON {

    var object: AnyObject? {
        switch self {
        case .ScalarNumber(let value):
            return value
        case .ScalarString(let value):
            return value
        case .Null(let error):
            return NSNull()
        case .Sequence(let value):
            var jsonValues = [AnyObject]()
            for alreadyJsonValue in value {
                if  let jsonValue: AnyObject? = alreadyJsonValue.object {
                    jsonValues.append(jsonValue!)
                }
            }
            return jsonValues
        case .Mapping(let value):
            var jsonObject = Dictionary<String, AnyObject>()
            for (alreadyJsonKey : String, alreadyJsonValue : JSON) in value {
                if let jsonValue: AnyObject? = alreadyJsonValue.object {
                    jsonObject[alreadyJsonKey] = jsonValue!
                }
            }
            return jsonObject
        default:
            return nil
        }
    }
}

@LukeTangPL
Copy link
Member Author

@k06a You can fin it at line 128

@k06a
Copy link
Contributor

k06a commented Sep 28, 2014

@tangplin I looked in fork lingoer/SwiftyJSON, just pulled SwiftyJSON/SwiftyJSON, it is ok!

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

Successfully merging this pull request may close these issues.

None yet

3 participants