A UIView frame tool that uses chain calls。
Uncomfortable code:
self.view.frame.origin = CGPoint(x: 100.0, y: self.view.frame.origin.y)
In addition, different library extensions to the frame will lead to some naming conflicts.
If you use FrameKit, your frame settings will become::
self.view.lpd.x = 100.0
You can use it directly for your project, or as a dependent library for your personal library.
pod 'FrameKit'
let _ = self.view.fkit.x
self.view.fkit.x = 0.0
let _ = self.view.fkit.right
self.view.fkit.right = 300.0
let _ = self.view.fkit.bottom
self.view.fkit.bottom = 300.0
let _ = self.view.fkit.centerX
self.view.fkit.centerX = 100.0
extension UIView {
public var fkit: FrameKit.UIViewExtension { get }
}
get
set
均可
public var y: CGFloat
public var width: CGFloat
public var height: CGFloat
public var size: CGSize
public var centerX: CGFloat
public var centerY: CGFloat
public var top: CGFloat
public var bottom: CGFloat
public var left: CGFloat
public var right: CGFloat
FrameKit 使用 MIT License
If there are any suggestions, pleas send an email to [email protected], and also welcome to my blog to discuss. Learning together~