“Post”类型的值没有成员'adjustLikes'(Swift编译器错误)

时间:2018-01-14 00:57:09

标签: swift firebase

我收到以下错误消息:

  

“发布”类型的值没有成员'adjustLikes'

这是我的代码:

@IBAction func liked(_ sender: Any) {
    let likeRef = Database.database().reference().child("users").child(currentUser!).child("likes").child(post.postKey)
    likeRef.observeSingleEvent(of: .value, with:  { (snapshot) in
        if let _ = snapshot.value as? NSNull {
            self.post.adjustLikes(addlike: true)
            likeRef.setValue(true)
        } else {
            self.post.adjustLikes(addlike: false)
            likeRef.removeValue()

0 个答案:

没有答案