Ios “Xcode错误”;类型为'的值;[UIViewController]';没有成员';firstObject'&引用;
我正在尝试创建的Swift版本。我首先将所有代码从Objective-C直接传输到Swift,这导致了很多错误(321行文件中有60多个错误) 对于此特定代码行Ios “Xcode错误”;类型为'的值;[UIViewController]';没有成员';firstObject'&引用;,ios,swift,uiviewcontroller,syntax-error,Ios,Swift,Uiviewcontroller,Syntax Error,我正在尝试创建的Swift版本。我首先将所有代码从Objective-C直接传输到Swift,这导致了很多错误(321行文件中有60多个错误) 对于此特定代码行 self.currentViewController = self.childViewControllers.firstObject 我得到这个错误: Value of type '[UIViewController]' has no member 'firstObject' 我已尝试将添加为!UIViewController,并
self.currentViewController = self.childViewControllers.firstObject
我得到这个错误:
Value of type '[UIViewController]' has no member 'firstObject'
我已尝试将
添加为!UIViewController
,并在大多数可能的位置放置感叹号和问号。我在建议的帖子中尝试的东西都没有帮助。它只是在Swift数组上被称为first
self.currentViewController = self.childViewControllers.first