Can't use Swift classes inside Objective-C

前端 未结 25 2622
野趣味
野趣味 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:33

    I didnt have to change any settings in the build or add @obj to the class.

    All I had to do was to create bridge-header which was automatically created when I created Swift classes into Objective-c project. And then I just had to do

    import "Bedtime-Swift.h" <- inside objective-c file that needed to use that swift file.

提交回复
热议问题