Semplicemente ho una struttura che memorizza le costanti dell'applicazione come di seguito:
struct Constant {
static let ParseApplicationId = "xxx"
static let ParseClientKey = "xxx"
static var AppGreenColor: UIColor {
return UIColor(hexString: "67B632")
}
}
Queste costanti possono essere utilizzate nel codice Swift chiamando Constant.ParseClientKey
ad esempio. Ma nel mio codice contiene anche alcune classi Objective-C. Quindi la mia domanda è come utilizzare queste costanti nel codice Objective-C?
Se questo modo di dichiarare le costanti non è buono, qual è il modo migliore per creare costanti globali da utilizzare sia nel codice Swift che in quello Objective-C?
UIControlEvents.TouchUpInside
?
NS_OPTIONS
enumerazioni di stile. Semanticamente UIControlEvent
è ancora un tipo di enumerazione.