AceExpandableTextCell Documentation
AceExpandableTextCell is a customizable expandable and collapsible text cell for iOS. It allows users to display long text content in a compact format and expand or collapse it with a simple tap.
## Installation
To install AceExpandableTextCell, follow these steps:
1. Open your Xcode project.
2. Go to **File -> Swift Packages -> Add Package Dependency**.
3. Enter the repository URL `https://github.com/DaxeshPoriya/aceexpandabletextcell.git`.
4. Choose the desired version, or select “Up to Next Major” to automatically use the latest stable version.
5. Click **Next** and choose the target where you want to add the package.
6. Click **Finish** to complete the installation.
## Usage
To use AceExpandableTextCell in your project, follow these steps:
1. Import the framework in your file:
“`swift
import AceExpandableTextCell
“`
2. Create an instance of `AceExpandableTextCell` and configure it:
“`swift
let expandableTextCell = AceExpandableTextCell()
expandableTextCell.title = “Expandable Text”
expandableTextCell.content = “This is the expandable content. Tap to expand or collapse.”
“`
3. Customize the appearance of the cell using the available properties:
“`swift
expandableTextCell.titleColor = .black
expandableTextCell.contentColor = .gray
expandableTextCell.titleFont = UIFont.boldSystemFont(ofSize: 16)
expandableTextCell.contentFont = UIFont.systemFont(ofSize: 15)
“`
4. Add the cell to your table view:
“`swift
tableView.addSubview(expandableTextCell)
“`
## Customizations
AceExpandableTextCell provides several customization options to tailor the appearance of the cell according to your needs:
– `title`: Sets the title of the cell.
– `content`: Sets the initial content of the cell.
– `titleColor`: Sets the color of the title text. Default is black.
– `contentColor`: Sets the color of the content text. Default is gray.
– `titleFont`: Sets the font of the title text. Default is bold system font of size 16.
– `contentFont`: Sets the font of the content text. Default is system font of size 15.
– `titlePaddingTop`: Sets the top padding of the title. Default is 8.
– `titlePaddingBottom`: Sets the bottom padding of the title. Default is 8.
– `contentPaddingTop`: Sets the top padding of the content. Default is 8.
– `contentPaddingBottom`: Sets the bottom padding of the content. Default is 8.
You can use these properties to customize the appearance of the cell as per your requirements.
## Examples
Here are a few examples to showcase the usage of AceExpandableTextCell:
– Example 1: Basic Expandable Cell
“`swift
let expandableTextCell = AceExpandableTextCell()
expandableTextCell.title = “Expandable Text”
expandableTextCell.content = “This is the expandable content. Tap to expand or collapse.”
tableView.addSubview(expandableTextCell)
“`
– Example 2: Customized Appearance
“`swift
let expandableTextCell = AceExpandableTextCell()
expandableTextCell.title = “Expandable Text”
expandableTextCell.content = “This is the expandable content. Tap to expand or collapse.”
expandableTextCell.titleColor = .blue
expandableTextCell.contentColor = .darkGray
expandableTextCell.titleFont = UIFont.boldSystemFont(ofSize: 18)
expandableTextCell.contentFont = UIFont.systemFont(ofSize: 17)
tableView.addSubview(expandableTextCell)
“`
Feel free to experiment with different settings and configurations to achieve the desired appearance and functionality.
## Conclusion
AceExpandableTextCell is a versatile library that allows you to easily implement expandable and collapsible text cells in your iOS projects. With its customizable options, you can create a more interactive and user-friendly interface.