mahesh kolagatla
mahesh kolagatla

Reputation: 83

How to take reference of viewcontroller in NSObject class in swift?

My requirement is I declared a function in NSObject class I want to use that function in one firstviewcontroller suppose if I want to use that function in secondviewcontroller again firstviewcontroller will call how I can divide those two viewcontrollers in NSObject class can any one tell me?

Upvotes: 0

Views: 550

Answers (1)

abrar ul haq
abrar ul haq

Reputation: 404

You can implement same function in both viewcontrollers with the implementation of protocol. And you can get reference of one viewcontroller in other view controller by using class level method which will return instance of that view controller.

Upvotes: 1

Related Questions