Skip to content
/ Brief Public

Easy access to UIView & CALayer's layout properties in Swift.

License

Notifications You must be signed in to change notification settings

kakajika/Brief

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Brief

CocoaPods compatible

Easy access to UIView & CALayer's layout written in Swift (Inspired from FrameAccessor).

Install

Cocoapods

$ pod 'Brief'

Manually

Just add Brief.swift or Brief-OSX.swift into your project.

Usage

// Before
view.frame.origin.x = 20.0
view.frame.size.width = 200.0
view.frame.origin.y = 100.0 - view.frame.size.height // Make view's bottom to 100.0

// After 
view.x = 20.0
view.width = 200.0
view.bottom = 100.0

Supported Properties

UIView/NSView properties:

Property Type Аvailability
x, y CGFloat get/set
width, height CGFloat get/set
top, left, bottom, right CGFloat get/set
boundsWidth, boundsHeight CGFloat get/set
boundsTop, boundsLeft, boundsBottom, boundsRight CGFloat get/set

CALayer properties:

Property Type Аvailability
x, y CGFloat get/set
width, height CGFloat get/set
top, left, bottom, right CGFloat get/set
boundsWidth, boundsHeight CGFloat get/set
boundsTop, boundsLeft, boundsBottom, boundsRight CGFloat get/set

Deprecated

Following properties are useless in Swift and removed.

UIView

  • frameOrigin, frameSize
  • centerX, centerY
  • middlePoint, middleX, middleY

UIScrollView

  • All properties

CALayer

  • frameOrigin, frameSize
  • anchorX, anchorY
  • positionX, positionY

License

Apache 2.0 License

About

Easy access to UIView & CALayer's layout properties in Swift.

Resources

License

Stars

Watchers

Forks

Packages

No packages published