I spent a lot of time trying to solve that issue myself and already double checked available answers on SO with the same error. So here are the list of thing that I already excluded from possible reasons:
let abc = NSString(string: "abc")
In "MYHelpers.h/.m" of your project (presumably from https://github.com/AlexandrGraschenkov/MYHelpers)
NSString category with some utility methods is defined:
#pragma mark - NSString+Utils @interface NSString (Utils) - (NSString *)trim; // trim whitespace characters with new line - (NSString *):(NSString *)appendString; - (NSURL *)toURL; - (NSString *)URLEncodedString; - (NSString *)URLDecodedString; - (NSString *)lightURLEncodeString; + (BOOL)emailValidate:(NSString *)email; - (CGSize)sizeForStringWithFont:(UIFont *)font constrainedToSize:(CGSize)size; - (id)JSON; @end
The second method
- (NSString *):(NSString *)appendString;
has an empty selector name. This is allowed in Objective-C, and you can call the method with
NSString *foobar = [@"foo" :@"bar"];
(I don't know if the method was intentionally defined with an empty selector name – I wouldn't recommend it.)
But it causes the Swift compiler to crash. This happens only if
is referenced somewhere in the Swift code.
(The compiler should never crash, no matter how malformed the input is,
so I would recommend to file a bug report at Apple).
You can rename the method to
- (NSString *)appendString:(NSString *)appendString;
(or simply remove it if you don't need it in your project), that should solve the problem.