gpt4 book ai didi

ios - (SWIFT2.1) 运算符后的预期表达式

转载 作者:行者123 更新时间:2023-11-30 13:57:47 24 4
gpt4 key购买 nike

我正在开发一个需要 TableView 的应用程序,我的意思是使用结构和数组在 TableView 之间传递数据。我有一个问题 enter image description here

正如您在上图中看到的,“准备继续”之后出现了一个问题,我花了几天时间尝试解决,但找不到任何解决方案。

所以问题是这个运算符期望什么表达式?

最佳答案

| 不是您要查找的内容。写:

让 destViewController = seque.destinationViewController 为!模型TableViewController
//我做了一些改进,比如let和命名约定

并且您应该使用选项来提高代码安全性:

if let destViewController = seque.destinationViewController as? ModelsTableViewController {
//Now you're sure destViewController is allocated
//Do your stuff here
}

您还应该使用良好的命名约定进行命名。喜欢(这是一个奖励):

STHModelsTableViewController

关于ios - (SWIFT2.1) 运算符后的预期表达式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33393360/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com