Skip to content

Instantly share code, notes, and snippets.

@vitorventurin
Created January 17, 2017 16:29
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 vitorventurin/7f5ba22fd81ca003e0cf726d5064b592 to your computer and use it in GitHub Desktop.
Save vitorventurin/7f5ba22fd81ca003e0cf726d5064b592 to your computer and use it in GitHub Desktop.
//
// Product
//
// Created by Vitor Venturin Linhalis.
// Copyright © 2016 Vitor Venturin Linhalis. All rights reserved.
//
import Foundation
import Mapper
struct Place : Mappable {
var id: String!
var name: String!
var vicinity: String?
var iconURL: String?
var rating: Double?
var photos: [Photo]?
init(map: Mapper) throws {
try id = map.from("id")
try name = map.from("name")
vicinity = map.optionalFrom("vicinity")
iconURL = map.optionalFrom("icon")
rating = map.optionalFrom("rating")
if rating == nil {
rating = 0.0
}
photos = map.optionalFrom("photos")
}
init() {
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment