At the time of writing this article, Weex is not fully open source. This is the official documentation center. Here are some articles posted on Github by the Weex team.

This article describes how to quickly integrate Weex into your iOS Project.

If you don’t already have the SDK for Weex, you can download the WeexSample. The weexSDK. framework file is available in the project, so if you are used to Objective-C, refer to this article. You can clearly know how the Sample is written, but this article does not tell you these things:

  • There are two files: srwebsocket. h and srwebsocket. m. This is facebook’s Open source project SockerRocket, which is required to run the project (at least for the time being, maybe Weex will try to make something like this themselves? )
  • There is no official Swift version of Sample at present, here is an example from a third party for your reference, there is a little problem with this example, the code style is not Swifty, I have written the problem below, others such as print is written as NSLog, it doesn’t matter much. At least it’s running with Swift
  • Weex is written in OC, the Swift project integrates it, and it requires a bridge file. If you don’t know what this file is, please refer to my previous article, this file only needs to write (no need to import SRWebSocket) :
#import 
#import 
#import 
#import Copy the code
- (void)dealloc
{
    [_instance destroyInstance];
}Copy the code

In Swift it is written as:

// Deprecated
//    override func finalize() {
//        instance.destroyInstance()
//    }

deinit {
    instance.destroyInstance()
}Copy the code
  • Add -objc to Other Link Flags in Build Settings

  • In the open source code on the official website, SDK is not made into. Framework, but a folder directly. The project integrates this SDK into the project through Pod, and also integrates other contents through Pod. Here’s what’s in your Podfile (you can see that WeexSDK was added via the local path) :

    The source 'https://github.com/CocoaPods/Specs.git' platform: ios, '7.0' # inhibit_all_warnings! target 'WeexDemo' do pod 'WeexSDK', :path=>'.. / SDK /' pod 'SDWebImage', '3.7.5' pod 'SocketRocket', '0.4.2' pod 'atSDK-weex ', '0.0.1' endCopy the code