![]() InstanceOfCustomObject.someProperty = "Hello World" In SomeSwiftFile.swift: var instanceOfCustomObject = CustomObject() In YourProject-Bridging-Header.h: #import "CustomObject.h" (void) someMethod 5: Add Class to Bridging-Header (void) CustomObject.m #import CustomObject In CustomObject.h #import CustomObject : (strong, nonatomic) id someProperty It might look like this: $(SRCROOT)/Folder/Folder/-Bridging-Header.hĪdd another. $(SRCROOT) can be thought of as the directory that contains your. It's best practice to link your project using the $(SRCROOT) macro so that if you move your project, or work on it with others using a remote repository, it will still work. h file named as mentioned above, then make sure you link its path in your target's project settings like so: ![]() In some situations, particularly when working with Objective-C frameworks, you don't add an Objective-C class explicitly and Xcode can't find the linker. (For some cases, I had to add an explicit #import -Bridging-Header.h. If you have an existing class that you'd like to use, perform Step 2 and then skip to Step 5. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |