FrameAccessorSwift 3.0.1

FrameAccessorSwift 3.0.1

TestsTested
LangLanguage SwiftSwift
License MIT
ReleasedLast Release Feb 2017
SwiftSwift Version 3.0
SPMSupports SPM

Maintained by Cœur.



  • By
  • AlexDenisov, holgersindbaek, noxt and Cœur

FrameAccessor

Easy way to access view’s frame in iOS and macOS.

Compatibility

  • iOS 8.0 or higher
  • OSX 10.9 or higher

Example Usage

import FrameAccessor
view.x = 15.0
view.width = 167.0

instead of

view.frame.origin.x = 15.0
view.frame.size.width = 167.0

Available Properties

UIView/NSView properties:

Property Type Аvailability
viewOrigin CGPoint readwrite
viewSize CGSize readwrite
x, y CGFloat readwrite
width, height CGFloat readwrite
top, left, bottom, right CGFloat readwrite
centerX, centerY CGFloat readwrite
middlePoint CGPoint readonly
middleX, middleY CGFloat readonly

Note: the names of @viewOrigin and @viewSize properties are prefixed with view to not create conflicts with Apple’s private internals (As discussed in #7).

UIScrollView properties:

Property Type Аvailability
contentOffsetX, contentOffsetY CGFloat readwrite
contentSizeWidth, contentSizeHeight CGFloat readwrite
contentInsetTop, contentInsetLeft,
contentInsetBottom, contentInsetRight
CGFloat readwrite

License

FrameAccessor is available under the MIT license.

See LICENSE file