swift 设置oc一样效果的pch文件

添加一个新的文件,选择swift file 创建就可以

设置你要写成公共的方法,如屏幕的宽度,颜色等等



 let screenWidth = UIScreen.main.bounds.size.width

let screenHeight = UIScreen.main.bounds.size.height


let StatusBarHeight = UIApplication.shared.statusBarFrame.size.height

funcShowColorType(value:CGFloat) ->UIColor{

    returnUIColor.init(red: value/255.0, green: value/255.0, blue: value/255.0, alpha:1)

}

publicfuncShowOtherColorType(value:CGFloat,value1:CGFloat,value2:CGFloat) ->UIColor{

    returnUIColor.init(red: value/255.0, green: value1/255.0, blue: value2/255.0, alpha:1)

}

你可能感兴趣的:(swift 设置oc一样效果的pch文件)