Skip to content

Instantly share code, notes, and snippets.

@behrank
Created November 12, 2019 19:45
Show Gist options
  • Save behrank/5d3b3990a7c10d0a502fd3d649346125 to your computer and use it in GitHub Desktop.
Save behrank/5d3b3990a7c10d0a502fd3d649346125 to your computer and use it in GitHub Desktop.
import UIKit
import RacoonKit
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
//How to add subviews.
let firstView = UIView()
let secondView = UIView()
let thirdView = UIView()
let fourthView = UIView()
view.addSubviews(views: firstView, secondView, thirdView, fourthView)
//How to set margins to either self and other UIView subclasses
firstView.setMargins(RacoonDimension.top(value: 8), RacoonDimension.left(value: 8), RacoonDimension.right(value: 8), RacoonDimension.bottom(value: 8))
firstView.setMarginTo(view: secondView, of: RacoonDimension.top(value: 12))
//How to set dimensions
firstView.setHeight(100)
firstView.setWidth(125)
firstView.setWidthEqualToSuperview()
firstView.setHeightEqualToSuperview()
firstView.setWidthEqualTo(view: fourthView)
firstView.setHeightEqualTo(view: secondView)
firstView.setWidthEqualTo(views: secondView, thirdView, fourthView)
firstView.setHeightEqualTo(views: secondView, thirdView, fourthView)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment