这个问题在这里已有答案:
快速语言 5答案中 '#'标记的含义是什么?在更新到swift 2.0+之前,它有效。 现在没有内部参数?
我该如何更改然后让它正常工作?
我发现我需要删除“func”和“#”但它没有帮助D:
func previewFile(#path: NSIndexPath) { UIApplication.sharedApplication().networkActivityIndicatorVisible = false self.fileIsLoading = false let previewQL = QLReaderViewController() previewQL.dataSource = self previewQL.delegate = self previewQL.hidesBottomBarWhenPushed = true self.filepath = path self.navigationController?.pushViewController(previewQL, animated: true) }所以我这样做了...... 在这里输入图像描述
但如果我删除这个“路径”它会正常工作吗? 为什么声明参数被改变了? 我的意思是 - 它有效。 但为什么
previewFile(indexPath!)代替
previewFile(path: indexPath!)This question already has an answer here:
What is the meaning of the '#' mark in swift language 5 answersBefore update to swift 2.0+ it worked. Now there is no internal parameters?
How should I change it then to let it work correctly?
I found out that I need to delete "func" and "#" but it didn't help D:
func previewFile(#path: NSIndexPath) { UIApplication.sharedApplication().networkActivityIndicatorVisible = false self.fileIsLoading = false let previewQL = QLReaderViewController() previewQL.dataSource = self previewQL.delegate = self previewQL.hidesBottomBarWhenPushed = true self.filepath = path self.navigationController?.pushViewController(previewQL, animated: true) }So i did so ... enter image description here
But if i delete this "path" would it work correctly? Why declaration of a parameter was changed so? I mean - it works. But why
previewFile(indexPath!)instead of
previewFile(path: indexPath!)最满意答案
您不能再使用#作为内部参数命名。 您应该编写如下函数:
func previewFile(path path: NSIndexPath) { // Your code }You can't use # for internal argument naming anymore. You should write the function like:
func previewFile(path path: NSIndexPath) { // Your code }更多推荐
发布评论