IPH Technologies
Software & App Development company
Select Page


The full name of OOPs is Objected Oriented programming Language. OOPs is very important concept, on which almost all modern programming language stands.
SWIFT, APPLE’s trending language is no different from this. OOPs concepts are the backbone of SWIFT.
Let’s come to the topic which we will cover up in OOPs.
. Classes
. Objects
. Methods
. Access Control
. Encapsulation
. Abstraction
. Inheritance
. Polymorphism

Let’s see each topic one by one:-

classes are the blueprints of the objects.
(2) classes are combination of data members and functions.
(3) classes are not a real-world entity that’s why it does not occupy memory.



iOS Example:

UIView, the iOS’s main UI class, can be considered a class.


Object is instance of  class.
(2) Object is a real-world entity that’s why it occupy memory.
(3) E.g, Dog, Cat, Pen, Pencil, etc, everything is an object. From our Person example, men and women are examples of objects which belong to the same class i.e Person.


iOS Example:

When we create an outlet of UITableView, then we create an object of UITableView class.

Methods or Functions are the behaviour of the objects of a class. Let us say a person can walk, sing, play, etc irrespective of any object(Man/Woman). These all can be said to be methods/functions of the class.

Coding Syntax:
Methods syntax


iOS Example:

UIView class has many methods. Eg. “setNeedsLayout()”, which we call if we want to forcefully reset our UI layout.

Access Control:
Swift provides quite many handy access control levels which are really helpful while writing our code. Some of the access levels provided SWIFT:


Encapsulation is a concept by which we hide data and methods from outside intervention and usage.

Coding Example:

What we did here:

In the above example, we encapsulated the variable “result” by using the access specifier “private”. We hide the data of variable “result” from any outside intervention and usage.

Abstraction is hiding the details or internal implementation, it’s highlight a set of service that we are offering.
ATM Machine, Electric circuit.

Inheritance is defined as a process by which you inherit the properties of your parent. Technically, Inheritance is a process by which a child class inherits the properties of its parent class.

Coding Example:

What we did here:

iOS Example:

UIButton class inherits from UIView thus is able to access its properties like backgroundColor, frame, etc.

Polymorphism is combination of two words first is “poly” means many and second is “morph” means form. So Polymorphism describe us, A thing or object have many form is called Polymorphism.

Example:- A Person.

Finally we can say Objected Oriented Programming is the powerful and backbone of any programming language. And very useful to solve very big problem. I hope you will like this. 😊