Can't use Swift classes inside Objective-C

前端 未结 25 2413
野趣味
野趣味 2020-11-22 08:10

I try to integrate Swift code in my app.My app is written in Objective-C and I added a Swift class. I\'ve done everything described he

25条回答
  •  深忆病人
    2020-11-22 08:24

    Don't create the header file yourself. Delete the one you created.

    Make sure your Swift classes are tagged with @objc or inherit from a class that derives (directly or indirectly) from NSObject.

    Xcode won't generate the file if you have any compiler errors in your project - make sure your project builds cleanly.

提交回复
热议问题