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
someAsyncFunction { | |
anotherAsyncFunction1 { | |
anotherAsyncFunction2 { | |
anotherAsyncFunction3 { | |
anotherAsyncFunction4 { | |
// Thanks to God this has no error handling 😰 | |
} | |
} | |
} | |
} |
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
func getUser(withID id: Int) -> Future<User> { | |
return Future { completion in | |
// Here you call an API | |
// that returns the user you are looking for. | |
APIClient.get(getUserURL(id: id)) { user in | |
completion(.success(user)) | |
} | |
} | |
} |
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
[ | |
{ | |
"elementType": "geometry", | |
"stylers": [ | |
{ | |
"color": "#ebe3cd" | |
} | |
] | |
}, | |
{ |
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
private func configureTileOverlay() { | |
// We first need to have the path of the overlay configuration JSON | |
guard let overlayFileURLString = Bundle.main.path(forResource: "overlay", ofType: "json") else { | |
return | |
} | |
let overlayFileURL = URL(fileURLWithPath: overlayFileURLString) | |
// After that, you can create the tile overlay using MapKitGoogleStyler | |
guard let tileOverlay = try? MapKitGoogleStyler.buildOverlay(with: overlayFileURL) else { | |
return |
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
func mapView(_ mapView: MKMapView, rendererFor overlay: MKOverlay) -> MKOverlayRenderer { | |
// This is the final step. This code can be copied and pasted into your project | |
// without thinking on it so much. It simply instantiates a MKTileOverlayRenderer | |
// for displaying the tile overlay. | |
if let tileOverlay = overlay as? MKTileOverlay { | |
return MKTileOverlayRenderer(tileOverlay: tileOverlay) | |
} else { | |
return MKOverlayRenderer(overlay: overlay) | |
} | |
} |
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
// | |
// ViewController.swift | |
// MapKitGoogleStylerExample | |
// | |
// Created by Fernando Ortiz on 2/6/17. | |
// Copyright © 2017 Fernando Martín Ortiz. All rights reserved. | |
// | |
import UIKit | |
import MapKit |
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
// | |
// Task.swift | |
// TaskFramework | |
// | |
// Created by Fernando Ortiz on 2/7/17. | |
// Copyright © 2017 Fernando Martín Ortiz. All rights reserved. | |
// | |
import Foundation | |
public enum TaskError: Error { |
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
// | |
// Request.swift | |
// | |
// Created by Fernando Ortiz on 2/12/17. | |
// | |
import Foundation | |
enum HTTPMethod: String { | |
case get, post, put, patch, delete |
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
// | |
// NetworkDispatcher.swift | |
// | |
// Created by Fernando Ortiz on 2/11/17. | |
// Copyright © 2017 Fernando Martín Ortiz. All rights reserved. | |
// | |
import Foundation | |
import RxSwift |
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
// | |
// Task.swift | |
// | |
// Created by Fernando Ortiz on 2/11/17. | |
// | |
import Foundation | |
import RxSwift | |
class Task<Input, Output> { |