Skip to content

Instantly share code, notes, and snippets.

View fmaxx's full-sized avatar

Maxim Firsov fmaxx

View GitHub Profile
@fmaxx
fmaxx / UIView.swift
Last active October 5, 2018 05:59
UIView, shadow
// dropsahdow
extension UIView{
func dropShadow(shadowColor: UIColor = UIColor.black,
fillColor: UIColor = UIColor.white,
opacity: Float = 0.2,
offset: CGSize = CGSize(width: 0.0, height: 1.0),
radius: CGFloat = 10) -> CAShapeLayer {
let shadowLayer = CAShapeLayer()
shadowLayer.path = UIBezierPath(roundedRect: self.bounds, cornerRadius: radius).cgPath
@fmaxx
fmaxx / Date.swift
Created October 5, 2018 06:45
Date, utilities
extension Date {
public func toLabel(pattern: String = "HH:mm dd-MM-yy", locale: Locale = .current, abbreviation: String = "GMT") -> String {
let dateFormatter = DateFormatter()
dateFormatter.timeZone = TimeZone(abbreviation: abbreviation)
dateFormatter.locale = locale
dateFormatter.dateFormat = pattern
return dateFormatter.string(from: self)
}
}