I see that "é" ("\u{E9}", 1 code point), and "e" + acute ("\u{65}\u{301}", 2 code points) are equal, which is great.
The documentation of == for Character is inherited from Equatable and does not explain its rules. On the other hand, I have looked around Annex #29 without luck. Does Swift implement its own logic?
In either case, how is character equality determined in Swift?
Since
Swiftis an open-source language, you can check the implementation of built-in methods on GitHub.You can find the equality operator of
Characterhere.As you can see, internally,
Charactercan be initialised from aStringand the==operator forCharacteruses that internalStringproperty to compare twoCharacters.You can find the implementation of
==forStringin StringComparable.swift