-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSampleCode.swift
33 lines (23 loc) · 964 Bytes
/
SampleCode.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
//
// SampleCode.swift
// CustomLayout
//
// Created by Malith Kamburapola on 2022-01-16.
//
import UIKit
import CustomLayout
//this is for testing some new functionality
class TestViewController: UIViewController {
let redView = UIView().chain.bgColor(.red).component
let greenView = UIView().chain.bgColor(.green).component
override func viewDidLoad() {
super.viewDidLoad()
//Add as subviews
view.addSubview(redView)
view.addSubview(greenView)
//layout using custom layout
redView.layout.activate([.leading(constant: 20), .top(constant: 10, safeAreaAlign: true), .equalWidth(multiplier: 0.5), .height(constant: 50)])
greenView.layout.activate(to: [view : [.bottom(constant: -2, safeAreaAlign: true), .traling(constant: -20)],
redView : [.leadingToTraling(constant: -10), .topToBottom(constant: 20)]])
}
}