Is there any way to see the translated Swift signature of an Objective-C Class imported via the Bridging Header?
So e.g. given the following:
// ObjC file SomeObjCClass.h
@interface SomeObjCClass : NSObject
- (NSString *)giveMeAStringForKey:(NSString *)key;
@end
// Bridging Header
#import "SomeObjCClass.h"
Swift sees this somewhat like this:
// generated during compile time
@objc class SomeObjCClass {
func giveMeAStringForKey(key: String!) -> String!
}
And I'd like to inspect these generated type signatures. Any idea how to do that?
Select the obj-C header you want to view in the editor in Xcode (the individual header files tend to work better, rather than the bridging header), and then click the little button at the top left of the editor section which looks like four little squares (or go to menu and use View > Show Related Items). Choose "Generated Interface" at the bottom of the list that pops up, and it will show you the Swift version of the objective C header.
You can also type the name of an obj-C class into a Swift file, and command-double-click to open up the generated swift header that contains the declaration that class (or method).