objective-c - swift 中如何调用 Object-C?
迷茫
迷茫 2017-04-24 09:11:00
0
1
346

有没有人试过在 swift 中调用 OC 的代码?

迷茫
迷茫

业精于勤,荒于嬉;行成于思,毁于随。

reply all(1)
黄舟

You can download it on iBook.
It includes methods for Swift to call Objective-C, or to call Swift from Objective-C.
Let me briefly describe your problem here.

If your project was originally written in Objective-C.
When you create a .Swift document for the first time, XCode6 will ask you to generate a Header document.
From this document, import the Objective-C code you want to use in Swift.
This way, your Swift documents can use this class.

If you are creating a new project, you need to manually create the Header document and indicate its location in the plist.

The purpose of the above two documents is to create Header documents so that Swift can call the code in Objective-C.
It is strongly recommended to read the official documentation.

Resources from SO:
http://stackoverflow.com/questions/24002369/how-to-call-objective-c-code-from-swift/24005242#24005242

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template