Skip to content

BubbleSpot is a lightweight library for creating tooltips in iOS development

License

Notifications You must be signed in to change notification settings

agustiyann/BubbleSpot

Repository files navigation

🗨️ BubbleSpot

Swift 5 iOS 12+ SPM GitHub Actions Workflow Status GitHub

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

Features

  • 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.

Installation

BubbleSpot can be easily integrated into your iOS project using Swift Package Manager.

Swift Package Manager

  1. In Xcode, select "File" > "Swift Packages" > "Add Package Dependency..."
  2. Enter the BubbleSpot GitHub repository URL: https://github.com/agustiyann/BubbleSpot.git
  3. Follow the prompts to complete the installation.

Usage

To use BubbleSpot in your project, follow these simple steps:

  1. Import the BubbleSpot module wherever you plan to use it:
import BubbleSpot
  1. 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)
  1. Customize the tooltip appearance (optional):
bubble.backgroundColor = .black
bubble.textColor = .white
bubble.arrowColor = .black
  1. Show the tooltip:
bubble.show()
  1. Dismiss the tooltip (optional):
bubble.dismiss()

Example

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()
    }
}

Contributing

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.

License

BubbleSpot is available under the MIT license. See the LICENSE file for more information.

About

BubbleSpot is a lightweight library for creating tooltips in iOS development

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published