内部名称swift 2.0+?(Internal name swift 2.0+? [duplicate])

系统教程 行业动态 更新时间:2024-06-14 16:53:07
内部名称swift 2.0+?(Internal name swift 2.0+? [duplicate])

这个问题在这里已有答案:

快速语言 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 answers

Before 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 }

更多推荐

本文发布于:2023-04-05 21:10:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/dzcp/86793ff7d19cf941ab2dfabf9badcf67.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:名称   swift   Internal   duplicate

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!