Introduction
Welcome to the official documentation for the MVFeedbackBanner library, which is designed to provide a customizable feedback banner for iOS applications.
Features
- Easily prompt users for feedback within your iOS app.
- Customizable UI elements and appearance to match your app’s design.
- Flexible configuration options to control when and how the feedback banner is displayed.
- Seamless integration with popular email and rating services.
Requirements
To use MVFeedbackBanner in your iOS project, make sure you meet the following requirements:
- iOS 10.0 or later
- Xcode 12.0 or later
- Swift 5.0 or later
Installation
To install MVFeedbackBanner in your project, you have several options:
Option 1: Using CocoaPods
1. Open your Terminal and navigate to the root directory of your Xcode project file.
2. Add the following line to your Podfile:
pod 'MVFeedbackBanner'
3. Run pod install
command in the Terminal.
4. Use the newly created .xcworkspace
file to open your project in Xcode.
Option 2: Manual Installation
1. Download the latest release of MVFeedbackBanner from the GitHub repository.
2. Unzip the downloaded file and navigate to the directory containing the source files.
3. Drag and drop the MVFeedbackBanner.swift
file into your Xcode project.
4. Ensure that the file is added to your app’s target.
Usage
To use MVFeedbackBanner in your project, follow these steps:
1. Import MVFeedbackBanner in the relevant source file:
import MVFeedbackBanner
2. Create an instance of MVFeedbackBanner and configure its properties:
let feedbackBanner = MVFeedbackBanner()
feedbackBanner.title = "Leave Feedback"
feedbackBanner.message = "We would love to hear your thoughts on our app!"
feedbackBanner.positiveActionTitle = "Leave Feedback"
feedbackBanner.positiveActionURL = URL(string: "your-email-service.com")
feedbackBanner.negativeActionTitle = "Not Now"
feedbackBanner.negativeActionBlock = {
// Implement custom behavior if user chooses not to leave feedback
}
3. Optionally, customize the UI appearance using the provided properties.
4. Trigger the feedback banner to display at the appropriate time:
feedbackBanner.show()
Customization
MVFeedbackBanner offers various customization options to tailor the appearance and behavior to match your app’s requirements. The following properties can be used:
- title: The title of the feedback banner.
- message: The main message or prompt.
- positiveActionTitle: The title for the positive action button.
- positiveActionURL: The URL to handle the positive action (e.g., email service or app rating).
- negativeActionTitle: The title for the negative action button.
- negativeActionBlock: Custom block of code to execute when the negative action button is tapped.
- backgroundColor: The background color of the feedback banner.
- textColor: The color of the text within the feedback banner.
- font: The font to be used for the text within the feedback banner.
- cornerRadius: The corner radius for the feedback banner’s edges.
Examples
// Example 1: Customizing feedback banner appearance
feedbackBanner.backgroundColor = .darkGray
feedbackBanner.textColor = .white
feedbackBanner.font = UIFont.systemFont(ofSize: 16)
feedbackBanner.cornerRadius = 8
// Example 2: Customizing negative action behavior
feedbackBanner.negativeActionBlock = {
// Show a different view instead of dismissing the banner
}
Conclusion
Congratulations! You have successfully learned how to integrate and customize MVFeedbackBanner in your iOS app. You can now prompt users for feedback and enhance their app experience based on their feedback. For more details, please refer to the official GitHub repository.