I have doubt in Swift 3.0
In Objective-C you can declare a property for selector like this
@property (nonatomic,assign)SEL ItemSelected;
But how to declare a selector in Swift 3.0 as property because I would like to use this property in other class and should give action in that class.
I am trying to use it like this (Declared in tableview cell):
var itemSelected = #selector(selctedItem(_ :))
Using it in viewcontroller table view cell
cell.itemSelected(target: self, action: HomeViewController.self.selctedItem(_ :))
it's giving error
use of Undeclared item selectedItem
I am not sure how to use in tableview with selctor.
You can declare selector in Swift 3 like this.
Or
Later you can use above
itemSelectedselector with action like this.For eg:
And
tapGestureis declared likeEdit: You have added
collectionViewinside yourTableViewCell, so to get the selected IndexPath ofCollectionViewCell, declare one protocol and use it with your tableViewCell.Now create one instance of SelectedCellDelegate and instance of
IndexPathwithin your CustomTableViewCell.Now inside your ViewController where you have added TableView implement the protocol
SelectedCellDelegateand set thedelegateandtableCellIndexPathincellForRowAt indexPathmethod.Now add the delegate method in your ViewController.