Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- func addModel(_ model: Model, image: UIImage?, completion: @escaping (Error?) -> Void) {
- var modelToSet = model
- var id = ""
- firstly {
- serviceWrapper.setImage(image!)
- }.map { path in
- modelToSet.imagePath = path
- }.then { [serviceWrapper]
- serviceWrapper.setModel(modelToSet)
- }.map { documentId in
- id = documentId
- }.then {
- CLLocationManager.promise()
- }.done { [serviceWrapper] location in
- serviceWrapper.setLocation(GeoPoint(latitude: location.lat, longitude: location.long), id: id)
- }.catch { error in
- completion(error)
- }
- }
Add Comment
Please, Sign In to add comment