I have a class called SQLHelper.swift
where I have all the methods for fetching records from database, adding records to database and so on.
Then I have another class called Constants.swift
where I have some alert messages defined and my API endpoints.
And I call my API’s like so from my viewcontroller…
APIHelper(API: WebServices.getAllData as NSString, json: bodyStr as NSString, methodType: Constants.Get_Method as NSString).PostApiResultSet2(callback: {( errMsg: String,arr11: AnyObject?) -> Void in.....
The WebServices.getAllSchedSmats
shown above is from the Constants.swift
class that I just mentioned.
There is another class called APIHelper.swift
where I have PostApiResultSet2
function which calls the API and returns the response to my view controller
And from my view controller, I access the function from the SQLHelper.swift
class whenever I want to perform any db related operations and when I want to make an API call, I access the APIHelper.swift
class.
My doubt is I’m not sure which is the architecture I’m using here...