28 lines
534 B
Swift
28 lines
534 B
Swift
|
//
|
||
|
// MLEmoji.swift
|
||
|
// monalxmpp
|
||
|
//
|
||
|
// Created by Anurodh Pokharel on 3/29/21.
|
||
|
// Copyright © 2021 Monal.im. All rights reserved.
|
||
|
//
|
||
|
|
||
|
import Foundation
|
||
|
|
||
|
@objcMembers
|
||
|
public class MLEmoji: NSObject
|
||
|
{
|
||
|
public static func containsEmoji(text:String) -> Bool
|
||
|
{
|
||
|
for scalar in text.unicodeScalars
|
||
|
{
|
||
|
let isEmoji = scalar.properties.isEmoji && scalar.properties.isEmojiPresentation
|
||
|
|
||
|
if(!isEmoji)
|
||
|
{
|
||
|
return false
|
||
|
}
|
||
|
}
|
||
|
return true
|
||
|
}
|
||
|
}
|