50 lines
1.5 KiB
Swift
50 lines
1.5 KiB
Swift
//
|
|
// UIEdgeInset.swift
|
|
// VDS
|
|
//
|
|
// Created by Matt Bruce on 9/5/23.
|
|
//
|
|
|
|
import Foundation
|
|
import UIKit
|
|
|
|
extension UIEdgeInsets {
|
|
|
|
public static func uniform(_ value: CGFloat) -> UIEdgeInsets {
|
|
return UIEdgeInsets(top: value, left: value, bottom: value, right: value)
|
|
}
|
|
|
|
public static func top(_ value: CGFloat) -> UIEdgeInsets {
|
|
return UIEdgeInsets(top: value, left: 0, bottom: 0, right: 0)
|
|
}
|
|
|
|
public static func left(_ value: CGFloat) -> UIEdgeInsets {
|
|
return UIEdgeInsets(top: 0, left: value, bottom: 0, right: 0)
|
|
}
|
|
|
|
public static func bottom(_ value: CGFloat) -> UIEdgeInsets {
|
|
return UIEdgeInsets(top: 0, left: 0, bottom: value, right: 0)
|
|
}
|
|
|
|
public static func right(_ value: CGFloat) -> UIEdgeInsets {
|
|
return UIEdgeInsets(top: 0, left: 0, bottom: 0, right: value)
|
|
}
|
|
|
|
public static func horizontal(_ value: CGFloat) -> UIEdgeInsets {
|
|
return UIEdgeInsets(top: 0, left: value, bottom: 0, right: value)
|
|
}
|
|
|
|
public static func vertical(_ value: CGFloat) -> UIEdgeInsets {
|
|
return UIEdgeInsets(top: value, left: 0, bottom: value, right: 0)
|
|
}
|
|
|
|
public static func axis(horizontal: CGFloat, vertical: CGFloat) -> UIEdgeInsets {
|
|
return UIEdgeInsets(top: vertical, left: horizontal, bottom: vertical, right: horizontal)
|
|
}
|
|
|
|
}
|
|
|
|
public func + (lhs: UIEdgeInsets, rhs: UIEdgeInsets) -> UIEdgeInsets {
|
|
return .init(top: lhs.top + rhs.top, left: lhs.left + rhs.left, bottom: lhs.bottom + rhs.bottom, right: lhs.right + rhs.right)
|
|
}
|