这是代码:
@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)
Run Code Online (Sandbox Code Playgroud)
错误发生在.indexOf方法处(selectedMeme).
无法将类型的值转换Meme!为预期的参数类型@noescape (Meme) throws -> Bool
米姆!是我的应用程序的结构.我如何解决这个问题?
struct Meme {
var topText : String!
var bottomText: String!
var image: UIImage!
var memedImage: UIImage!
init(topText: String, bottomText: String, image: UIImage, memedImage: UIImage) {
self.topText = topText
self.bottomText = bottomText
self.image = image
self.memedImage = memedImage
Run Code Online (Sandbox Code Playgroud)