Rename to rossler\\attix

This commit is contained in:
James Magahern
2020-07-31 17:35:03 -07:00
parent 030c1db45c
commit c723b3de88
30 changed files with 25 additions and 207 deletions

View 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
}
}

View 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)
}
}

View 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)
}
}