In Objective-C, è possibile digitare @YES
anziché [NSNumber numberWithBOOL:YES]
. Questo rende molto più ordinato il codice.Letterali Swift booleani (Obj-C @ YES equivalente NO)
In Swift, devo scrivere NSNumber.numberWithBool(true)
, che è una specie di brutto.
Esiste un valore equivalente a @YES
e @NO
in Swift?
Grazie in anticipo per il vostro aiuto!
... perché stai usando NSNumbers a tutti? – nneonneo
@nneoneo, per Core Data ... vale a dire [NSMigratePersistentStoresAutomaticallyOption: vero, NSInferMappingModelAutomaticallyOption: vero] che ha usato per essere NSDictionary * options = [ NSMigratePersistentStoresAutomaticallyOption: @YES, NSInferMappingModelAutomaticallyOption: @YES] – Timbo