在Swift 4中, 我正在尝试将UISearchBar文本字段的文本长度与最小长度进行比较:
OUTPUT_ARCH(sh3)
ENTRY(initialize)
MEMORY
{
rom : o = 0x00300200, l = 512k
ram : o = 0x08100000, l = 64k /* 64k pretty safe guess */
/*
rom start 0x00300200 (+512k = +0x0007D000)
end 0x0037D200
ram start 0x08100000 ( +64k = +0x0000FA00)
end 0x0810FA00
*/
}
SECTIONS
{
.text : {
*(.pretext) /* init stuff */
*(.text)
} > rom
.rodata : {
*(.rodata)
*(.rodata.str1.4)
_romdata = . ; /* symbol for initialization data */
} > rom
.bss : {
_bbss = . ;
_bssdatasize = . ;
LONG(0); /* bssdatasize */
*(.bss) *(COMMON);
_ebss = . ;
} > ram
.data BLOCK(4) : AT(_romdata) {
_bdata = . ;
*(.data);
_edata = . ;
} > ram
}
但是我得到了错误:
二进制运算符'=='不能应用于类型为'Slice
的操作数'和'[[String:AnyObject]]'
答案 0 :(得分:0)
正确的回调
func searchBar(_ searchBar: UISearchBar, textDidChange searchText:String) {
searcharr = arrRes.keys.filter{(arrRes[$0] as? String)?.hasPrefix(searchText) ?? false }
}
//
let result = arrRes.filter {
let dic = $0
return $0.keys.filter { (dic[$0] as? String )?.hasPrefix(searchText) ?? false }.count != 0
}
print(result)