Search code examples
objective-cswiftwatchkit

Reference a Objective c class in my WatchKit extension (swift)


My main Project is in Objective c and i am developing watchkit in Swift. Now my requirement is that I have to access objective c methods in swift (Watchkit extension).

I have created a bridge and imported the required class in it.

I was able to access this objective c class in swift file if it is in the same project. I was not able to access it in watchkit extension.

I did added the required class .m file in watchkit extension form the Target Membership with no use and i was able to access swift file in watchkit extension after adding it to target membership

So far not being able to solve this. What should i do to access Main app objective c class in Watchkit extension (Swift)?


Solution

  • I solved this problem. I just had to add the Bridge i created in the Apple Watch Target as well. As soon as i did i was able to access the shared classes in Bridge Header.