32 lines
1.1 KiB
Swift
32 lines
1.1 KiB
Swift
//
|
|
// ToolTipLaunchable.swift
|
|
// VDS
|
|
//
|
|
// Created by Matt Bruce on 4/14/23.
|
|
//
|
|
|
|
import Foundation
|
|
import UIKit
|
|
|
|
public protocol TooltipLaunchable {
|
|
func presentTooltip(surface: Surface, title: String?, content: String?, contentView: UIView?, closeButtonText: String, presenter: UIView?)
|
|
}
|
|
|
|
extension TooltipLaunchable {
|
|
public func presentTooltip(surface: Surface, title: String?, content: String?, contentView: UIView? = nil, closeButtonText: String = "Close", presenter: UIView? = nil) {
|
|
if let presenting = UIApplication.topViewController() {
|
|
let tooltipViewController = TooltipAlertViewController(nibName: nil, bundle: nil).with {
|
|
$0.surface = surface
|
|
$0.titleText = title
|
|
$0.contentText = content
|
|
$0.contentView = contentView
|
|
$0.closeButtonText = closeButtonText
|
|
$0.presenter = presenter
|
|
$0.modalPresentationStyle = .overCurrentContext
|
|
$0.modalTransitionStyle = .crossDissolve
|
|
}
|
|
presenting.present(tooltipViewController, animated: true)
|
|
}
|
|
}
|
|
}
|