TestsTested | ✓ |
LangLanguage | SwiftSwift |
License | MIT |
ReleasedLast Release | Dec 2016 |
SwiftSwift Version | 3.0 |
SPMSupports SPM | ✗ |
Maintained by Tuomas Artman.
Geometry is a UIView and CGRect extension that lets you work with view and rect geometry easier. It adds the following properties to UIView:
And it lets you define CGRectangles and CGPoints as strings.
To use Signals with a project targeting iOS 7, copy Geometry.swift
into your project.
myView.frame = CGRect(x: 10, y: 10, width: 20, height: 20)
myView.left = 20 // Frame is now {{20, 10}, {20, 20}}
myView.width = 100 // Frame is now {{20, 10}, {100, 20}}
myView.right = 150 // Frame is now {{50, 10}, {100, 20}}
This extension also provides StringLiteralConverters for both CGRect and CGPoint, so you can use Strings to initialize a CGRect:
myView.frame = "10, 10, 20, 20"
myView.center = "50, 50"
var rect: CGRect = "20, 25, 100, 100"
To contribute, just fork, branch & send a pull request. To get in touch, hit me up on Twitter @artman
Geometry is released under an MIT license. See the LICENSE file for more information