As you know that UIView objects can be created through two different ways one is that you create it programmatically through code && second is just you drag and drop one from object library provided by Xcode for your comfort which saves you from write code. Here is one major difference that you should know while you create UIView objects, and the difference is as follows:
When you create any UIView object programmatically the you will be using an initializer function named as "init(frame :)". In this function you define some of the properties corresponding to how your object will look like. Here is an example of creating UILabel by using init(frame :) i.e. programmatically creating UIView object:
init(frame: CGRect) {
super.init(frame: frame)
var label = UILabel(frame: CGRect(x: 20, y: 30, width: 50, height: 30))
label.backgroundColor = UIcolor.greenColor()
label.title = "first Label"
}
This code demonstrate the way how you create your UIView object programatically. Now lets see through the way what happen when you drag && drop any UIView object from object library--> When you do that (drag and drop objects) your object get serialized, archived in other sense. Here serialized objects means that these objects are being converted into array of bytes. To be more generic Your interface builder file is archive of object. When you compile your project your interface builder file get de-serialized means unachieved the serialized data converted into objects with the connections you connected to them.Interface builder is an object compiler. When data is unachieved a function named "init(coder :)" , the coder parameter contains an object that has all the properties that object needs including its frames && boundaries