This has to do with how the String type works in Swift, and how the contains(_:) method works.

The โ€˜๐Ÿ‘ฉโ€๐Ÿ‘ฉโ€๐Ÿ‘งโ€๐Ÿ‘ฆ โ€˜ is whatโ€™s known as an emoji sequence, which is rendered as one visible character in a string. The sequence is made up of Character objects, and at the same time it is made up of UnicodeScalar objects.

If you check the character count of the string, youโ€™ll see that it is made up of four characters, while if you check the unicode scalar count, it will show youโ€ฆ

--

--

Mr.Javed Multani

Software Engineer | Certified ScrumMasterยฎ (CSM) | UX Researcher | Youtuber | Tech Writer