//
|
// Def.swift
|
// BrokerDriver
|
//
|
// Created by 无故事王国 on 2023/4/24.
|
//
|
|
import Foundation
|
import UIKit
|
import MBProgressHUD
|
@_exported import JQTools
|
@_exported import QMUIKit
|
@_exported import HandyJSON
|
@_exported import RxSwift
|
|
|
// MARK: -- Shorthand
|
let app = UIApplication.shared.delegate as! AppDelegate
|
|
var screnDelegate:SceneDelegate? = {
|
var uiScreen:UIScene?
|
UIApplication.shared.connectedScenes.forEach { scenes in
|
uiScreen = scenes
|
}
|
return (uiScreen?.delegate as? SceneDelegate)
|
}()
|
|
var topSafeHeight:Double{
|
return JQ_currentNavigationController().navigationBar.frame.height + UIApplication.shared.statusBarFrame.height
|
}
|
|
|
let notiCenter = NotificationCenter.default
|
|
func LogSuccess(_ items:Any...,separator:String=" ",file:String=#file,function:String=#function,line:Int=#line){
|
#if DEBUG
|
let file = (file as NSString).lastPathComponent.split(separator: ".").first!;
|
print("✅✅✅ SUCCESS: \(file) \(function) [Line: \(line)]: \(items)",separator);
|
#endif
|
}
|
|
func LogError(_ items:Any...,separator:String=" ",file:String=#file,function:String=#function,line:Int=#line){
|
#if DEBUG
|
let file = (file as NSString).lastPathComponent.split(separator: ".").first!;
|
print("❌❌❌ ERROR: \(file) \(function) [Line: \(line)]: \(items)",separator);
|
#endif
|
}
|
|
func LogInfo(_ items:Any...,separator:String=" ",file:String=#file,function:String=#function,line:Int=#line){
|
#if DEBUG
|
let file = (file as NSString).lastPathComponent.split(separator: ".").first!;
|
print("⚠️⚠️⚠️INFO: \(file) \(function) [Line: \(line)]: \(items)",separator);
|
#endif
|
}
|
|
|
// MARK: -- Front
|
let Def_NavFont:UIFont = UIFont.systemFont(ofSize: 19, weight: .bold)
|
|
|
// MARK: -- Color
|
let Def_NavFontColor:UIColor = .color(light: .color("#333333"), dark: .color("#333333"))
|
let Def_backgroundColor:UIColor = .color(light: .white, dark: .white)
|
let Def_ThemeColor:UIColor = .color(light: .color("#FED703"), dark: .color("#FED703"))
|
|
|
//提示框
|
func alert(msg: String) {
|
let hud = MBProgressHUD.showAdded(to: screnDelegate!.window!, animated: true)
|
hud.mode = .text
|
hud.label.text = msg
|
// hud.backgroundColor = UIColor.RGBA(r: 228, g: 228, b: 228, a: 1)
|
hud.label.textColor = UIColor(hexString: "#343434")
|
hud.label.numberOfLines = 0
|
hud.label.font = UIFont.boldSystemFont(ofSize: 14)
|
hud.hide(animated: true, afterDelay: 1.7)
|
}
|
|
|
//extension UICollectionView{
|
// public func jq_setEmptyView( _ noticeStr:String? = nil,image:UIImage? = UIImage(named: "icon_empty"),foregroundColor:UIColor = UIColor.gray,clouse:((EmptyDataSetView)->Void)? = nil) {
|
// self.emptyDataSetView { (emptyDataSetView) in
|
// emptyDataSetView.titleLabelString(NSAttributedString.init(string: (noticeStr != nil) ? noticeStr! : Localized("暂无数据"), attributes: [.font:UIFont.systemFont(ofSize: 16,weight: .medium), .foregroundColor:foregroundColor as Any]))
|
// .image(image)
|
// .dataSetBackgroundColor(UIColor.white)
|
// .verticalOffset(-50)
|
// .verticalSpace(0)
|
// .shouldDisplay(true)
|
// .shouldFadeIn(true)
|
// .isTouchAllowed(true)
|
// .isScrollAllowed(true)
|
// .didTapContentView {
|
//
|
// }
|
// clouse?(emptyDataSetView)
|
// }
|
// }
|
//}
|