Skip to content
This repository has been archived by the owner on Feb 2, 2023. It is now read-only.

Alexander + RawRepresentable = ❤️ #6

Merged
merged 6 commits into from Nov 17, 2015

Conversation

cocoahero
Copy link
Contributor

This PR adds some new functionality:

  • Adds generic decode<T>(transform: JSON -> T) -T? function.
    • This allows users to decode something that might not be JSONDecodable.
  • Adds decode<T: JSONDecodable>(type: T.Type) -> T? function.
    • This builds on the previous function addition to help clean up code paths such as let author = JSON["author"]?.decode(Author).
  • Adds decode<T: RawRepresentable>(type: T.Type) -> T?
    • Allows a user to decode JSON into a single enum instance.
  • Adds decodeArray<T: RawRepresentable>(type: T.Type) -> [T]?
    • Works like its JSONDecodable sibling, allows you to decode an array of enums.

cocoahero added a commit that referenced this pull request Nov 17, 2015
@cocoahero cocoahero merged commit 0ac6f3b into master Nov 17, 2015
@cocoahero cocoahero deleted the decodeArray-RawRepresentable branch November 17, 2015 01:30
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant