BubbleSpot is a lightweight library for creating tooltips in iOS development using UIKit. It allows developers to easily add informative tooltips to their app's user interface, enhancing user experience and providing helpful hints.
![Screenshoot](https://private-user-images.githubusercontent.com/47731450/318457662-f80e4a2a-4a15-4204-8b73-48276faf8577.gif?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTk3NDU3MjYsIm5iZiI6MTcxOTc0NTQyNiwicGF0aCI6Ii80NzczMTQ1MC8zMTg0NTc2NjItZjgwZTRhMmEtNGExNS00MjA0LThiNzMtNDgyNzZmYWY4NTc3LmdpZj9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA2MzAlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNjMwVDExMDM0NlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTU3MTMxMzU1OGUzMmI1ZWQ5Y2ZmYjBmZTFkZDAxZjEzMDYwMGJiOThiMTMyNjU0ZWM4YzBjYTU3NWM3YmUyZmYmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.GxfVSujJrL98fYwY9lxali0NvfEepnEjSvAERBP7iww)
- Easily create customizable tooltips for iOS apps.
- Support for positioning tooltips relative to target views.
- Customizable text, background color, arrow color, and more.
- Simple API for showing and dismissing tooltips.
BubbleSpot can be easily integrated into your iOS project using Swift Package Manager.
- In Xcode, select "File" > "Swift Packages" > "Add Package Dependency..."
- Enter the BubbleSpot GitHub repository URL:
https://github.com/agustiyann/BubbleSpot.git
- Follow the prompts to complete the installation.
To use BubbleSpot in your project, follow these simple steps:
- Import the BubbleSpot module wherever you plan to use it:
import BubbleSpot
- Create a BubbleSpot instance with the target view, tooltip text, and bubble position:
let bubble = BubbleSpot(targetView: targetView, text: "Your tooltip text here", bubblePosition: .top)
- Customize the tooltip appearance (optional):
bubble.backgroundColor = .black
bubble.textColor = .white
bubble.arrowColor = .black
- Show the tooltip:
bubble.show()
- Dismiss the tooltip (optional):
bubble.dismiss()
Here's a simple example demonstrating how to use BubbleSpot:
import UIKit
import BubbleSpot
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
// Create a target view
let button = UIButton(type: .system)
button.setTitle("Tap me", for: .normal)
button.addTarget(self, action: #selector(buttonTapped), for: .touchUpInside)
button.translatesAutoresizingMaskIntoConstraints = false
view.addSubview(button)
// Add constraints for the button
NSLayoutConstraint.activate([
button.centerXAnchor.constraint(equalTo: view.centerXAnchor),
button.centerYAnchor.constraint(equalTo: view.centerYAnchor)
])
}
@objc func buttonTapped() {
// Create and show a tooltip
let bubble = BubbleSpot(targetView: view, text: "This is a tooltip", bubblePosition: .top)
bubble.show()
}
}
Contributions to BubbleSpot are welcome! If you find any issues or have suggestions for improvements, feel free to open an issue or submit a pull request.
BubbleSpot is available under the MIT license. See the LICENSE file for more information.