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 String{ | |
var length : Int { | |
return self.count | |
} | |
func replace(target: String, withString: String) -> String { | |
return self.replacingOccurrences(of: target, with: withString) | |
} |
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 | |
import Foundation | |
public class AlertService { | |
private init() {} | |
public static let shared = AlertService() | |
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 RoundImage: UIImageView { | |
@IBInspectable var cornerRadius:CGFloat = 0{ | |
didSet{ | |
self.layer.cornerRadius = cornerRadius | |
} | |
} |
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 | |
@IBDesignable class CardView: UIView { | |
@IBInspectable var cornerradius:CGFloat = 4 | |
@IBInspectable var shadowOffsetWidth:CGFloat = 0 | |
@IBInspectable var shadowOffsetHeight:CGFloat = 3 | |
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
// String Extensions to encode/decode to Base64, capitalized first character..... | |
extension String{ | |
// Decode String from Base64 | |
func fromBase64() -> String? { | |
guard let data = Data(base64Encoded: self) else { | |
return nil | |
} | |
return String(data: data, encoding: .utf8) |
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 Alamofire | |
class Connectivity { | |
class var isConnectedToInternet: Bool { | |
return NetworkReachabilityManager()!.isReachable | |
} | |
} |
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 | |
import AVFoundation | |
class ScanQRCodeViewController: UIViewController, AVCaptureMetadataOutputObjectsDelegate { | |
var videoPreviewLayer: AVCaptureVideoPreviewLayer! | |
var captureSession: AVCaptureSession! | |
@IBOutlet weak var viewPreview: UIView! | |
override func viewDidLoad() { |
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
func showActionSheet(title:String?, | |
titleColor: UIColor = UIColor.black, | |
message: String?, | |
messageColor: UIColor = UIColor.gray, | |
backgroundColor: UIColor = UIColor.white){ | |
guard let message = message else { return } | |
let alert = UIAlertController(title: nil, message: nil, preferredStyle: .actionSheet) |
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 { | |
func displayToast(_ message : String) { | |
guard let delegate = UIApplication.shared.delegate as? AppDelegate, let window = delegate.window else { | |
return | |
} | |
if let toast = window.subviews.first(where: { $0 is UILabel && $0.tag == -1001 }) { | |
toast.removeFromSuperview() |