I have an Objective-C project, there is a file named 'NSDictionary+Test', and a method named - (void)testDone:(TestBlock)block in the file. I add a swift file to the project , how can i use - (void)testDone:(TestBlock)block in my Swift file.
Asked
Active
Viewed 2,076 times
-2
1 Answers
0
So firstly you have your Objective C proj and in it you have your category(in Obj C) and now you added a Swift file and want to use category method in Swift.
So now answer goes-
Firstly add your .swift file and mostly it asks for creating a bridging header. If it does not get created, follow the steps from this.
Add
#import "NSDictionary+Test.h"before#endif.Now you should be able to use the
(void)testDone:(TestBlock)blockasdictionary.testDone(block : TestBlock!).
arlomedia
- 8,534
- 5
- 60
- 108
Nikhil Manapure
- 3,748
- 2
- 30
- 55