Created
November 28, 2015 16:04
-
-
Save ashfurrow/8194c93bd049c46d73aa to your computer and use it in GitHub Desktop.
This file contains hidden or 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 UIKit | |
protocol LocationManagerDelegate { | |
func retrievedMapLocation(location: Int) | |
} | |
class LocationManager { | |
var delegate: LocationManagerDelegate? | |
func getLocations() { | |
// TODO: Get locations | |
let locations = [1,2,3,4] | |
locations.forEach { (location) -> () in | |
self.delegate?.retrievedMapLocation(location) | |
} | |
} | |
} | |
class ViewController: UIViewController, LocationManagerDelegate { | |
let manager = LocationManager() | |
override func viewDidLoad() { | |
manager.delegate = self | |
} | |
func retrievedMapLocation(location: Int) { | |
// TODO: Update our map | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
/cc @hetony