add some method
This commit is contained in:
23
ios/Classes/Util/Any+Extension.swift
Normal file
23
ios/Classes/Util/Any+Extension.swift
Normal file
@@ -0,0 +1,23 @@
|
||||
//
|
||||
// Any+Extension.swift
|
||||
// flutter_openim_sdk
|
||||
//
|
||||
// Created by willem on 2021/10/9.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
public func typeName(_ obj: Any) -> String {
|
||||
if obj is AnyClass {
|
||||
return "\(obj)"
|
||||
}
|
||||
return "\(type(of: obj))"
|
||||
}
|
||||
|
||||
public func safeMainAsync(_ work: @escaping @convention(block) () -> Void) {
|
||||
if Thread.isMainThread {
|
||||
work()
|
||||
} else {
|
||||
DispatchQueue.main.async(execute: work)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user