OC璋冪敤Swift

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了OC璋冪敤Swift相关的知识,希望对你有一定的参考价值。

鏍囩锛?/p>

Step by step swift integration for Xcode Objc-based project:

  1. Create new *.swift file (in Xcode) or add it by using Finder
  2. Add swift bridging empty header if Xcode have not done this before (see 4 below)
  3. Implement your Swift class by using @objc attribute:

    import UIKit
    
    @objc class Hello: NSObject {
        func sayHello() {
            print("Hi there!")
        }
    }
  4. Open Build Settings and check those parameters:
    • Product Module Name : myproject
    • Defines Module : YES
    • Embedded Content Contains Swift : YES
    • Install Objective-C Compatibility Header : YES
    • Objective-C Bridging Header : $(SRCROOT)/Sources/SwiftBridging.h
  5. Import header (which is auto generated by Xcode) in your *.m file

    #import "myproject-Swift.h"
  6. Clean and rebuild your Xcode project
  7. Profit!

以上是关于OC璋冪敤Swift的主要内容,如果未能解决你的问题,请参考以下文章

IHttpClientFactory璋冪敤鎺ュ彛

PHP瀹炵幇杩滅▼杩囩▼璋冪敤RPC

濂楁帴瀛椾箣sendmsg绯荤粺璋冪敤

寰俊api璋冪敤闄愬埗锛?5009 reach max api daily quota limit 瑙e喅鏂规硶

灏忕▼搴忎簯鍑芥暟璋冪敤webservice鎺ュ彛

UDP socket涔熷彲浠ヤ娇鐢╟onnect绯荤粺璋冪敤