in FriendlyPix/FPFeedViewController.swift [600:617]
func toogleLike(_ post: FPPost, label: UILabel) {
let postLike = database.reference(withPath: "likes/\(post.postID)/\(uid)")
if post.isLiked {
postLike.removeValue { error, _ in
if let error = error {
print(error.localizedDescription)
return
}
}
} else {
postLike.setValue(ServerValue.timestamp()) { error, _ in
if let error = error {
print(error.localizedDescription)
return
}
}
}
}