In Objective-C, we used to do the following in our class files:
In the header:
extern NSString* const kSTRING_CONSTANT;
In the implementation:
NSString* const kSTRING_CONSTANT = @"a_string_constant";
What is the Swift equivalent of this?
In Objective-C, we used to do the following in our class files:
In the header:
extern NSString* const kSTRING_CONSTANT;
In the implementation:
NSString* const kSTRING_CONSTANT = @"a_string_constant";
What is the Swift equivalent of this?
The best way to deal with that type of constants is to create a Struct
struct GlobalConstants {
static let someNotification = "TEST"
}
println(GlobalConstants.someNotification)
For further reference, refer to Swift Offical Guide or see the following link