Installation
To install the RaisinToast framework, follow these steps:
- Open Terminal and navigate to your project directory.
- Run the following command to install the framework using CocoaPods:
pod 'RaisinToast', '~> 1.0'
Usage
Follow the steps below to start using RaisinToast in your project:
- In your Xcode project, open the file where you want to use RaisinToast.
- Import the RaisinToast framework:
import RaisinToast
- Create a new instance of RaisinToast and assign it to a variable:
let toast = RaisinToast()
- Customize the appearance and behavior of the toast as needed:
// Show toast with a message
toast.show(message: "Hello, world!")
// Show toast for a specific duration (in seconds)
toast.show(message: "Loading...", duration: 2.5)
// Show toast with a custom background color
toast.backgroundColor = UIColor.red
// Show toast with a custom text color
toast.textColor = UIColor.white
Refer to the API documentation below for a complete list of available customization options.
Customization
RaisinToast provides several customization options to tailor the appearance and behavior of the toast:
- backgroundColor: Sets the background color of the toast.
- textColor: Sets the text color of the toast.
- cornerRadius: Sets the corner radius of the toast.
- animationDuration: Sets the duration (in seconds) of the show/hide animations.
Use these properties to create visually appealing toasts that fit your app’s design.
API Documentation
Below is an overview of the RaisinToast API:
Method | Description | Parameters |
---|---|---|
show() |
Show a toast with a specified message. | message : The text to be displayed on the toast. |
show(duration: TimeInterval) |
Show a toast for a specific duration. | duration : The duration (in seconds) for the toast to be displayed. |
For a complete list of methods and properties, please refer to the official RaisinToast documentation.
Example
Here’s an example of how to use RaisinToast to show a simple toast message:
let toast = RaisinToast()
toast.show(message: "Hello, RaisinToast!")
Feel free to customize the toast appearance and behavior according to your project’s needs.
Troubleshooting
If you encounter any issues while using RaisinToast, try the following steps:
- Make sure you have installed the latest version of RaisinToast.
- Double-check that you have imported the RaisinToast framework correctly.
- Review your code and ensure that you are using the RaisinToast API correctly.
- If the problem persists, seek help from the RaisinToast community or contact the project maintainers.