//
//  UIViewController+Ext.swift
//  NewsApp
//
//  Created by Samat on 19.07.2020.
//  Copyright © 2020 somfish. All rights reserved.
//

import UIKit
import SafariServices

extension UIViewController {
    
    func presentAlertOnMainThread(title: String, message: String, buttonTitle: String) {
        DispatchQueue.main.async {
            let alertVC = AlertVC(title: title, message: message, buttonTitle: buttonTitle)
            alertVC.modalPresentationStyle  = .overFullScreen
            alertVC.modalTransitionStyle    = .crossDissolve
            self.present(alertVC, animated: true)
        }
    }
    
    
    func presentSafariVC(with url: URL) {
        let safariVC = SFSafariViewController(url: url)
        safariVC.preferredControlTintColor = Colors.accent
        present(safariVC, animated: true)
    }
}
