Hide on section if text is empty and Show the section if text is not empty iOS swift

 Problem:

I want to hide one section if my text value is empty.If  my text is not empty then want to show the section with text.

How to achieve that?

Solution:

    func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {

        switch indexPath.section {

        case  mysection:

            if text != nil {

                return 82

            }

            return 0

}

}


Comments

Popular posts from this blog

Invalid bundle error while upload the app to the app Store

Saved Image in document directory and save path in coredata not able to fetch the image file iOS swift