Swift-“一个;应为“类型”;指向函数参数时出错

Swift-“一个;应为“类型”;指向函数参数时出错,swift,xcode,Swift,Xcode,我正在学习一个iMessage扩展教程,其中列出的一个函数让我感到困惑,因为我从未在函数的签名中看到逻辑not运算符。根据教程,我们正在编写一个类函数,用于从端点检索数据。我不确定作者的意图是否是获取非帖子的数据?这行代码还在Xcode中抛出一个错误,上面写着“预期类型”。根据文件结构说明在Objective-C中看到此错误,但本教程指定的参数类型在同一Swift文件中列出 import Foundation struct Post { var title: String? v

我正在学习一个iMessage扩展教程,其中列出的一个函数让我感到困惑,因为我从未在函数的签名中看到逻辑not运算符。根据教程,我们正在编写一个类函数,用于从端点检索数据。我不确定作者的意图是否是获取非帖子的数据?这行代码还在Xcode中抛出一个错误,上面写着“预期类型”。根据文件结构说明在Objective-C中看到此错误,但本教程指定的参数类型在同一Swift文件中列出

import Foundation

struct Post {
    var title: String?
    var score: NSNumber?
    var url: String?
    var domain: String?
}


class RedditAPI {
    static let REDDIT_API_URL = "https://www.reddit.com/r/programming.json"

    //a single function that fetches reddit posts.....and takes a completion closure....hmm who is this completion closure for and what will it do?  Is it fired after all of the reddit posts are retrieved from the web server?
    //according to the tutorial, the completion closure  should accept an array of Reddit post objects.
    class func getTopStories(_ completionBlock: ((results: ![Post]) -> Void )){

    }
}

你为什么任意插入一个
在那里?删除它并继续下一个错误。喜欢它!我从来没有见过这样使用not运算符,所以我想你对@rmaddy了解得更多。我想确保我的任务涵盖了所有的基地understanding@CosmicArrows我会避免使用本教程。通过所有的强制展开,很明显作者对正确的swift开发知之甚少。@Alexander是的,JSON解析代码离任何人都应该做的事情还有很长的路要走。糟糕的教程,有很多糟糕的代码。