I have code written in objective c.I want to convert this code into the swift3 code.
[_expandableTableView reloadSections:[NSIndexSet indexSetWithIndex:gestureRecognizer.view.tag] withRowAnimation:UITableViewRowAnimationAutomatic];
After converting using online tool it gave me below code but it does not work
expandableTableView.reloadSections(IndexSet(index: gestureRecognizer.view!.tag), with: .automatic)
Please tell me how to do it ?
Reload Section in Swift 3.0
i.e Reloading 0th section to 0th Section, Because tableview has default one section that index is 0.
//let myRange: ClosedRange = 0...0
self.tableViewPostComments.reloadSections(IndexSet(integersIn: 0...0), with: UITableViewRowAnimation.top)
For Swift 4
self.tableViewPostComments.reloadSections(IndexSet(integersIn: 0...0), with: UITableView.RowAnimation.top)
For Swift 5
In Swift 5 you can use this short & simple line.
self.tableViewPostComments.reloadSections(IndexSet(integersIn: 0...0), with: .top)
do like in swift3 for more information see this
expandableTableView.reloadSections(IndexSet(integer: gestureRecognizer.view!.tag), with: .automatic)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With