Detect if a user has typed an emoji character in UITextView

前端 未结 9 1699
醉话见心
醉话见心 2020-12-05 08:13

I have a UITextView and I need to detect if a user enters an emoji character.

I would think that just checking the unicode value of the newest character would suffic

9条回答
  •  甜味超标
    2020-12-05 09:09

    Swift's String type has a property .isEmoji

    Best to check the documentation for the isEmojiPresentation caveat

    https://developer.apple.com/documentation/swift/unicode/scalar/properties/3081577-isemoji

提交回复
热议问题