Skip to content

Extensions for UIKit objects for easier access of frame properties. Also useful extensions of CGPoint, CGSize, CGRect and UIEdgeInsets.

License

Notifications You must be signed in to change notification settings

materik/cocoapod-dimension

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Extensions for UIKit objects for easier access of frame properties. Also useful extensions of CGPoint, CGSize, CGRect and UIEdgeInsets.

Install

pod 'Dimension'

Swift (Default)

pod 'Dimension/Swift'

Objective-C

pod 'Dimension/ObjC'

API Documentation

Swift

CGPoint

init(squared: CGFloat)
init(x: CGFloat)
init(y: CGFloat)
init(size: CGSize)

func *(scalar: CGFloat, pnt: CGPoint) -> CGPoint
func +(pnt1: CGPoint, pnt2: CGPoint) -> CGPoint
func -(pnt1: CGPoint, pnt2: CGPoint) -> CGPoint
func +(pnt: CGPoint, size: CGSize) -> CGPoint
func -(pnt: CGPoint, size: CGSize) -> CGPoint

CGRect

var x: CGFloat { get set }
var y: CGFloat { get set }
var w: CGFloat { get set }
var h: CGFloat { get set }
var top: CGFloat { get set }
var right: CGFloat { get set }
var bottom: CGFloat { get set }
var left: CGFloat { get set }
var center: CGPoint { get set }

init(origin: CGPoint)
init(size: CGSize)
init(x: CGFloat)
init(y: CGFloat)
init(w: CGFloat)
init(h: CGFloat)
init(width: CGFloat)
init(height: CGFloat)
init(x: CGFloat, y: CGFloat)
init(x: CGFloat, y: CGFloat, size: CGSize)
init(x: CGFloat, size: CGSize)
init(y: CGFloat, size: CGSize)
init(w: CGFloat, h: CGFloat)
init(width: CGFloat, height: CGFloat)
init(origin: CGPoint, width: CGFloat, height: CGFloat)
init(origin: CGPoint, w: CGFloat, h: CGFloat)

CGSize

var w: CGFloat { get set }
var h: CGFloat { get set }
var center: CGPoint { get }

init(squared: CGFloat)
init(w: CGFloat)
init(h: CGFloat)
init(w: CGFloat, h: CGFloat)
init(width: CGFloat)
init(height: CGFloat)

func *(scalar: CGFloat, size: CGSize) -> CGSize
func +(size1: CGSize, size2: CGSize) -> CGSize
func -(size1: CGSize, size2: CGSize) -> CGSize

UIEdgeInsets

init(squared: CGFloat)
init(top: CGFloat)
init(left: CGFloat)
init(bottom: CGFloat)
init(right: CGFloat)
init(top: CGFloat, left: CGFloat)
init(top: CGFloat, bottom: CGFloat)
init(top: CGFloat, right: CGFloat)
init(left: CGFloat, bottom: CGFloat)
init(left: CGFloat, right: CGFloat)
init(bottom: CGFloat, right: CGFloat)
init(top: CGFloat, left: CGFloat, bottom: CGFloat)
init(top: CGFloat, left: CGFloat, right: CGFloat)
init(top: CGFloat, bottom: CGFloat, right: CGFloat)
init(left: CGFloat, bottom: CGFloat, right: CGFloat)
init(horizontal: CGFloat, vertical: CGFloat)
init(horizontal: CGFloat)
init(horizontal: CGFloat, top: CGFloat, bottom: CGFloat)
init(horizontal: CGFloat, top: CGFloat)
init(horizontal: CGFloat, bottom: CGFloat)
init(vertical: CGFloat)
init(vertical: CGFloat, left: CGFloat, right: CGFloat)
init(vertical: CGFloat, left: CGFloat)
init(vertical: CGFloat, right: CGFloat)

func *(scalar: CGFloat, inset: UIEdgeInsets) -> UIEdgeInsets
func +(inset1: UIEdgeInsets, inset2: UIEdgeInsets) -> UIEdgeInsets
func -(inset1: UIEdgeInsets, inset2: UIEdgeInsets) -> UIEdgeInsets

UIImageView

func setWidth(andKeepImageRatio width: CGFloat)
func setHeight(andKeepImageRatio height: CGFloat)

UILabel

func sizeToFit(width width: CGFloat)
func setLineSpacing(lineSpacing: CGFloat)

UIScreen

var w: CGFloat { get }
var h: CGFloat { get }
var width: CGFloat { get }
var height: CGFloat { get }
var size: CGSize { get }
var center: CGPoint { get }

class var w: CGFloat { get }
class var h: CGFloat { get }
class var width: CGFloat { get }
class var height: CGFloat { get }
class var size: CGSize { get }
class var center: CGPoint { get }

UIView

var x: CGFloat { get set }
var y: CGFloat { get set }
var w: CGFloat { get set }
var h: CGFloat { get set }
var width: CGFloat { get set }
var height: CGFloat { get set }
var top: CGFloat { get set }
var right: CGFloat { get set }
var bottom: CGFloat { get set }
var left: CGFloat { get set }
var origin: CGPoint { get set }
var size: CGSize { get set }

init(origin: CGPoint)
init(size: CGSize)

Objective-C

UILabel

- (void)sizeToFitWidth:(CGFloat)width;

UIImageView

- (void)setWidthAndKeepRatio:(CGFloat)width;
- (void)setHeightAndKeepRatio:(CGFloat)height;

UIScreen

@property(readonly) CGFloat w;
@property(readonly) CGFloat h;
@property(readonly) CGFloat width;
@property(readonly) CGFloat height;
@property(readonly) CGSize size;

+ (CGFloat)w;
+ (CGFloat)h;
+ (CGFloat)width;
+ (CGFloat)height;
+ (CGSize)size;

UIView

@property(assign) CGFloat x;
@property(assign) CGFloat y;
@property(assign) CGFloat w;
@property(assign) CGFloat h;
@property(assign) CGFloat width;
@property(assign) CGFloat height;
@property(assign) CGFloat top;
@property(assign) CGFloat right;
@property(assign) CGFloat bottom;
@property(assign) CGFloat left;
@property(assign) CGPoint origin;
@property(assign) CGSize size;

- (void)centerInView;

About

Extensions for UIKit objects for easier access of frame properties. Also useful extensions of CGPoint, CGSize, CGRect and UIEdgeInsets.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published