vds_ios/VDS/Components/Tooltip/TooltipLaunchable.swift
Matt Bruce 1bed04dae0 added presenter
Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
2023-07-31 10:13:37 -05:00

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