I am having login, register, table view, collection view, map view controller. In all these controller classes I am having separate myphp api url
. My base URL is "Http://some url"
. And in my all view controller i am calling like this ""Http://some url/login.php", "Http://some url/register/php"
. Likewise I am calling each URL in all view controller.Instead of that, it is possible to create one class and make all URL there. And calling the name of URL like, login.php or login
, likewise in all my view controller??
If possible can any one suggest me some code example,so that it will very help full.
I am using swift 2.0
Yes, Make a New File Which should be inherited from NSObject..
Like common.h and common.m
And Store all your URL's in common class shown in the image as MACRO in .h file
WhenEver using the URL's just add this common class to your view controller and use it .