Build a common method of the project properties, welcome to append
How to use:
the ) "iamge")
Swiftpch.swift
Import Foundationimport UIKit//Size SizeclassXsizeclass:nsobject {//suitable for high-widthFunc iphoneheight (height:cgfloat)CGFloat {returnUIScreen.main.bounds.size.height * (Height/1334.0)} func iphonewidth (width:cgfloat)-CGFloat {returnUIScreen.main.bounds.size.width * (Width/750.0) } //get the high width of the screenFunc screewidth ()CGFloat {returnUIScreen.main.bounds.size.width} func screenheight ()-CGFloat {returnUIScreen.main.bounds.size.height}}//System-relatedclassXsystemclass:nsobject {//system iOS versionFunc iosversion ()String {returnUIDevice.current.systemVersion}//Judging the system version is not ... Func iosversionofstring (string: String),Bool {if string. Compare (UIDevice.current.systemVersion asString). RawValue = =0 { return true }Else{ return false } } }//Property Methodclassxattributeclass:nsobject{//UserdefaultFunc Userdefaultssave (Object: String, key:string) {Userdefaults.standard.Set(Object, Forkey:key)} Func userdefaultsget (key:string)-String {returnUserdefaults.standard.Object(Forkey:key) as!String} func userdefaultsremove (key:string) {UserDefaults.standard.removeObject (forkey:k EY)}//ColorFunc Colorrgb (r:cgfloat,g:cgfloat,b:cgfloat)Uicolor {returnUicolor.init (Colorliteralred:float (R), Green:float (g), Blue:float (b), Alpha:1)} func clearcolor ()-Uicolor {returnUicolor.clear} func whitecolor ()-Uicolor {returnUicolor.white}//Photo related//get local picturesFunc ImageName (name:string)UIImage {returnUiimage.init (named:name)!} func ImageData (data:data)-UIImage {returnUiimage.init (data:data)! }}
Swift creates a common class method for engineering