When I press the button within my Tableview cell it does nothing. But when I press the cell the button works. How do I make the button react without pressing cell first?
@IBAction func LikePressed(_ sender: Selector) {
let ref = Database.database().reference()
if let index = MyTable.indexPathForSelectedRow {
let aaa = timeLike[index.row].like
let bbb = timeLike[index.row].id
ref.child("users").child(bbb).child("timeline").child(aaa).child("likes").runTransactionBlock({
(currentData:MutableData!) in
var value = currentData.value as? Int
//check to see if the likes node exists, if not give value of 0.
if (value == nil) {
value = 0
}
currentData.value = value! + 1
return TransactionResult.success(withValue: currentData)
})
}
}