i want to create functionality like interface in swift, my goal is when i call another class suppose i'm calling API and the response of that class i want to reflect in to my current screen, in android interface is used to achieve but what should i use in swift for that? can anyone help me with example. the code for android is given below...
public class ExecuteServerReq {
public GetResponse getResponse = null;
public void somemethod() {
getResponse.onResponse(Response);
}
public interface GetResponse {
void onResponse(String objects);
}
}
ExecuteServerReq executeServerReq = new ExecuteServerReq();
executeServerReq.getResponse = new ExecuteServerReq.GetResponse() {
@Override
public void onResponse(String objects) {
}
}