doge

Cannot convert value of type 'Meme!' to expected argument type '@noescape (Meme) throws -> Bool'

匿名 (未验证) 提交于 2019-12-03 03:05:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: Here is the code: @IBAction func deleteMeme(sender: UIBarButtonItem) { if let foundIndex = MemeRepository.sharedInstance.memes.indexOf(selectedMeme) { //remove the item at the found index MemeRepository.sharedInstance.memes.removeAtIndex(foundIndex) navigationController?.popViewControllerAnimated(true) The error happens at the .indexOf method at (selectedMeme) . Cannot convert value of type Meme! to expected argument type @noescape (Meme) throws -> Bool Meme! is a struct for my app. How do I work through this? struct Meme { var topText :