Last active
April 15, 2018 12:49
-
-
Save fikeminkel/b5690a107456d1603a674ac8700a2b5a 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 | |
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