Search code examples
c#swiftasp.net-coregenericsiequalitycomparer

C#'s IEqualityComparer<TType> similar or alternative in Swift Language


I'm new in swift programming language and my background was .NET Development, I wonder is there any protocol (interface) or abstract class similar to C#'s IEqualityComparer in swift language?

Note: I'm trying to developing SDK (I already had written it in C# and trying to converting into Swift) that has an interface that you can use it with in generic type. Interface has a method that using IEqualityComparer.

Best regards.


Solution

  • That would be Equatable protocol:

    https://developer.apple.com/documentation/swift/equatable