Rename to rossler\\attix
This commit is contained in:
32
App/Utilities/CGPoint+Utils.swift
Normal file
32
App/Utilities/CGPoint+Utils.swift
Normal file
@@ -0,0 +1,32 @@
|
||||
//
|
||||
// CGPoint+Utils.swift
|
||||
// SBrowser
|
||||
//
|
||||
// Created by James Magahern on 7/23/20.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
extension CGRect
|
||||
{
|
||||
var center: CGPoint {
|
||||
get {
|
||||
return CGPoint(x: size.width / 2.0, y: size.height / 2.0)
|
||||
}
|
||||
}
|
||||
|
||||
public func avoiding(verticalInsets insets: UIEdgeInsets) -> CGRect {
|
||||
var rect = self
|
||||
rect.origin.y += insets.top
|
||||
rect.size.height -= insets.top
|
||||
|
||||
return rect
|
||||
}
|
||||
|
||||
public func centeredY(inRect: CGRect) -> CGRect {
|
||||
var rect = self
|
||||
rect.origin.y = CGRound((inRect.height - rect.height) / 2.0)
|
||||
|
||||
return rect
|
||||
}
|
||||
}
|
||||
24
App/Utilities/UIEdgeInsets+Layout.swift
Normal file
24
App/Utilities/UIEdgeInsets+Layout.swift
Normal file
@@ -0,0 +1,24 @@
|
||||
//
|
||||
// UIEdgeInsets+Layout.swift
|
||||
// SBrowser
|
||||
//
|
||||
// Created by James Magahern on 7/23/20.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
|
||||
extension UIEdgeInsets
|
||||
{
|
||||
var negative: UIEdgeInsets {
|
||||
get {
|
||||
return UIEdgeInsets(top: -top, left: -left, bottom: -bottom, right: -right)
|
||||
}
|
||||
}
|
||||
|
||||
func subtracting(_ other: UIEdgeInsets) -> UIEdgeInsets {
|
||||
return UIEdgeInsets(top: self.top - other.top,
|
||||
left: self.left - other.left,
|
||||
bottom: self.bottom - other.bottom,
|
||||
right: self.right - other.right)
|
||||
}
|
||||
}
|
||||
16
App/Utilities/UIGestureRecognizer+Actions.swift
Normal file
16
App/Utilities/UIGestureRecognizer+Actions.swift
Normal file
@@ -0,0 +1,16 @@
|
||||
//
|
||||
// UIGestureRecognizer+Actions.swift
|
||||
// SBrowser
|
||||
//
|
||||
// Created by James Magahern on 7/31/20.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
|
||||
extension UIGestureRecognizer
|
||||
{
|
||||
convenience init(action: UIAction) {
|
||||
self.init(target: action, action: NSSelectorFromString("_performActionWithSender:"))
|
||||
objc_setAssociatedObject(self, "associatedUIAction", action, .OBJC_ASSOCIATION_RETAIN)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user