当前位置: 首页 > 工具软件 > Masu-Swift > 使用案例 >

swift 类似macro

尉迟鸿熙
2023-12-01


swift 中类似宏定义使用


//

//  WFCommon.swift

//  Swift_02



import Foundation

import UIKit



//MARK:-------------------------------------------------------------------------

// 系统版本

public let DeviceSystemVersion:String = UIDevice.currentDevice().systemVersion

public let IsDeviceVersionIOS6:Bool = Float(UIDevice.currentDevice().systemVersion)<7.0

public let IsDeviceVersionIOS7:Bool = Float(UIDevice.currentDevice().systemVersion)>=7.0

public let IsDeviceVersionIOS8:Bool = Float(UIDevice.currentDevice().systemVersion)>=8.0

public let IsDeviceVersionIOS9:Bool = Float(UIDevice.currentDevice().systemVersion)>=9.0

public let IsDeviceVersionIOS10:Bool = Float(UIDevice.currentDevice().systemVersion)>=10.0


//public let ContentViewOffsetY:Float = IsDeviceVersionIOS7 ? 64.0 : 0.0


// 尺寸

public let SCREEN_WIDTH = UIScreen.mainScreen().bounds.size.width

public let SCREEN_HEIGHT = UIScreen.mainScreen().bounds.size.height



// 设备名称

public let iPhone6P:Bool = (UIScreen.instancesRespondToSelector(Selector("currentMode")) ? CGSizeEqualToSize(CGSizeMake(1242, 2208), (UIScreen.mainScreen().currentMode?.size)!) : false)

public let iPhone6:Bool = (UIScreen.instancesRespondToSelector(Selector("currentMode")) ? CGSizeEqualToSize(CGSizeMake(750, 1334), (UIScreen.mainScreen().currentMode?.size)!) : false)

public let iPhone5:Bool = (UIScreen.instancesRespondToSelector(Selector("currentMode")) ? CGSizeEqualToSize(CGSizeMake(640, 1136), (UIScreen.mainScreen().currentMode?.size)!) : false)


public let isPad:Bool = (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiom.Pad)


// 是否高清屏

public let isDeviceRetina: Bool = UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiom.Pad ? (UIScreen.instancesRespondToSelector(Selector("currentMode")) ? CGSizeEqualToSize(CGSizeMake(1536, 2048), (UIScreen.mainScreen().currentMode?.size)!) : false) : (UIScreen.instancesRespondToSelector(Selector("currentMode")) ? UIScreen.mainScreen().currentMode?.size.width > 320 : false)



//MARK:-------------------------------------------------------------------------

// 主题色

public let TITLE_TEXTCOLOR = UIColor.init(red: 36/255.0, green: 38/255.0, blue: 40/255.0, alpha: 1.0)

public let DESC_TEXTCOLOR = UIColor.init(red: 138/255.0, green: 142/255.0, blue: 150/255.0, alpha: 1.0)

public let NAV_BAR_COLOR_1 = UIColor(red: 60/255.0, green: 68/255.0, blue: 94/255.0, alpha: 1.0)

public let NAV_BAR_COLOR_2 = UIColor(red: 255/255.0, green: 255/255.0, blue: 255/255.0, alpha: 1.0)






//MARK:-------------------------------------------------------------------------

// 友盟APPKey

public let UM_APPKey = (isPad ? "aa" : "ss")

public let UM_WXAppId = ""

public let UM_WXAppKey = ""

public let UM_QQAppId = ""

public let UM_QQAppKey = ""

public let UM_SinaAppId = ""

public let UM_SinaAppKey = ""

public let UM_FaveBookAppId = ""

public let UM_TwitterAppId = ""

public let UM_TwitterAppKey = ""


// 高德地图key - 正式环境

public let GD_APPKEY_STORE = ""

// 高德地图key - 测试环境

public let GD_APPKEY_TEST = ""


// 百度应用APIKey

public let BD_APIKEY = ""


// Bugtags APIKey

public let Bugtags_APIKEY = ""





 类似资料: