1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- //
- // KMCommonDefine.swift
- // PDF Master
- //
- // Created by tangchao on 2023/3/28.
- //
- import Foundation
- /* KMCommonDefine [共用的定义]
- ** 用于定义一些共用的函数、共用的通知名称、其他
- */
- // MARK: - 共用的函数
- public func KMPrint(_ items: Any..., separator: String = " ", terminator: String = "\n") {
- #if DEBUG
- print(items, separator: separator, terminator: terminator)
- #endif
- }
- public func km_synchronized<T>(_ lock: AnyObject, _ body: () throws -> T) rethrows -> T {
- objc_sync_enter(lock)
- defer { objc_sync_exit(lock) }
- return try body()
- }
- // MARK: - 共用的通知名称
- // MARK: - 共用的Block
- typealias KMItemClickBlock<T> = (_ item: T?, _ index: Int)->()
- typealias KMCommonClickBlock = (_ index: Int, _ params: Any...)->()
- typealias KMCommonBlock = (_ params: Any...)->()
- typealias KMEmptyBlock = ()->Void
- typealias KMValueDidChangeBlock = (_ value: Any?, _ change: [NSKeyValueChangeKey : Any]?)->()
- typealias KMResultBlock = (_ result: KMResult?, _ params: Any...)->Void
- // MARK: - 其他
- let kKMLocalForDraggedTypes = NSPasteboard.PasteboardType(rawValue: "KMLocalForDraggedTypes")
- let kKMMainMenuAccountRefreshItemTag = 16
|