Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@pgpt10
Last active November 4, 2017 17:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pgpt10/53713e22de5515faebe41cea23cb9aef to your computer and use it in GitHub Desktop.
Save pgpt10/53713e22de5515faebe41cea23cb9aef to your computer and use it in GitHub Desktop.
struct Photo: Codable
{
//String, URL, Bool and Date conform to Codable.
var title: String
var url: URL
var isSample: Bool
//The Dictionary is of type [String:String] and String already conforms to Codable.
var metaData: [String:String]
//PhotoType and Size are also Codable types
var type: PhotoType
var size: Size
}
struct Size: Codable
{
var height: Double
var width: Double
}
enum PhotoType: String, Codable
{
case flower
case animal
case fruit
case vegetable
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment