SwiftFrameGadget is a very small view extension. It provides you a more elegant way to use frame layout.
SwiftFrameGadget
provide some anchor to make the layout easier.
top
bottom
left
right
centerX
centerY
width
height
Without SwiftFrameGadget
, If you want to set a view next to another view, you may write code like this:
// viewA, viewB
let x = viewA.frame.origin.x + viewA.frame.width + 5
viewB.frame = CGRect(x: x, y: viewA.frame.origin.y, width: viewB.frame.width, viewB.frame.height)
With SwiftFrameGadget
, you can write more grace code like this:
// viewA, viewB
viewB.left = viewA.right + 5
viewB.top = viewA.top
To run the example project, clone the repo, and run pod install
from the Example directory first.
None
SwiftFrameGadget is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod 'SwiftFrameGadget'
limchihi, limchihi@foxmail.com
SwiftFrameGadget is available under the MIT license. See the LICENSE file for more info.