This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// Created by Muhammad Ashir Mubeen on 13/07/2022. | |
// | |
#if os(iOS) || os(tvOS) | |
import UIKit | |
#elseif os(OSX) | |
import AppKit | |
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import UIKit | |
enum AppStoryboard : String{ | |
case Main = "Main" | |
case PreLogin = "Payment" | |
var instance : UIStoryboard { | |
return UIStoryboard(name: self.rawValue, bundle: Bundle.main) | |
} | |
func viewController<T>(vc : T.Type) -> T where T: UIViewController{ | |
let identifier = String(describing: T.self) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extension UIFont { | |
/** | |
Will return the best font conforming to the descriptor which will fit in the provided bounds. | |
*/ | |
static func bestFittingFontSize(for text: String, in bounds: CGRect, fontDescriptor: UIFontDescriptor, additionalAttributes: [NSAttributedStringKey: Any]? = nil) -> CGFloat { | |
let constrainingDimension = min(bounds.width, bounds.height) | |
let properBounds = CGRect(origin: .zero, size: bounds.size) | |
var attributes = additionalAttributes ?? [:] | |