diff --git a/Sources/CGFloatExtensions.swift b/Sources/CGFloatExtensions.swift index 1e2e619c..dac416a9 100644 --- a/Sources/CGFloatExtensions.swift +++ b/Sources/CGFloatExtensions.swift @@ -66,7 +66,7 @@ extension CGFloat { /** EZSE :Returns the shortest angle between two angles. The result is always between -π and π. - + Inspired from : https://github.com/raywenderlich/SKTUtils/blob/master/SKTUtils/CGFloat%2BExtensions.swift */ public static func shortestAngleInRadians(from first: CGFloat, to second: CGFloat) -> CGFloat { diff --git a/Sources/CGPointExtensions.swift b/Sources/CGPointExtensions.swift index add32a4f..25aa9348 100644 --- a/Sources/CGPointExtensions.swift +++ b/Sources/CGPointExtensions.swift @@ -15,12 +15,12 @@ extension CGPoint { public static func + (this: CGPoint, that: CGPoint) -> CGPoint { return CGPoint(x: this.x + that.x, y: this.y + that.y) } - + /// EZSE: Subtracts two CGPoints. public static func - (left: CGPoint, right: CGPoint) -> CGPoint { return CGPoint(x: left.x - right.x, y: left.y - right.y) } - + /// EZSE: Multiplies a CGPoint with a scalar CGFloat. public static func * (point: CGPoint, scalar: CGFloat) -> CGPoint { return CGPoint(x: point.x * scalar, y: point.y * scalar) @@ -47,7 +47,7 @@ extension CGPoint { public static func dotProduct(this: CGPoint, that: CGPoint) -> CGFloat { return this.x * that.x + this.y * that.y } - + /// EZSE: Performs a linear interpolation between two CGPoint values. /// Inspired by https://github.com/raywenderlich/SKTUtils/blob/master/SKTUtils/CGPoint%2BExtensions.swift public static func linearInterpolation(startPoint: CGPoint, endPoint: CGPoint, interpolationParam: CGFloat) -> CGPoint { diff --git a/Sources/CharacterExtensions.swift b/Sources/CharacterExtensions.swift index 58393681..2f8d15aa 100644 --- a/Sources/CharacterExtensions.swift +++ b/Sources/CharacterExtensions.swift @@ -23,7 +23,7 @@ extension Character { return s[s.startIndex] } } - + /// EZSE: Convert the character to uppercase public var uppercased: Character { get { diff --git a/Sources/DateExtensions.swift b/Sources/DateExtensions.swift index 668cee5b..a82752c2 100644 --- a/Sources/DateExtensions.swift +++ b/Sources/DateExtensions.swift @@ -8,9 +8,9 @@ import UIKit extension Date { - + public static let minutesInAWeek = 24 * 60 * 7 - + /// EZSE: Initializes Date from string and format public init?(fromString string: String, format: String) { let formatter = DateFormatter() @@ -118,7 +118,7 @@ extension Date { format.dateFormat = "yyyy-MM-dd" return format.string(from: self) == format.string(from: Date()) } - + /// EZSE: Check date if it is yesterday public var isYesterday: Bool { let format = DateFormatter() @@ -126,7 +126,7 @@ extension Date { let yesterDay = Calendar.current.date(byAdding: .day, value: -1, to: Date()) return format.string(from: self) == format.string(from: yesterDay!) } - + /// EZSE: Check date if it is tomorrow public var isTomorrow: Bool { let format = DateFormatter() @@ -134,27 +134,27 @@ extension Date { let tomorrow = Calendar.current.date(byAdding: .day, value: 1, to: Date()) return format.string(from: self) == format.string(from: tomorrow!) } - + /// EZSE: Check date if it is within this month. public var isThisMonth: Bool { let today = Date() return self.month == today.month && self.year == today.year } - + public var isThisWeek: Bool { return self.minutesInBetweenDate(Date()) <= Double(Date.minutesInAWeek) } - + // EZSE : Get the year from the date public var year: Int { return NSCalendar.current.component(Calendar.Component.year, from: self) } - + // EZSE : Get the month from the date public var month: Int { return NSCalendar.current.component(Calendar.Component.month, from: self) } - + // EZSE : Get the weekday from the date public var weekday: String { let dateFormatter = DateFormatter() @@ -168,22 +168,22 @@ extension Date { dateFormatter.dateFormat = "MMMM" return dateFormatter.string(from: self) } - + // EZSE : Get the day from the date public var day: Int { return NSCalendar.current.component(Calendar.Component.day, from: self) } - + /// EZSE: Get the hours from date public var hour: Int { return NSCalendar.current.component(Calendar.Component.hour, from: self) } - + /// EZSE: Get the minute from date public var minute: Int { return NSCalendar.current.component(Calendar.Component.minute, from: self) } - + /// EZSE: Get the second from the date public var second: Int { return NSCalendar.current.component(Calendar.Component.second, from: self) diff --git a/Sources/DictionaryExtensions.swift b/Sources/DictionaryExtensions.swift index 2b929b4e..3e47b4c6 100644 --- a/Sources/DictionaryExtensions.swift +++ b/Sources/DictionaryExtensions.swift @@ -124,7 +124,7 @@ extension Dictionary { } return true } - + /// EZSE: Unserialize JSON string into Dictionary public static func constructFromJSON (json: String) -> Dictionary? { if let data = (try? JSONSerialization.jsonObject(with: json.data(using: String.Encoding.utf8, allowLossyConversion: true)!, options: JSONSerialization.ReadingOptions.mutableContainers)) as? Dictionary { @@ -133,7 +133,7 @@ extension Dictionary { return nil } } - + /// EZSE: Serialize Dictionary into JSON string public func formatJSON() -> String? { if let jsonData = try? JSONSerialization.data(withJSONObject: self, options: JSONSerialization.WritingOptions()) { diff --git a/Sources/NSDictionaryExtensions.swift b/Sources/NSDictionaryExtensions.swift index 2be096fb..74127481 100644 --- a/Sources/NSDictionaryExtensions.swift +++ b/Sources/NSDictionaryExtensions.swift @@ -10,7 +10,7 @@ import Foundation public extension NSDictionary { - + //MARK: - Deprecated 1.8 /// EZSE: Unserialize JSON string into NSDictionary diff --git a/Sources/UIFontExtensions.swift b/Sources/UIFontExtensions.swift index 7cc825a2..4b42fc3a 100644 --- a/Sources/UIFontExtensions.swift +++ b/Sources/UIFontExtensions.swift @@ -90,9 +90,9 @@ extension UIFont { public class func AvenirNextRegular(size: CGFloat) -> UIFont { return Font(.AvenirNext, type: .Regular, size: size) } - + //MARK: Deprecated - + /// EZSwiftExtensions @available(*, deprecated: 1.8) public class func PrintFontFamily(_ font: FontName) { diff --git a/Sources/UIImageViewExtensions.swift b/Sources/UIImageViewExtensions.swift index 1eaadbca..2cdaba11 100644 --- a/Sources/UIImageViewExtensions.swift +++ b/Sources/UIImageViewExtensions.swift @@ -68,7 +68,7 @@ extension UIImageView { self.clipsToBounds = true self.layer.cornerRadius = self.frame.size.width / 2 } - + /// EZSE: Initializes an UIImage from URL and adds into current ImageView public func image(url: String) { ez.requestImage(url, success: { (image) -> Void in @@ -79,13 +79,13 @@ extension UIImageView { } }) } - + /// EZSE: Initializes an UIImage from URL and adds into current ImageView with placeholder public func image(url: String, placeholder: UIImage) { self.image = placeholder image(url: url) } - + /// EZSE: Initializes an UIImage from URL and adds into current ImageView with placeholder public func image(url: String, placeholderNamed: String) { if let image = UIImage(named: placeholderNamed) { @@ -96,7 +96,7 @@ extension UIImageView { } //MARK: Deprecated 1.8 - + /// EZSwiftExtensions @available(*, deprecated: 1.8, renamed: "image(url:)") public func imageWithUrl(url: String) { diff --git a/Sources/UIViewExtensions.swift b/Sources/UIViewExtensions.swift index d02191e4..481f523f 100644 --- a/Sources/UIViewExtensions.swift +++ b/Sources/UIViewExtensions.swift @@ -603,21 +603,21 @@ private let UIViewDefaultFadeDuration: TimeInterval = 0.4 extension UIView { ///EZSE: Fade in with duration, delay and completion block. - public func fadeIn(_ duration:TimeInterval? = UIViewDefaultFadeDuration, delay _delay:TimeInterval? = 0.0, completion: ((Bool) -> Void)? = nil) { + public func fadeIn(_ duration: TimeInterval? = UIViewDefaultFadeDuration, delay _delay: TimeInterval? = 0.0, completion: ((Bool) -> Void)? = nil) { UIView.animate(withDuration: duration ?? UIViewDefaultFadeDuration, delay: _delay ?? 0.0, options: UIViewAnimationOptions(rawValue: UInt(0)), animations: { self.alpha = 1.0 }, completion:completion) } - + /// EZSwiftExtensions - public func fadeOut(_ duration:TimeInterval? = UIViewDefaultFadeDuration, delay _delay:TimeInterval? = 0.0, completion:((Bool) -> Void)? = nil) { + public func fadeOut(_ duration: TimeInterval? = UIViewDefaultFadeDuration, delay _delay: TimeInterval? = 0.0, completion: ((Bool) -> Void)? = nil) { UIView.animate(withDuration: duration ?? UIViewDefaultFadeDuration, delay: _delay ?? 0.0, options: UIViewAnimationOptions(rawValue: UInt(0)), animations: { self.alpha = 0.0 }, completion:completion) } - + /// Fade to specific value with duration, delay and completion block. - public func fadeTo(_ value:CGFloat, duration _duration:TimeInterval? = UIViewDefaultFadeDuration, delay _delay:TimeInterval? = 0.0, completion:((Bool) -> Void)? = nil) { + public func fadeTo(_ value: CGFloat, duration _duration: TimeInterval? = UIViewDefaultFadeDuration, delay _delay: TimeInterval? = 0.0, completion: ((Bool) -> Void)? = nil) { UIView.animate(withDuration: _duration ?? UIViewDefaultFadeDuration, delay: _delay ?? UIViewDefaultFadeDuration, options: UIViewAnimationOptions(rawValue: UInt(0)), animations: { self.alpha = value }, completion:completion)