ios - swift 2 警告 : Passing 2 arguments to a callee as a single tuple value is deprecated

标签 ios swift

我有这样的代码:

func newContent(jsonData: [String:AnyObject]) {
    if let userContent: (User, String) = Helper.createUserFromWritingContent(jsonData) {
        newContent?(userContent) // here is the warning: Passing 2 arguments to a callee as a single tuple value is deprecated
    }
}

我该如何解决这个警告?

最佳答案

此警告在 here 中指定

Swift 3 将弃用将元组作为参数发送的选项。试试这个

func newAnswerWritingContent(jsonData: [String:AnyObject]) {
   if let userContent: (BRSLegacyUser, String) = CometHelper.createBRSAnwerFromWritingContent(jsonData) {
      let user = userContent.0
      let content = userContent.1
       newAnswerWritingContent?(user,content)
   }
}

关于ios - swift 2 警告 : Passing 2 arguments to a callee as a single tuple value is deprecated,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37588857/

相关文章:

ios - Xcode错误: xpected to have a root view controller at the end of application launch

ios - 启动 screen.storyboard 纵向和横向 vs 分屏

ios - 如何从 Xcode 9 中打开的多个模拟器中退出或关闭单个模拟器?

ios - UIViewController, Storyboard,没有 init 方法

ios - 如何测试用户是否更改了 UITextInput?

ios - 有没有办法自定义 TDBadgedCell

ios - UILabel 高度取决于文本

swift - FirebaseAuth 未通过 Google 身份验证创建新用户 - Swift

ios - swift 中 iOS 应用程序中文件的绝对路径

swift - 无法分配给属性 : 'xxxx' is a get-only property