Creating customizable and animated tooltips in UIKit🍏
Import the Library ToolTipKit
.
import ToolTipKit
To create a tooltip, use the ToolTipView class
- The tooltip supports the following directions:
.top
: Tooltip appears above the source view..bottom
: Tooltip appears below the source view..left
: Tooltip appears to the left of the source view..right
: Tooltip appears to the right of the source view.
lazy var tooltip = ToolTipView(
title: "This is a tooltip!",
type: .top,
sourceItem: yourSourceView, // Attach to your target UIView
)
- Show the Tooltip
tooltip.show()
- Hide the Tooltip
tooltip.hide()
- Show Tooltip with Timeout
tooltip.showWithTimeout(duration: 3) // Tooltip disappears after 3 seconds
- Customize the colors using the following properties
tooltip.baseBackgroundColor = .blue
tooltip.baseForegroundColor = .yellow
- In Xcode, go to File > Add Packages.
- Enter the repository URL: https://github.com/your-repo/ToolTipKit.git.
- Choose the version or branch you want to integrate.
ToolTipKit is released under the MIT License. Feel free to use it in your projects!
See the LICENSE file for more info