Step 1: IBDesignable for custom UITextField & UITextView
This is an additional part which isn’t related to padding. If you don’t need to know about this subject, simply jump to step 2.
Step 2: Padding of UITextField & UITextView
1. UITextField Padding
Line 5: Change to whatever padding you like.
Line 12, 16, 21: Override textRect, placeholderRect, editingRect to the padding you’ve implemented.
2. UITextView Padding
Line 4: Set textContainerInset to UIEdgeInsets you need.
Have fun with Swift! Feel free to ask any question :)