vds_ios/VDS/Components/Tooltip/TooltipLaunchable.swift
Matt Bruce 123831adf6 refactored tooltip away from contentText & contentView to child: Any? and children: View
Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
2023-07-25 10:13:16 -05:00

30 lines
868 B
Swift

//
// ToolTipLaunchable.swift
// VDS
//
// Created by Matt Bruce on 4/14/23.
//
import Foundation
import UIKit
public protocol TooltipLaunchable {
func presentTooltip(tooltip: TooltipModel)
}
extension TooltipLaunchable {
public func presentTooltip(tooltip: TooltipModel) {
if let presenting = UIApplication.topViewController() {
let tooltipViewController = TooltipAlertViewController(nibName: nil, bundle: nil).with {
$0.surface = tooltip.surface
$0.titleText = tooltip.title
$0.child = tooltip.child
$0.closeButtonText = tooltip.closeButtonText
$0.modalPresentationStyle = .overCurrentContext
$0.modalTransitionStyle = .crossDissolve
}
presenting.present(tooltipViewController, animated: true)
}
}
}