我正在尝试实现UITableViewDataSource所需的方法,但我得到一个奇怪的错误:
"无效重新声明'tableview(_:cellForRowAtIndexPath :)'"
但是我不确定问题是什么.以下是两个相关的代码行,类的声明和符合协议/超类:
class SubjectFormViewController: UIViewController,UITableViewDelegate,UITableViewDataSource
以及触发错误的函数声明:
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) ->  UITableViewCell
注意:我搜索了很多,例如Invalid redeclaration of UITableViewDataSource method? 不适用于我的情况。因为我的代码中没有重复的文件或类。
我的项目中只有一个 AppDelegate.swift 文件,并且AppDelegate该文件中只有一个类。但我有
我在 AppDelegate.swift 文件中还有以下代码。我收到以下错误。
extension Data {
    var hexString: String {
        return withUnsafeBytes {(bytes: UnsafePointer<UInt8>) -> String in
            let buffer = UnsafeBufferPointer(start: bytes, count: count)
            return buffer.map {String(format: "%02hhx", $0)}.reduce("", { $0 + $1 })
        }
    }
}
注意,我已经在我的项目中 grep 了重复的类或变量声明,并且代码中有一次声明。