Swiftpack.co - mark-kebo/FlexiTooltipView as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by mark-kebo.
mark-kebo/FlexiTooltipView 1.0.2
Package for custom tooltips in your application
⭐️ 6
🕓 46 weeks ago
.package(url: "https://github.com/mark-kebo/FlexiTooltipView.git", from: "1.0.2")

Flexi Tooltip View

Swift Version Issues Forks Stars License

Package for custom tooltips in your application

Example 1 Example 2 Example 3 Example 4 Example 5

Installing

Flexi Tooltip View support Swift Package Manager.

Swift Package Manager

// swift-tools-version:5.1

import PackageDescription

let package = Package(
  name: "YourTestProject",
  platforms: [
       .iOS(.v12),
  ],
  dependencies: [
    .package(name: "FlexiTooltipView", url: "https://github.com/mark-kebo/FlexiTooltipView", from: "1.0.0")
  ],
  targets: [
    .target(name: "YourTestProject", dependencies: ["FlexiTooltipView"])
  ]
)

And then import wherever needed: import FlexiTooltipView

Adding it to an existent iOS Project via Swift Package Manager

  1. Using Xcode 11 go to File > Swift Packages > Add Package Dependency
  2. Paste the project URL: https://github.com/mark-kebo/FlexiTooltipView
  3. Click on next and select the project target
  4. Don't forget to set DEAD_CODE_STRIPPING = NO in your Build Settings (https://bugs.swift.org/plugins/servlet/mobile#issue/SR-11564)

If you have doubts, please, check the following links:

How to use

Creating Swift Packages

After successfully retrieved the package and added it to your project, just import FlexiTooltipView and you can get the full benefits of it.

Usage example

Setup configuration and show tooltip controller:

import FlexiTooltipView

let tooltipItems: [FlexiTooltipItemProtocol] = [
                    FlexiTooltipImageItem(image: UIImage(named: "test-image"), 
                                          imageSize: CGSize(width: 64, height: 64)),
                    FlexiTooltipTextItem(text: attributtedTitle(text: "Test", weight: .light), 
                                         image: UIImage(named: "test-image")),
                    FlexiTooltipActionsItem(firstAction: FlexiTooltipActionItem(title: attributtedTitle(text: "cancel", weight: .regular),
                                                                                backgroundColor: .systemYellow,
                                                                                completion: { [weak self] in
                                                                                    //Some action
                                                                                }),
                                            secondAction: nil,
                                            alignment: .trailing)
]
var config = FlexiTooltipConfiguration()
config.arrowHeight = 16
config.isNeedShadow = true
config.isTooltipClosable = true
config.topAction = FlexiTooltipActionItem(title: attributtedTitle(text: "Close", weight: .regular),
                                          backgroundColor: .gray) { [weak self] in
    //Some top action
}
config.highlightedViews = [button1, button]
let controller = FlexiTooltipViewController(params: FlexiTooltipParams(tooltipItems: tooltipItems,
                                                                       pointingView: button,
                                                                       configuration: config))
controller.present(in: navigationController)

Important

You must to set pointingView or pointing viewRect in FlexiTooltipParams. This is exactly the view to which the tooltip will be attached. Also if you need highlight some views, you can use highlightedViews in FlexiTooltipConfiguration.

GitHub

link
Stars: 6
Last commit: 46 weeks ago
Advertisement: IndiePitcher.com - Cold Email Software for Startups

Release Notes

Pods support
46 weeks ago

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics