After Xcode conversion to Swift 3.0 syntax, I got the following error:
error: cannot invoke initializer for type 'Int' with an argument list of type '(qos_class_t)' DispatchQueue.global(priority: Int(DispatchQoS.QoSClass.userInitiated.rawValue)).async { ^
note: overloads for 'Int' exist with these partially matching parameter lists: (Int64), (Word), (UInt8), (Int8), (UInt16), (Int16), (UInt32), (Int32), (UInt64), (UInt), (Int), (Float), (Double), (Float80), (String, radix: Int), (CGFloat), (NSNumber) {DispatchQueue.global(priority: Int(DispatchQoS.QoSClass.userInitiated.rawValue)).async {
Syntax after conversion :
func searchBar(_ searchBar: UISearchBar, textDidChange searchText: String) {
if searchText == "" {
self.filteredSymbols = self.symbols
self.alphabeticSymbolCollection.reloadData()
} else {
DispatchQueue.global(priority: Int(DispatchQoS.QoSClass.userInitiated.rawValue)).async {
let fs = self.filterContentForSearchText(searchText)
DispatchQueue.main.async {
self.filteredSymbols = fs
self.searchActive = true
self.alphabeticSymbolCollection.reloadData()
}
}
}
}
Syntax before conversion :
func searchBar(searchBar: UISearchBar, textDidChange searchText: String) {
if searchText == "" {
self.filteredSymbols = self.symbols
self.alphabeticSymbolCollection.reloadData()
} else {
dispatch_async(dispatch_get_global_queue(Int(QOS_CLASS_USER_INITIATED.rawValue), 0)) {
let fs = self.filterContentForSearchText(searchText)
dispatch_async(dispatch_get_main_queue()) {
self.filteredSymbols = fs
self.searchActive = true
self.alphabeticSymbolCollection.reloadData()
}
}
}
}