I’m working on a design issue for my iOS app regarding protocols. Now I understand the usage, and when a protocol is required, and I also understand that they are analogous to interfaces in C# and Java.
Can you call methods through the protocol itself? For example, in C# I can do the following:
public interface IInterface
{
void SomeMethod();
void SomeOtherMethod();
}
public class AClass : IInterface
{
public void SomeMethod()
{
//Do something
}
public void SomeOtherMethod()
{
//Do something
}
}
public class Program
{
public void Main()
{
IInterface i = new AClass();
i.SomeMethod();
}
}
Is this possible in Objective-C or am I trying to force a .NET style approach into iOS?
In some other place