Fixed spacing/style issues
This commit is contained in:
parent
6dbdf9fdcc
commit
f2f1e911a7
|
@ -144,7 +144,7 @@ extension Array where Element: Equatable {
|
|||
for (i, value) in values.enumerate() {
|
||||
// the intersection is computed by intersecting a couple per loop:
|
||||
// self n values[0], (self n values[0]) n values[1], ...
|
||||
if (i > 0) {
|
||||
if i > 0 {
|
||||
result = intersection
|
||||
intersection = Array()
|
||||
}
|
||||
|
@ -199,7 +199,7 @@ extension Array where Element: Equatable {
|
|||
}
|
||||
|
||||
public func ==<T: Equatable>(lhs: [T]?, rhs: [T]?) -> Bool {
|
||||
switch (lhs,rhs) {
|
||||
switch (lhs, rhs) {
|
||||
case (.Some(let lhs), .Some(let rhs)):
|
||||
return lhs == rhs
|
||||
case (.None, .None):
|
||||
|
|
|
@ -51,12 +51,12 @@ public struct ez {
|
|||
}
|
||||
|
||||
/// EZSwiftExtensions
|
||||
public static var horizontalSizeClass : UIUserInterfaceSizeClass {
|
||||
public static var horizontalSizeClass: UIUserInterfaceSizeClass {
|
||||
return self.topMostVC?.traitCollection.horizontalSizeClass ?? UIUserInterfaceSizeClass(rawValue: 0)!
|
||||
}
|
||||
|
||||
/// EZSwiftExtensions
|
||||
public static var verticalSizeClass : UIUserInterfaceSizeClass {
|
||||
public static var verticalSizeClass: UIUserInterfaceSizeClass {
|
||||
return self.topMostVC?.traitCollection.verticalSizeClass ?? UIUserInterfaceSizeClass(rawValue: 0)!
|
||||
}
|
||||
|
||||
|
@ -148,11 +148,11 @@ public struct ez {
|
|||
/// EZSE: Downloads JSON from url string
|
||||
public static func requestJSON(url: String, success: (AnyObject? -> Void), error: ((NSError) -> Void)?) {
|
||||
requestURL(url,
|
||||
success: { (data)->Void in
|
||||
success: { (data) -> Void in
|
||||
let json: AnyObject? = self.dataToJsonDict(data)
|
||||
success(json)
|
||||
},
|
||||
error: { (err)->Void in
|
||||
error: { (err) -> Void in
|
||||
if let e = error {
|
||||
e(err)
|
||||
}
|
||||
|
|
|
@ -9,10 +9,10 @@ import UIKit
|
|||
|
||||
extension Int {
|
||||
/// EZSE: Checks if the integer is even.
|
||||
public var isEven: Bool { return (self % 2 == 0) }
|
||||
public var isEven: Bool { return (self % 2 == 0) }
|
||||
|
||||
/// EZSE: Checks if the integer is odd.
|
||||
public var isOdd: Bool { return (self % 2 != 0) }
|
||||
public var isOdd: Bool { return (self % 2 != 0) }
|
||||
|
||||
/// EZSE: Checks if the integer is positive.
|
||||
public var isPositive: Bool { return (self > 0) }
|
||||
|
@ -24,7 +24,7 @@ extension Int {
|
|||
public var toDouble: Double { return Double(self) }
|
||||
|
||||
/// EZSE: Converts integer value to Float.
|
||||
public var toFloat: Float { return Float(self) }
|
||||
public var toFloat: Float { return Float(self) }
|
||||
|
||||
/// EZSE: Converts integer value to CGFloat.
|
||||
public var toCGFloat: CGFloat { return CGFloat(self) }
|
||||
|
|
|
@ -95,14 +95,14 @@ extension NSDate {
|
|||
|
||||
extension NSDate: Comparable {}
|
||||
/// EZSE: Returns if dates are equal to each other
|
||||
public func ==(lhs: NSDate, rhs: NSDate) -> Bool {
|
||||
public func == (lhs: NSDate, rhs: NSDate) -> Bool {
|
||||
return lhs.isEqualToDate(rhs)
|
||||
}
|
||||
/// EZSE: Returns if one date is smaller than the other
|
||||
public func <(lhs: NSDate, rhs: NSDate) -> Bool {
|
||||
public func < (lhs: NSDate, rhs: NSDate) -> Bool {
|
||||
return lhs.compare(rhs) == .OrderedAscending
|
||||
}
|
||||
|
||||
public func >(lhs: NSDate, rhs: NSDate) -> Bool {
|
||||
public func > (lhs: NSDate, rhs: NSDate) -> Bool {
|
||||
return lhs.compare(rhs) == .OrderedDescending
|
||||
}
|
||||
|
|
|
@ -28,7 +28,7 @@ extension String {
|
|||
}
|
||||
|
||||
/// EZSE: Counts number of instances of the input inside String
|
||||
public func count(substring: String) -> Int{
|
||||
public func count(substring: String) -> Int {
|
||||
return componentsSeparatedByString(substring).count - 1
|
||||
}
|
||||
|
||||
|
@ -73,7 +73,7 @@ extension String {
|
|||
|
||||
/// EZSE: Extracts URLS from String
|
||||
public var extractURLs: [NSURL] {
|
||||
var urls : [NSURL] = []
|
||||
var urls: [NSURL] = []
|
||||
let detector: NSDataDetector?
|
||||
do {
|
||||
detector = try NSDataDetector(types: NSTextCheckingType.Link.rawValue)
|
||||
|
|
|
@ -40,19 +40,19 @@ extension UIViewController {
|
|||
}
|
||||
|
||||
public func removeKeyboardWillShowNotification() {
|
||||
self.removeNotificationObserver(UIKeyboardWillShowNotification);
|
||||
self.removeNotificationObserver(UIKeyboardWillShowNotification)
|
||||
}
|
||||
|
||||
public func removeKeyboardDidShowNotification() {
|
||||
self.removeNotificationObserver(UIKeyboardDidShowNotification);
|
||||
self.removeNotificationObserver(UIKeyboardDidShowNotification)
|
||||
}
|
||||
|
||||
public func removeKeyboardWillHideNotification() {
|
||||
self.removeNotificationObserver(UIKeyboardWillHideNotification);
|
||||
self.removeNotificationObserver(UIKeyboardWillHideNotification)
|
||||
}
|
||||
|
||||
public func removeKeyboardDidHideNotification() {
|
||||
self.removeNotificationObserver(UIKeyboardDidHideNotification);
|
||||
self.removeNotificationObserver(UIKeyboardDidHideNotification)
|
||||
}
|
||||
|
||||
public func keyboardDidShowNotification(notification: NSNotification) {
|
||||
|
@ -226,7 +226,7 @@ extension UIViewController {
|
|||
}
|
||||
|
||||
/// EZSwiftExtensions
|
||||
public func addAsChildViewController(vc: UIViewController, toView: UIView){
|
||||
public func addAsChildViewController(vc: UIViewController, toView: UIView) {
|
||||
toView.addSubview(vc.view)
|
||||
self.addChildViewController(vc)
|
||||
vc.didMoveToParentViewController(self)
|
||||
|
|
|
@ -415,7 +415,7 @@ extension UIView {
|
|||
}
|
||||
|
||||
/// EZSwiftExtensions
|
||||
public func animate(animations animations: (()->Void), completion: ((Bool) -> Void)? = nil) {
|
||||
public func animate(animations animations: (() -> Void), completion: ((Bool) -> Void)? = nil) {
|
||||
animate(duration: UIViewAnimationDuration, animations: animations, completion: completion)
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue