I'm learning Swift at the moment and came across "protocols". They seem to me like a prebuild class that you extend, like in typescript, is that true? Thanks, Pascal
CodePudding user response:
I would compare them to interface
in typescript.
interface FooBar {
foo: () => void
bar: () => void
}
class MyFooBar implements FooBar {
public foo(): void {
...
}
public bar(): void {
...
}
}