WeexSwiftSample
WeexSwiftSample copied to clipboard
a swift extend and integration plugins of Weex
You can see how to custom your own handler、components or modules using swift in this repository.
-
cocoaPods
Add the following line to your Podfile:pod 'WeexSDK' -
carthage
Add the following line to your Cartfile:github "apache/incubator-weex"
You must replace file in WeexSwiftSample/lib/WeexSDK.framework and then WeexSwiftSample project can run correctly
How to get WeexSDK.framework
recommend you to compile from Weex source here,so that you can get the new feature, and can build your own Weex SDK after modifying
-
clone Weex project
you can use SSHit clone [email protected]:alibaba/weex.gitor use https
it clone https://github.com/alibaba/weex.git -
open WeexSDK.xcodeproj in
weex/ios/sdk
switch target just below
-
Build this project or use the xcode default hot key
⌘ + b -
Finally you can find
Productsdirectory inweex/ios/sdk,WeexSDK.frameworkwas here
Integrate to your Swift project
- Import the framework you get above and import system framework
- Add
SocketRocket:copy hereSRWebSocket.h/mto your own Project (if cocoaPods is used in your project,addpod 'SocketRocket'to Podfie ) - Add
main.js(which is in theWeexSDK.framework) to your main bundle - Import
WeexSDKmodule
important
add -ObjC to your project settings,just like this