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 | |
// MARK:- General Protocols | |
protocol ViewProtocol: class{ | |
func showError(message: String) | |
func showLoading() | |
func hideLoading() | |
func refreshView() | |
} |
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 ViewController: AVAssetResourceLoaderDelegate{ | |
func resourceLoader(_ resourceLoader: AVAssetResourceLoader, shouldWaitForRenewalOfRequestedResource renewalRequest: AVAssetResourceRenewalRequest) -> Bool { | |
return self.resourceLoader(resourceLoader, shouldWaitForLoadingOfRequestedResource: renewalRequest) | |
} | |
func resourceLoader(_ resourceLoader: AVAssetResourceLoader, shouldWaitForLoadingOfRequestedResource loadingRequest: AVAssetResourceLoadingRequest) -> Bool { | |
guard let url = loadingRequest.request.url else { | |
print("🔑", #function, "Unable to read the url/host data.") | |
loadingRequest.finishLoading(with: NSError(domain: "com.icapps.error", code: -1, userInfo: nil)) |
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
class ViewController: UIViewController { | |
@IBOutlet weak var txtFieldDemo: UITextField! { | |
didSet{ | |
txtFieldDemo.delegate = self | |
txtFieldDemo.addTarget(self, action: #selector(textFieldDidChange(textField:)), for: .editingChanged) | |
} | |
} | |
} |
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 UITextField { | |
func underlined(){ | |
let border = CALayer() | |
let width = CGFloat(2.0) | |
if let widthOfText = self.attributedText?.size().width{ | |
border.borderColor = UIColor.primaryColor.cgColor | |
border.frame = CGRect(x: self.frame.size.width - widthOfText, y: self.frame.size.height - width, width: widthOfText, height: self.frame.size.height) | |
border.borderWidth = width | |
self.layer.addSublayer(border) |