![](/img/trans.png)
[英]error : type “UserAccView” does not conform to protocol 'UITableViewDataSource'
[英]Swift func - Does not conform to protocol “Boolean Type”
是的,這是人與編譯器的時間,編譯器又贏了! 在func getRecordNumber中,我返回一個布爾和一個字典
func getRecordNumber(recordNumber: Int32) -> (isGot: Bool, dictLocations: Dictionary <String, Double>)
...
return (isGot, dictLocations)
但是,在我調用了func並詢問布爾isGot返回值之后,我得到了錯誤消息
(isGot: Bool, dictLocations: Dictionary <String, Double>) Does not conform to protocol "Boolean Type"
有什么想法我遺漏了嗎?
您不需要像這樣向return中添加參數(isGot: Bool, dictLocations: Dictionary <String, Double>)
。 您只需要告訴編譯器此函數將返回哪種類型。
這是實現該目標的正確方法:
func getRecordNumber(recordNumber: Int32) -> (Bool, Dictionary <String, Double>)
{
let isGot = Bool()
let dictLocations = [String: Double]()
return (isGot, dictLocations)
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.