This file contains hidden or 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
/// Generic Property Intializer | |
/// - Parameters: | |
/// - value: Instance of Class | |
/// - closure: closure of property setters | |
/// - Returns: instance of passed class | |
static func configure<T>(_ value: T, using closure: (inout T) throws -> Void) rethrows -> T { | |
var value = value | |
try closure(&value) | |
return value | |
} |
This file contains hidden or 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 MobileCoreServices | |
import Foundation | |
import UIKit | |
struct GeneralUtility{ | |
public static var appDelegate : AppDelegate{ | |
get{ | |
return UIApplication.shared.delegate as! AppDelegate | |
} |
This file contains hidden or 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 | |
class OffsetLabel: UILabel { | |
@IBInspectable var inset:CGSize = CGSize(width: 0, height: 0) | |
var padding: UIEdgeInsets { | |
var hasText:Bool = false | |
if let t = self.text?.count, t > 0 { | |
hasText = true |
This file contains hidden or 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 | |
protocol ImagePickerDelegate { | |
func imagePicked(image: UIImage) | |
} | |
class ImagePicker: NSObject { | |
let presentingVC: UIViewController | |
var delegate: ImagePickerDelegate? |
This file contains hidden or 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 Foundation | |
import UIKit | |
extension UIDevice{ | |
var deviceModel : DeviceFamily{ | |
switch UIScreen.main.nativeBounds.height { | |
case 960: | |
return .iPhone_4 |
This file contains hidden or 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 UIView{ | |
//MARK:- Frame Properties | |
var originPoint : CGPoint{ | |
return self.frame.origin | |
} | |
var originX : CGFloat{ | |
return self.frame.origin.x | |
} |