Created
February 9, 2019 17:16
-
-
Save djds23/9ae8681d052dd4b887dcb1faa112879a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
enum MovieGenre: Int, Codable { | |
case action, horror, art, comedy, drama | |
} | |
let genre: MovieGenre = .action | |
let encoder = JSONEncoder() | |
// On the follow line, the code raises Swift.EncodingError.invalidValue | |
let jsonValue = try! encoder.encode(genre) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment