Create a delegate in Swift
import Foundation
protocol SessionsDelegate: class {
    
    func onSessionsReceived()
    func onSessionsError(code:Int,msg:String)
}
/*
class ViewController: UIViewController, SessionsDelegate
{
    func onSessionsReceived()
    {
      //code
    }
    
    func onSessionsError(code:Int,msg:String)
    {
      //code
    }
}
*/