Skip to content

Commit

Permalink
Fixed lint warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
Esqarrouth committed Dec 24, 2016
1 parent 8ff8405 commit 58c5e40
Show file tree
Hide file tree
Showing 9 changed files with 32 additions and 32 deletions.
2 changes: 1 addition & 1 deletion Sources/CGFloatExtensions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
6 changes: 3 additions & 3 deletions Sources/CGPointExtensions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion Sources/CharacterExtensions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ extension Character {
return s[s.startIndex]
}
}

/// EZSE: Convert the character to uppercase
public var uppercased: Character {
get {
Expand Down
26 changes: 13 additions & 13 deletions Sources/DateExtensions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -118,43 +118,43 @@ 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()
format.dateFormat = "yyyy-MM-dd"
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()
format.dateFormat = "yyyy-MM-dd"
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()
Expand All @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions Sources/DictionaryExtensions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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()) {
Expand Down
2 changes: 1 addition & 1 deletion Sources/NSDictionaryExtensions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import Foundation

public extension NSDictionary {

//MARK: - Deprecated 1.8

/// EZSE: Unserialize JSON string into NSDictionary
Expand Down
4 changes: 2 additions & 2 deletions Sources/UIFontExtensions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
8 changes: 4 additions & 4 deletions Sources/UIImageViewExtensions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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) {
Expand All @@ -96,7 +96,7 @@ extension UIImageView {
}

//MARK: Deprecated 1.8

/// EZSwiftExtensions
@available(*, deprecated: 1.8, renamed: "image(url:)")
public func imageWithUrl(url: String) {
Expand Down
10 changes: 5 additions & 5 deletions Sources/UIViewExtensions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 58c5e40

Please sign in to comment.