Skip to content

Instantly share code, notes, and snippets.

View mudasir093's full-sized avatar

Mudasir Syed mudasir093

  • karachi Pakistan
View GitHub Profile
@mudasir093
mudasir093 / UICollectionViewExtension.swift
Created October 16, 2019 14:58
Extension for displaying Message on Empty data
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;
@mudasir093
mudasir093 / UINavigationBarExtension.swift
Created October 16, 2019 14:54
Remove shadow Of UINavigationBar
extension UINavigationBar {
//Extension for Removing Shadow of UINavigationBar
func shouldRemoveShadow(_ value: Bool) -> Void {
if value {
self.setValue(true, forKey: "hidesShadow")
} else {
self.setValue(false, forKey: "hidesShadow")
}
}
@mudasir093
mudasir093 / UsefulStringExtensions.swift
Created October 16, 2019 14:51
Useful Sting Extensions
//Useful String Extension
//By Mudasir Syed
extension String {
// Extension for string length of String
var length: Int {
return self.count
}
@mudasir093
mudasir093 / DoubleAndDecimalExtensions.swift
Created October 16, 2019 14:50
Double and Decimal Extensions
#Useful Decimal Extension
extension Decimal {
//#Extension for Decimal to Double Conversion
var doubleValue:Double {
return NSDecimalNumber(decimal:self).doubleValue
}
}
@mudasir093
mudasir093 / UIViewBorderExtension.swift
Created October 16, 2019 14:49
UIView Border Extension
//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)