Forked from derrickshowers/gist:80fb450490ff03e6e274
Last active
August 29, 2015 14:22
-
-
Save damionvega/c99eba6e775713c84e1b to your computer and use it in GitHub Desktop.
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
import UIKit | |
protocol YelpRequestDelegate { | |
func getYelpData() -> AnyObject | |
func processYelpData(data: NSData) -> NSData | |
} | |
class YelpAPI { | |
var delegate: YelpRequestDelegate? | |
func getData() { | |
println("data being retrieved...") | |
let data: AnyObject? = delegate?.getYelpData() | |
} | |
func processYelpData(data: NSData) { | |
println("data being processed...") | |
let data = delegate?.processYelpData(data) | |
} | |
} | |
class Controller: YelpRequestDelegate { | |
init() { | |
var yelpAPI = YelpAPI() | |
yelpAPI.delegate = self | |
yelpAPI.getData() | |
} | |
func getYelpData() -> AnyObject { | |
println("getYelpData called") | |
return NSData() | |
} | |
func processYelpData(data: NSData) -> NSData { | |
println("processYelpData called") | |
return NSData() | |
} | |
} | |
var controller = Controller() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment