Check out example codes for "how to add button dynamically in swift 4". It will help you in understanding the concepts better.

Code Example 1

let button = UIButton(x:0; y:0, width: 80, height: 30)

Learn ReactJs, React Native from akashmittal.com