Skip to content

Instantly share code, notes, and snippets.

@fikeminkel
Last active April 15, 2018 12:49
Show Gist options
  • Save fikeminkel/b5690a107456d1603a674ac8700a2b5a to your computer and use it in GitHub Desktop.
Save fikeminkel/b5690a107456d1603a674ac8700a2b5a to your computer and use it in GitHub Desktop.
import UIKit
class Service {
typealias ServiceId = String
let id: ServiceId
init(id: ServiceId) {
self.id = id
}
}
class ServiceAvailability {
func checkAvailabilityOf(serviceId: Service.ServiceId, handler: (Service.ServiceId, Bool) -> ()) {
handler(serviceId, true)
}
}
let service = Service(id: "myServiceId")
let availability = ServiceAvailability()
availability.checkAvailabilityOf(serviceId: service.id) { id, available in
print("service \(id) is available? \(available)")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment