This is block of code illustrate how i call binarySearch(in:for:) :
the binarySearch(in:for:) function is not belong to any class and can call directly any where
public class ScannerManagerCovid {
func checkContactF() {
let dispatch = DispatchQueue(label: "Bluezone.Trace")
dispatch.async {
let result = BluezoneIdTrace.checkContactF()
resolve(result)
}
}
class BluezoneIdTrace {
static func checkContactF() {
let indexfinded = binarySearch(in: contacts, for: bluezoneIdHexString)
resolve(indexfinded)
}
}
func binarySearch(in contacts: [Contact], for value: String) -> Int? {
...
}
Topic:
App & System Services
SubTopic:
General
Tags: