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 UICollectionView { | |
// Extension for displaying Message on Empty data | |
func setEmptyMessage(_ message: String) { | |
let messageLabel = UILabel(frame: CGRect(x: 0, y: 0, width: self.bounds.size.width, height: self.bounds.size.height)) | |
messageLabel.text = message | |
messageLabel.textColor = .black | |
messageLabel.numberOfLines = 0; | |
messageLabel.textAlignment = .center; |
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
//Useful String Extension | |
//By Mudasir Syed | |
extension String { | |
// Extension for string length of String | |
var length: Int { | |
return self.count | |
} |
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
#Useful Decimal Extension | |
extension Decimal { | |
//#Extension for Decimal to Double Conversion | |
var doubleValue:Double { | |
return NSDecimalNumber(decimal:self).doubleValue | |
} | |
} | |
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 for add border in view | |
extension UIView { | |
// Extension for Top Border | |
func addTopBorderWithColor(color: UIColor, width: CGFloat) { | |
let border = CALayer() | |
border.backgroundColor = color.cgColor | |
border.frame = CGRect(x: 0, y: 0, width: self.frame.size.width, height: width) | |
self.layer.addSublayer(border) |