How to add UITextField, UITextView and UILabel programmatically in swift 4.0

In iOS app development, sometime we need to add Textfields, textviews, labels etc programmatically. It gives you control over customizing styles, size and position of them. I’m going to place codes (swift Language) here so that you can get all of them from one place.
Following codes will work in any view controller
UITextField:
TextView:
Label:

 

2 thoughts on “How to add UITextField, UITextView and UILabel programmatically in swift 4.0”

Leave a Reply