You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@weex.apache.org by ji...@apache.org on 2017/01/24 08:18:37 UTC
[22/50] [abbrv] incubator-weex git commit: + [ios] iOS init.
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/185fe55c/ios/playground/WeexDemo/Assets.xcassets/reload.imageset/reload.png
----------------------------------------------------------------------
diff --git a/ios/playground/WeexDemo/Assets.xcassets/reload.imageset/reload.png b/ios/playground/WeexDemo/Assets.xcassets/reload.imageset/reload.png
new file mode 100644
index 0000000..1fd4bac
Binary files /dev/null and b/ios/playground/WeexDemo/Assets.xcassets/reload.imageset/reload.png differ
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/185fe55c/ios/playground/WeexDemo/Assets.xcassets/reload.imageset/reload@2x.png
----------------------------------------------------------------------
diff --git a/ios/playground/WeexDemo/Assets.xcassets/reload.imageset/reload@2x.png b/ios/playground/WeexDemo/Assets.xcassets/reload.imageset/reload@2x.png
new file mode 100644
index 0000000..6e97235
Binary files /dev/null and b/ios/playground/WeexDemo/Assets.xcassets/reload.imageset/reload@2x.png differ
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/185fe55c/ios/playground/WeexDemo/Assets.xcassets/reload.imageset/reload@3x.png
----------------------------------------------------------------------
diff --git a/ios/playground/WeexDemo/Assets.xcassets/reload.imageset/reload@3x.png b/ios/playground/WeexDemo/Assets.xcassets/reload.imageset/reload@3x.png
new file mode 100644
index 0000000..ab75ee7
Binary files /dev/null and b/ios/playground/WeexDemo/Assets.xcassets/reload.imageset/reload@3x.png differ
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/185fe55c/ios/playground/WeexDemo/Assets.xcassets/scan.imageset/Contents.json
----------------------------------------------------------------------
diff --git a/ios/playground/WeexDemo/Assets.xcassets/scan.imageset/Contents.json b/ios/playground/WeexDemo/Assets.xcassets/scan.imageset/Contents.json
new file mode 100644
index 0000000..798ba85
--- /dev/null
+++ b/ios/playground/WeexDemo/Assets.xcassets/scan.imageset/Contents.json
@@ -0,0 +1,23 @@
+{
+ "images" : [
+ {
+ "idiom" : "universal",
+ "filename" : "scan.png",
+ "scale" : "1x"
+ },
+ {
+ "idiom" : "universal",
+ "filename" : "scan@2x.png",
+ "scale" : "2x"
+ },
+ {
+ "idiom" : "universal",
+ "filename" : "scan@3x.png",
+ "scale" : "3x"
+ }
+ ],
+ "info" : {
+ "version" : 1,
+ "author" : "xcode"
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/185fe55c/ios/playground/WeexDemo/Assets.xcassets/scan.imageset/scan.png
----------------------------------------------------------------------
diff --git a/ios/playground/WeexDemo/Assets.xcassets/scan.imageset/scan.png b/ios/playground/WeexDemo/Assets.xcassets/scan.imageset/scan.png
new file mode 100644
index 0000000..6183105
Binary files /dev/null and b/ios/playground/WeexDemo/Assets.xcassets/scan.imageset/scan.png differ
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/185fe55c/ios/playground/WeexDemo/Assets.xcassets/scan.imageset/scan@2x.png
----------------------------------------------------------------------
diff --git a/ios/playground/WeexDemo/Assets.xcassets/scan.imageset/scan@2x.png b/ios/playground/WeexDemo/Assets.xcassets/scan.imageset/scan@2x.png
new file mode 100644
index 0000000..43cf01d
Binary files /dev/null and b/ios/playground/WeexDemo/Assets.xcassets/scan.imageset/scan@2x.png differ
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/185fe55c/ios/playground/WeexDemo/Assets.xcassets/scan.imageset/scan@3x.png
----------------------------------------------------------------------
diff --git a/ios/playground/WeexDemo/Assets.xcassets/scan.imageset/scan@3x.png b/ios/playground/WeexDemo/Assets.xcassets/scan.imageset/scan@3x.png
new file mode 100644
index 0000000..76c7e0b
Binary files /dev/null and b/ios/playground/WeexDemo/Assets.xcassets/scan.imageset/scan@3x.png differ
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/185fe55c/ios/playground/WeexDemo/Base.lproj/LaunchScreen.storyboard
----------------------------------------------------------------------
diff --git a/ios/playground/WeexDemo/Base.lproj/LaunchScreen.storyboard b/ios/playground/WeexDemo/Base.lproj/LaunchScreen.storyboard
new file mode 100644
index 0000000..de7de6e
--- /dev/null
+++ b/ios/playground/WeexDemo/Base.lproj/LaunchScreen.storyboard
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="10117" systemVersion="15E65" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" initialViewController="01J-lp-oVM">
+ <dependencies>
+ <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="10085"/>
+ </dependencies>
+ <scenes>
+ <!--View Controller-->
+ <scene sceneID="EHf-IW-A2E">
+ <objects>
+ <viewController id="01J-lp-oVM" sceneMemberID="viewController">
+ <layoutGuides>
+ <viewControllerLayoutGuide type="top" id="Llm-lL-Icb"/>
+ <viewControllerLayoutGuide type="bottom" id="xb3-aO-Qok"/>
+ </layoutGuides>
+ <view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
+ <rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
+ <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+ <color key="backgroundColor" red="0.27058823529411763" green="0.70980392156862748" blue="0.94117647058823528" alpha="1" colorSpace="calibratedRGB"/>
+ </view>
+ </viewController>
+ <placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/>
+ </objects>
+ <point key="canvasLocation" x="53" y="375"/>
+ </scene>
+ </scenes>
+</document>
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/185fe55c/ios/playground/WeexDemo/DemoBaseViewController.h
----------------------------------------------------------------------
diff --git a/ios/playground/WeexDemo/DemoBaseViewController.h b/ios/playground/WeexDemo/DemoBaseViewController.h
new file mode 100644
index 0000000..2e09ece
--- /dev/null
+++ b/ios/playground/WeexDemo/DemoBaseViewController.h
@@ -0,0 +1,13 @@
+/**
+ * Created by Weex.
+ * Copyright (c) 2016, Alibaba, Inc. All rights reserved.
+ *
+ * This source code is licensed under the Apache Licence 2.0.
+ * For the full copyright and license information,please view the LICENSE file in the root directory of this source tree.
+ */
+
+#import <UIKit/UIKit.h>
+
+@interface DemoBaseViewController : UIViewController
+
+@end
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/185fe55c/ios/playground/WeexDemo/DemoBaseViewController.m
----------------------------------------------------------------------
diff --git a/ios/playground/WeexDemo/DemoBaseViewController.m b/ios/playground/WeexDemo/DemoBaseViewController.m
new file mode 100644
index 0000000..95524d0
--- /dev/null
+++ b/ios/playground/WeexDemo/DemoBaseViewController.m
@@ -0,0 +1,34 @@
+/**
+ * Created by Weex.
+ * Copyright (c) 2016, Alibaba, Inc. All rights reserved.
+ *
+ * This source code is licensed under the Apache Licence 2.0.
+ * For the full copyright and license information,please view the LICENSE file in the root directory of this source tree.
+ */
+
+#import "DemoBaseViewController.h"
+#import "UIViewController+WXDemoNaviBar.h"
+
+@interface DemoBaseViewController ()
+
+@end
+
+@implementation DemoBaseViewController
+
+- (instancetype)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
+{
+ return [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
+}
+
+- (void)viewDidLoad {
+ [super viewDidLoad];
+ // Do any additional setup after loading the view.
+ [self setupNaviBar];
+}
+
+- (void)didReceiveMemoryWarning {
+ [super didReceiveMemoryWarning];
+ // Dispose of any resources that can be recreated.
+}
+
+@end
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/185fe55c/ios/playground/WeexDemo/DemoDefine.h
----------------------------------------------------------------------
diff --git a/ios/playground/WeexDemo/DemoDefine.h b/ios/playground/WeexDemo/DemoDefine.h
new file mode 100644
index 0000000..67e4290
--- /dev/null
+++ b/ios/playground/WeexDemo/DemoDefine.h
@@ -0,0 +1,28 @@
+/**
+ * Created by Weex.
+ * Copyright (c) 2016, Alibaba, Inc. All rights reserved.
+ *
+ * This source code is licensed under the Apache Licence 2.0.
+ * For the full copyright and license information,please view the LICENSE file in the root directory of this source tree.
+ */
+
+#import <Foundation/Foundation.h>
+
+#define CURRENT_IP @"your computer device ip"
+
+#if TARGET_IPHONE_SIMULATOR
+ #define DEMO_HOST @"127.0.0.1"
+#else
+ #define DEMO_HOST CURRENT_IP
+#endif
+
+#define DEMO_URL(path) [NSString stringWithFormat:@"http://%@:12580/%s", DEMO_HOST, #path]
+
+#define HOME_URL [NSString stringWithFormat:@"http://%@:12580/examples/build/index.js", DEMO_HOST]
+
+#define BUNDLE_URL [NSString stringWithFormat:@"file://%@/bundlejs/index.js",[NSBundle mainBundle].bundlePath]
+
+#define UITEST_HOME_URL @"http://test?_wx_tpl=http://localhost:12580/test/build/TC__Home.js"
+
+#define QRSCAN @"com.taobao.WeexDemo.scan"
+#define WEEX_COLOR [UIColor colorWithRed:0.27 green:0.71 blue:0.94 alpha:1]
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/185fe55c/ios/playground/WeexDemo/Info.plist
----------------------------------------------------------------------
diff --git a/ios/playground/WeexDemo/Info.plist b/ios/playground/WeexDemo/Info.plist
new file mode 100644
index 0000000..738c6ed
--- /dev/null
+++ b/ios/playground/WeexDemo/Info.plist
@@ -0,0 +1,65 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>CFBundleDevelopmentRegion</key>
+ <string>en</string>
+ <key>CFBundleExecutable</key>
+ <string>$(EXECUTABLE_NAME)</string>
+ <key>CFBundleIdentifier</key>
+ <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
+ <key>CFBundleInfoDictionaryVersion</key>
+ <string>6.0</string>
+ <key>CFBundleName</key>
+ <string>$(PRODUCT_NAME)</string>
+ <key>CFBundlePackageType</key>
+ <string>APPL</string>
+ <key>CFBundleShortVersionString</key>
+ <string>1.0</string>
+ <key>CFBundleSignature</key>
+ <string>????</string>
+ <key>CFBundleVersion</key>
+ <string>1</string>
+ <key>LSRequiresIPhoneOS</key>
+ <true/>
+ <key>NSAppTransportSecurity</key>
+ <dict>
+ <key>NSAllowsArbitraryLoads</key>
+ <true/>
+ </dict>
+ <key>UIApplicationShortcutItems</key>
+ <array>
+ <dict>
+ <key>UIApplicationShortcutItemIconFile</key>
+ <string>scan</string>
+ <key>UIApplicationShortcutItemSubtitle</key>
+ <string>scan your QR code</string>
+ <key>UIApplicationShortcutItemTitle</key>
+ <string>Scan QR</string>
+ <key>UIApplicationShortcutItemType</key>
+ <string>com.taobao.WeexDemo.scan</string>
+ </dict>
+ </array>
+ <key>UILaunchStoryboardName</key>
+ <string>LaunchScreen</string>
+ <key>UIRequiredDeviceCapabilities</key>
+ <array>
+ <string>armv7</string>
+ </array>
+ <key>UIStatusBarStyle</key>
+ <string>UIStatusBarStyleLightContent</string>
+ <key>UISupportedInterfaceOrientations</key>
+ <array>
+ <string>UIInterfaceOrientationPortrait</string>
+ </array>
+ <key>UISupportedInterfaceOrientations~ipad</key>
+ <array>
+ <string>UIInterfaceOrientationPortrait</string>
+ <string>UIInterfaceOrientationPortraitUpsideDown</string>
+ <string>UIInterfaceOrientationLandscapeLeft</string>
+ <string>UIInterfaceOrientationLandscapeRight</string>
+ </array>
+ <key>UIViewControllerBasedStatusBarAppearance</key>
+ <false/>
+</dict>
+</plist>
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/185fe55c/ios/playground/WeexDemo/Scanner/WXScannerVC.h
----------------------------------------------------------------------
diff --git a/ios/playground/WeexDemo/Scanner/WXScannerVC.h b/ios/playground/WeexDemo/Scanner/WXScannerVC.h
new file mode 100644
index 0000000..fa0f56a
--- /dev/null
+++ b/ios/playground/WeexDemo/Scanner/WXScannerVC.h
@@ -0,0 +1,14 @@
+/**
+ * Created by Weex.
+ * Copyright (c) 2016, Alibaba, Inc. All rights reserved.
+ *
+ * This source code is licensed under the Apache Licence 2.0.
+ * For the full copyright and license information,please view the LICENSE file in the root directory of this source tree.
+ */
+
+#import <UIKit/UIKit.h>
+#import <ZXingObjC/ZXingObjC.h>
+
+@interface WXScannerVC : UIViewController <ZXCaptureDelegate>
+
+@end
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/185fe55c/ios/playground/WeexDemo/Scanner/WXScannerVC.m
----------------------------------------------------------------------
diff --git a/ios/playground/WeexDemo/Scanner/WXScannerVC.m b/ios/playground/WeexDemo/Scanner/WXScannerVC.m
new file mode 100644
index 0000000..24e6291
--- /dev/null
+++ b/ios/playground/WeexDemo/Scanner/WXScannerVC.m
@@ -0,0 +1,170 @@
+/**
+ * Created by Weex.
+ * Copyright (c) 2016, Alibaba, Inc. All rights reserved.
+ *
+ * This source code is licensed under the Apache Licence 2.0.
+ * For the full copyright and license information,please view the LICENSE file in the root directory of this source tree.
+ */
+
+#import "WXScannerVC.h"
+#import "AppDelegate.h"
+#import "UIViewController+WXDemoNaviBar.h"
+#import "WXDemoViewController.h"
+#import "WXDebugTool.h"
+#import <AudioToolbox/AudioToolbox.h>
+#import <WeexSDK/WXSDKEngine.h>
+
+@interface WXScannerVC ()
+
+@property (nonatomic, strong) ZXCapture *capture;
+
+@property (nonatomic) BOOL opened;
+
+@end
+
+@implementation WXScannerVC
+
+#pragma mark - lifeCircle
+
+- (void)dealloc {
+ [self.capture.layer removeFromSuperlayer];
+}
+
+- (void)viewDidLoad {
+ [super viewDidLoad];
+
+ self.edgesForExtendedLayout = UIRectEdgeNone;
+
+ [self setupNaviBar];
+
+ self.capture = [[ZXCapture alloc] init];
+ self.capture.camera = self.capture.back;
+ self.capture.focusMode = AVCaptureFocusModeContinuousAutoFocus;
+ self.capture.rotation = 90.0f;
+
+ self.capture.layer.frame = self.view.bounds;
+ [self.view.layer addSublayer:self.capture.layer];
+
+}
+
+- (void)viewWillAppear:(BOOL)animated {
+ [super viewWillAppear:animated];
+
+ [self.view.layer addSublayer:self.capture.layer];
+ [self.capture start];
+
+ self.capture.delegate = self;
+ self.capture.layer.frame = self.view.bounds;
+
+ CGAffineTransform captureSizeTransform = CGAffineTransformMakeScale(320 / self.view.frame.size.width, 480 / self.view.frame.size.height);
+ self.capture.scanRect = CGRectApplyAffineTransform(self.view.frame, captureSizeTransform);
+}
+
+- (void) viewDidDisappear:(BOOL)animated
+{
+ [super viewDidDisappear:animated];
+
+ [self.capture.layer removeFromSuperlayer];
+ [self.capture stop];
+}
+
+#pragma mark - ZXCaptureDelegate
+
+- (void)captureResult:(ZXCapture *)capture result:(ZXResult *)result {
+ if (!result) return;
+
+ [self.capture.layer removeFromSuperlayer];
+ [self.capture stop];
+
+ if (!_opened) {
+ //Vibrate
+ AudioServicesPlaySystemSound(kSystemSoundID_Vibrate);
+ _opened = YES;
+ __weak __typeof__(self) weakSelf = self;
+ dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
+ weakSelf.opened = NO;
+ });
+
+ [self openURL:result.text];
+ }
+}
+
+- (void) openURL:(NSString*)URL
+{
+ NSURL *url = [NSURL URLWithString:URL];
+ [self remoteDebug:url];
+ [self jsReplace:url];
+ WXDemoViewController * controller = [[WXDemoViewController alloc] init];
+ controller.url = url;
+ controller.source = @"scan";
+
+ if ([url.port integerValue] == 8081) {
+ NSURL *socketURL = [NSURL URLWithString:[NSString stringWithFormat:@"ws://%@:8082", url.host]];
+ controller.hotReloadSocket = [[SRWebSocket alloc] initWithURL:socketURL protocols:@[@"echo-protocol"]];
+ controller.hotReloadSocket.delegate = controller;
+ [controller.hotReloadSocket open];
+ }
+
+ [[self navigationController] pushViewController:controller animated:YES];
+}
+
+#pragma mark - Replace JS
+- (void)jsReplace:(NSURL *)url
+{
+ if ([[url host] isEqualToString:@"weex-remote-debugger"]){
+ NSString* path = [url path];
+ if ([path isEqualToString:@"/dynamic/replace/bundle"]){
+ for (NSString * param in [[url query] componentsSeparatedByString:@"&"]) {
+ NSArray* elts = [param componentsSeparatedByString:@"="];
+ if ([elts count] < 2) {
+ continue;
+ }
+ if ([[elts firstObject] isEqualToString:@"bundle"]){
+ [WXDebugTool setReplacedBundleJS:[NSURL URLWithString:[elts lastObject]]];
+ }
+ }
+ }
+
+ if ([path isEqualToString:@"/dynamic/replace/framework"]){
+ for (NSString * param in [[url query] componentsSeparatedByString:@"&"]) {
+ NSArray* elts = [param componentsSeparatedByString:@"="];
+ if ([elts count] < 2) {
+ continue;
+ }
+ if ([[elts firstObject] isEqualToString:@"framework"]){
+ [WXDebugTool setReplacedJSFramework:[NSURL URLWithString:[elts lastObject]]];
+ }
+ }
+ }
+ }
+}
+
+#pragma mark Remote debug
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Warc-performSelector-leaks"
+- (void)remoteDebug:(NSURL *)url
+{
+ if ([url.scheme isEqualToString:@"ws"]) {
+ [WXSDKEngine connectDebugServer:url.absoluteString];
+ [WXSDKEngine initSDKEnviroment];
+ }
+
+ NSString *query = url.query;
+ for (NSString *param in [query componentsSeparatedByString:@"&"]) {
+ NSArray *elts = [param componentsSeparatedByString:@"="];
+ if([elts count] < 2) continue;
+ if ([[elts firstObject] isEqualToString:@"_wx_debug"]) {
+ [WXDebugTool setDebug:YES];
+ [WXSDKEngine connectDebugServer:[[elts lastObject] stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding]];
+ if ([[[self.navigationController viewControllers] objectAtIndex:0] isKindOfClass:NSClassFromString(@"WXDemoViewController")]) {
+ WXDemoViewController * vc = (WXDemoViewController*)[[self.navigationController viewControllers] objectAtIndex:0];
+ [vc performSelector:NSSelectorFromString(@"loadRefreshCtl")];
+ [self.navigationController popToViewController:vc animated:NO];
+ }
+ return;
+ }
+ }
+}
+#pragma clang diagnostic pop
+
+@end
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/185fe55c/ios/playground/WeexDemo/UIViewController+WXDemoNaviBar.h
----------------------------------------------------------------------
diff --git a/ios/playground/WeexDemo/UIViewController+WXDemoNaviBar.h b/ios/playground/WeexDemo/UIViewController+WXDemoNaviBar.h
new file mode 100644
index 0000000..e123e48
--- /dev/null
+++ b/ios/playground/WeexDemo/UIViewController+WXDemoNaviBar.h
@@ -0,0 +1,23 @@
+/**
+ * Created by Weex.
+ * Copyright (c) 2016, Alibaba, Inc. All rights reserved.
+ *
+ * This source code is licensed under the Apache Licence 2.0.
+ * For the full copyright and license information,please view the LICENSE file in the root directory of this source tree.
+ */
+
+#import <UIKit/UIKit.h>
+#import "DemoDefine.h"
+
+@interface UIViewController (WXDemoNaviBar) <UIGestureRecognizerDelegate>
+
+/**
+ * back button click action
+ * @param sender responder
+ */
+- (void)backButtonClicked:(id)sender;
+
+- (void)setupNaviBar;
+
+@end
+
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/185fe55c/ios/playground/WeexDemo/UIViewController+WXDemoNaviBar.m
----------------------------------------------------------------------
diff --git a/ios/playground/WeexDemo/UIViewController+WXDemoNaviBar.m b/ios/playground/WeexDemo/UIViewController+WXDemoNaviBar.m
new file mode 100644
index 0000000..7abefa6
--- /dev/null
+++ b/ios/playground/WeexDemo/UIViewController+WXDemoNaviBar.m
@@ -0,0 +1,103 @@
+/**
+ * Created by Weex.
+ * Copyright (c) 2016, Alibaba, Inc. All rights reserved.
+ *
+ * This source code is licensed under the Apache Licence 2.0.
+ * For the full copyright and license information,please view the LICENSE file in the root directory of this source tree.
+ */
+
+#import "UIViewController+WXDemoNaviBar.h"
+#import "WXScannerVC.h"
+#import <objc/runtime.h>
+
+@implementation UIViewController (WXDemoNaviBar)
+
+- (void)setupNaviBar {
+ UIScreenEdgePanGestureRecognizer *edgePanGestureRecognizer = [[UIScreenEdgePanGestureRecognizer alloc] initWithTarget:self action:@selector(edgePanGesture:)];
+ edgePanGestureRecognizer.delegate = self;
+ edgePanGestureRecognizer.edges = UIRectEdgeLeft;
+ [self.view addGestureRecognizer:edgePanGestureRecognizer];
+
+ NSArray *ver = [[UIDevice currentDevice].systemVersion componentsSeparatedByString:@"."];
+ if ([[ver objectAtIndex:0] intValue] >= 7) {
+ // iOS 7.0 or later
+ self.navigationController.navigationBar.barTintColor = WEEX_COLOR;
+ self.navigationController.navigationBar.tintColor = [UIColor whiteColor];
+ self.navigationController.navigationBar.translucent = NO;
+ }else {
+ // iOS 6.1 or earlier
+ self.navigationController.navigationBar.tintColor = WEEX_COLOR;
+ }
+
+ [self.navigationController.navigationBar setTitleTextAttributes: [NSDictionary dictionaryWithObjectsAndKeys:
+ [UIColor whiteColor], NSForegroundColorAttributeName, nil]];
+ self.navigationItem.title = @"Weex Demo";
+
+ if (self.navigationItem.leftBarButtonItem) return;
+
+ UIBarButtonItem *leftItem;
+ if(![[self.navigationController.viewControllers objectAtIndex:0] isEqual:self]) {
+ leftItem = [self backButtonItem];
+ } else {
+ leftItem = [self leftBarButtonItem];
+ }
+
+ self.navigationItem.leftBarButtonItems = @[leftItem];
+}
+
+- (void)edgePanGesture:(UIScreenEdgePanGestureRecognizer*)edgePanGestureRecognizer{
+ [self.navigationController popViewControllerAnimated:YES];
+}
+
+#pragma mark- UIGestureRecognizerDelegate
+- (BOOL)gestureRecognizerShouldBegin:(UIGestureRecognizer *)gestureRecognizer{
+ if (self.navigationController && [self.navigationController.viewControllers count] == 1) {
+ return NO;
+ }
+ return YES;
+}
+
+#pragma mark -
+#pragma mark - UIBarButtonItems
+
+- (UIBarButtonItem *)leftBarButtonItem {
+ UIBarButtonItem *leftItem = objc_getAssociatedObject(self, _cmd);
+
+ if (!leftItem) {
+ leftItem = [[UIBarButtonItem alloc]
+ initWithImage:[UIImage imageNamed:@"scan"]
+ style:UIBarButtonItemStyleBordered
+ target:self
+ action:@selector(scanQR:)];
+ leftItem.accessibilityHint = @"click to scan qr code";
+ leftItem.accessibilityValue = @"scan qr code";
+ objc_setAssociatedObject(self, _cmd, leftItem, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
+ }
+ return leftItem;
+}
+
+- (UIBarButtonItem *)backButtonItem {
+ UIBarButtonItem *backButtonItem = objc_getAssociatedObject(self, _cmd);
+ if (!backButtonItem) {
+ backButtonItem = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"back"]
+ style:UIBarButtonItemStyleBordered
+ target:self
+ action:@selector(backButtonClicked:)];
+ objc_setAssociatedObject(self, _cmd, backButtonItem, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
+ }
+ return backButtonItem;
+}
+
+#pragma mark -
+#pragma mark - UIBarButtonItem actions
+
+- (void)scanQR:(id)sender {
+ WXScannerVC * scanViewController = [[WXScannerVC alloc] init];
+ [self.navigationController pushViewController:scanViewController animated:NO];
+}
+
+- (void)backButtonClicked:(id)sender {
+ [self.navigationController popViewControllerAnimated:YES];
+}
+
+@end
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/185fe55c/ios/playground/WeexDemo/WXDemoViewController.h
----------------------------------------------------------------------
diff --git a/ios/playground/WeexDemo/WXDemoViewController.h b/ios/playground/WeexDemo/WXDemoViewController.h
new file mode 100644
index 0000000..8ea2fd7
--- /dev/null
+++ b/ios/playground/WeexDemo/WXDemoViewController.h
@@ -0,0 +1,21 @@
+/**
+ * Created by Weex.
+ * Copyright (c) 2016, Alibaba, Inc. All rights reserved.
+ *
+ * This source code is licensed under the Apache Licence 2.0.
+ * For the full copyright and license information,please view the LICENSE file in the root directory of this source tree.
+ */
+
+#import <UIKit/UIKit.h>
+#import <SRWebSocket.h>
+
+@interface WXDemoViewController : UIViewController<SRWebSocketDelegate>
+
+@property (nonatomic, strong) NSString *script;
+@property (nonatomic, strong) NSURL *url;
+
+@property (nonatomic, strong) SRWebSocket *hotReloadSocket;
+@property (nonatomic, strong) NSString *source;
+
+@end
+
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/185fe55c/ios/playground/WeexDemo/WXDemoViewController.m
----------------------------------------------------------------------
diff --git a/ios/playground/WeexDemo/WXDemoViewController.m b/ios/playground/WeexDemo/WXDemoViewController.m
new file mode 100644
index 0000000..1e6cd19
--- /dev/null
+++ b/ios/playground/WeexDemo/WXDemoViewController.m
@@ -0,0 +1,217 @@
+/**
+ * Created by Weex.
+ * Copyright (c) 2016, Alibaba, Inc. All rights reserved.
+ *
+ * This source code is licensed under the Apache Licence 2.0.
+ * For the full copyright and license information,please view the LICENSE file in the root directory of this source tree.
+ */
+
+#import "WXDemoViewController.h"
+#import <WeexSDK/WXSDKInstance.h>
+#import <WeexSDK/WXSDKEngine.h>
+#import <WeexSDK/WXUtility.h>
+#import <WeexSDK/WXDebugTool.h>
+#import "UIViewController+WXDemoNaviBar.h"
+#import "DemoDefine.h"
+
+
+@interface WXDemoViewController () <UIScrollViewDelegate, UIWebViewDelegate>
+@property (nonatomic, strong) WXSDKInstance *instance;
+@property (nonatomic, strong) UIView *weexView;
+
+@property (nonatomic, strong) NSArray *refreshList;
+@property (nonatomic, strong) NSArray *refreshList1;
+@property (nonatomic, strong) NSArray *refresh;
+@property (nonatomic) NSInteger count;
+
+@property (nonatomic, assign) CGFloat weexHeight;
+@property (nonatomic, weak) id<UIScrollViewDelegate> originalDelegate;
+
+@end
+
+@implementation WXDemoViewController
+
+- (instancetype)init
+{
+ if (self = [super init]) {
+ }
+
+ return self;
+}
+
+- (void)viewDidLoad
+{
+ [super viewDidLoad];
+
+ [self setupNaviBar];
+ [self setupRightBarItem];
+ self.view.backgroundColor = [UIColor whiteColor];
+
+ _weexHeight = self.view.frame.size.height - 64;
+
+ [self render];
+}
+
+- (void)viewDidAppear:(BOOL)animated
+{
+ [super viewDidAppear:animated];
+}
+
+- (void)viewWillAppear:(BOOL)animated
+{
+ [super viewWillAppear:animated];
+ self.navigationController.navigationBarHidden = NO;
+}
+
+//TODO get height
+- (void)viewDidLayoutSubviews
+{
+ _weexHeight = self.view.frame.size.height;
+}
+
+- (void)didReceiveMemoryWarning {
+ [super didReceiveMemoryWarning];
+ // Dispose of any resources that can be recreated.
+}
+
+- (void)dealloc
+{
+ [_instance destroyInstance];
+}
+
+- (void)render
+{
+ CGFloat width = self.view.frame.size.width;
+ [_instance destroyInstance];
+ _instance = [[WXSDKInstance alloc] init];
+ _instance.viewController = self;
+ _instance.frame = CGRectMake(self.view.frame.size.width-width, 0, width, _weexHeight);
+
+ __weak typeof(self) weakSelf = self;
+ _instance.onCreate = ^(UIView *view) {
+ [weakSelf.weexView removeFromSuperview];
+ weakSelf.weexView = view;
+ [weakSelf.view addSubview:weakSelf.weexView];
+ UIAccessibilityPostNotification(UIAccessibilityScreenChangedNotification, weakSelf.weexView);
+ };
+ _instance.onFailed = ^(NSError *error) {
+ #ifdef UITEST
+ if ([[error domain] isEqualToString:@"1"]) {
+ dispatch_async(dispatch_get_main_queue(), ^{
+ NSMutableString *errMsg=[NSMutableString new];
+ [errMsg appendFormat:@"ErrorType:%@\n",[error domain]];
+ [errMsg appendFormat:@"ErrorCode:%ld\n",(long)[error code]];
+ [errMsg appendFormat:@"ErrorInfo:%@\n", [error userInfo]];
+
+ UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"render failed" message:errMsg delegate:weakSelf cancelButtonTitle:nil otherButtonTitles:@"ok", nil];
+ [alertView show];
+ });
+ }
+ #endif
+ };
+
+ _instance.renderFinish = ^(UIView *view) {
+ NSLog(@"render finish");
+ };
+
+ _instance.updateFinish = ^(UIView *view) {
+ WXLogInfo(@"%@", @"Update Finish...");
+ };
+ if (!self.url) {
+ WXLogError(@"error: render url is nil");
+ return;
+ }
+ NSURL *URL = [self testURL: [self.url absoluteString]];
+ NSString *randomURL = [NSString stringWithFormat:@"%@?random=%d",URL.absoluteString,arc4random()];
+ if (!_source) {
+ [_instance renderWithURL:[NSURL URLWithString:randomURL] options:@{@"bundleUrl":URL.absoluteString} data:nil];
+ }else {
+ _source = nil;
+ [_instance renderWithURL:[NSURL URLWithString:randomURL] options:@{@"bundleUrl":URL.absoluteString} data:nil];
+ }
+}
+
+#pragma mark - refresh
+- (void)refreshWeex
+{
+ [self render];
+}
+
+#pragma mark - UIBarButtonItems
+
+- (void)setupRightBarItem
+{
+ if ([WXDebugTool isDebug]){
+ [self loadRefreshCtl];
+ }
+}
+
+- (void)loadRefreshCtl {
+ UIBarButtonItem *refreshButtonItem = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"reload"] style:UIBarButtonItemStylePlain target:self action:@selector(refreshWeex)];
+ refreshButtonItem.accessibilityHint = @"click to reload curent page";
+ self.navigationItem.rightBarButtonItem = refreshButtonItem;
+}
+
+#pragma mark - websocket
+- (void)webSocketDidOpen:(SRWebSocket *)webSocket
+{
+
+}
+
+- (void)webSocket:(SRWebSocket *)webSocket didReceiveMessage:(id)message
+{
+ if ([@"refresh" isEqualToString:message]) {
+ [self render];
+ }
+}
+
+- (void)webSocket:(SRWebSocket *)webSocket didFailWithError:(NSError *)error
+{
+
+}
+
+#pragma mark - localBundle
+/*- (void)loadLocalBundle:(NSURL *)url
+{
+ NSURL * localPath = nil;
+ NSMutableArray * pathComponents = nil;
+ if (self.url) {
+ pathComponents =[NSMutableArray arrayWithArray:[url.absoluteString pathComponents]];
+ [pathComponents removeObjectsInRange:NSRangeFromString(@"0 3")];
+ [pathComponents replaceObjectAtIndex:0 withObject:@"bundlejs"];
+
+ NSString *filePath = [NSString stringWithFormat:@"%@/%@",[NSBundle mainBundle].bundlePath,[pathComponents componentsJoinedByString:@"/"]];
+ localPath = [NSURL fileURLWithPath:filePath];
+ }else {
+ NSString *filePath = [NSString stringWithFormat:@"%@/bundlejs/index.js",[NSBundle mainBundle].bundlePath];
+ localPath = [NSURL fileURLWithPath:filePath];
+ }
+
+ NSString *bundleUrl = [NSURL fileURLWithPath:[NSString stringWithFormat:@"%@/bundlejs/",[NSBundle mainBundle].bundlePath]].absoluteString;
+ [_instance renderWithURL:localPath options:@{@"bundleUrl":bundleUrl} data:nil];
+}*/
+
+#pragma mark - load local device bundle
+- (NSURL*)testURL:(NSString*)url
+{
+ NSRange range = [url rangeOfString:@"_wx_tpl"];
+ if (range.location != NSNotFound) {
+ NSString *tmp = [url substringFromIndex:range.location];
+ NSUInteger start = [tmp rangeOfString:@"="].location;
+ NSUInteger end = [tmp rangeOfString:@"&"].location;
+ ++start;
+ if (end == NSNotFound) {
+ end = [tmp length] - start;
+ }
+ else {
+ end = end - start;
+ }
+ NSRange subRange;
+ subRange.location = start;
+ subRange.length = end;
+ url = [tmp substringWithRange:subRange];
+ }
+ return [NSURL URLWithString:url];
+}
+
+@end
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/185fe55c/ios/playground/WeexDemo/debug/WXATLoggerPlugin.h
----------------------------------------------------------------------
diff --git a/ios/playground/WeexDemo/debug/WXATLoggerPlugin.h b/ios/playground/WeexDemo/debug/WXATLoggerPlugin.h
new file mode 100644
index 0000000..23dfceb
--- /dev/null
+++ b/ios/playground/WeexDemo/debug/WXATLoggerPlugin.h
@@ -0,0 +1,14 @@
+/**
+ * Created by Weex.
+ * Copyright (c) 2016, Alibaba, Inc. All rights reserved.
+ *
+ * This source code is licensed under the Apache Licence 2.0.
+ * For the full copyright and license information,please view the LICENSE file in the root directory of this source tree.
+ */
+
+#import <Foundation/Foundation.h>
+#import <ATSDK/ATPluginProtocol.h>
+
+@interface WXATLoggerPlugin : NSObject<ATPluginProtocol>
+
+@end
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/185fe55c/ios/playground/WeexDemo/debug/WXATLoggerPlugin.m
----------------------------------------------------------------------
diff --git a/ios/playground/WeexDemo/debug/WXATLoggerPlugin.m b/ios/playground/WeexDemo/debug/WXATLoggerPlugin.m
new file mode 100644
index 0000000..2591efc
--- /dev/null
+++ b/ios/playground/WeexDemo/debug/WXATLoggerPlugin.m
@@ -0,0 +1,54 @@
+/**
+ * Created by Weex.
+ * Copyright (c) 2016, Alibaba, Inc. All rights reserved.
+ *
+ * This source code is licensed under the Apache Licence 2.0.
+ * For the full copyright and license information,please view the LICENSE file in the root directory of this source tree.
+ */
+
+#import "WXATLoggerPlugin.h"
+#import <WeexSDK/WXSDKEngine.h>
+
+@implementation WXATLoggerPlugin
+
+- (void)pluginDidLoadWithArgs:(NSArray *)args
+{
+
+}
+
+- (void)pluginWillOpenInContainer:(UIViewController *)container withArg:(NSArray *)args
+{
+ NSURL *URL = [NSURL URLWithString:@"http://127.0.0.1:8687/launchDebugger"];
+ NSURLRequest *request = [NSURLRequest requestWithURL:URL];
+
+ NSURLSession *session = [NSURLSession sharedSession];
+ NSURLSessionDataTask *task = [session dataTaskWithRequest:request
+ completionHandler:
+ ^(NSData *data, NSURLResponse *response, NSError *error) {
+ // ...
+ }];
+
+ [task resume];
+
+ dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
+ [WXSDKEngine connectDebugServer:@"ws://127.0.0.1:8687/debugger/0/renderer"];
+ });
+}
+
+- (void)pluginWillClose
+{
+
+}
+
+- (void)pluginDidUnload
+{
+
+}
+
+- (CGRect)wantReactArea
+{
+ return CGRectZero;
+}
+
+
+@end
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/185fe55c/ios/playground/WeexDemo/debug/WXATViewHierarchyPlugin.h
----------------------------------------------------------------------
diff --git a/ios/playground/WeexDemo/debug/WXATViewHierarchyPlugin.h b/ios/playground/WeexDemo/debug/WXATViewHierarchyPlugin.h
new file mode 100644
index 0000000..ccc3523
--- /dev/null
+++ b/ios/playground/WeexDemo/debug/WXATViewHierarchyPlugin.h
@@ -0,0 +1,14 @@
+/**
+ * Created by Weex.
+ * Copyright (c) 2016, Alibaba, Inc. All rights reserved.
+ *
+ * This source code is licensed under the Apache Licence 2.0.
+ * For the full copyright and license information,please view the LICENSE file in the root directory of this source tree.
+ */
+
+//#import <Foundation/Foundation.h>
+//#import <ATSDK/ATPluginProtocol.h>
+//
+//@interface WXATViewHierarchyPlugin : NSObject<ATPluginProtocol>
+//
+//@end
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/185fe55c/ios/playground/WeexDemo/debug/WXATViewHierarchyPlugin.m
----------------------------------------------------------------------
diff --git a/ios/playground/WeexDemo/debug/WXATViewHierarchyPlugin.m b/ios/playground/WeexDemo/debug/WXATViewHierarchyPlugin.m
new file mode 100644
index 0000000..fe3c29f
--- /dev/null
+++ b/ios/playground/WeexDemo/debug/WXATViewHierarchyPlugin.m
@@ -0,0 +1,43 @@
+/**
+ * Created by Weex.
+ * Copyright (c) 2016, Alibaba, Inc. All rights reserved.
+ *
+ * This source code is licensed under the Apache Licence 2.0.
+ * For the full copyright and license information,please view the LICENSE file in the root directory of this source tree.
+ */
+
+//#import "WXATViewHierarchyPlugin.h"
+//#import <WeexSDK/WXViewHierarchy.h>
+//
+//@implementation WXATViewHierarchyPlugin
+//{
+// WXViewHierarchy *_hierarchy;
+//}
+//
+//- (void)pluginDidLoadWithArgs:(NSArray *)args
+//{
+// _hierarchy = [[WXViewHierarchy alloc] init];
+// _hierarchy.hidden = YES;
+//}
+//
+//- (void)pluginWillOpenInContainer:(UIViewController *)container withArg:(NSArray *)args
+//{
+// [_hierarchy show];
+//}
+//
+//- (void)pluginWillClose
+//{
+// [_hierarchy hide];
+//}
+//
+//- (void)pluginDidUnload
+//{
+// _hierarchy = nil;
+//}
+//
+//- (CGRect)wantReactArea
+//{
+// return CGRectZero;
+//}
+//
+//@end
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/185fe55c/ios/playground/WeexDemo/extend/component/WXSelectComponent.h
----------------------------------------------------------------------
diff --git a/ios/playground/WeexDemo/extend/component/WXSelectComponent.h b/ios/playground/WeexDemo/extend/component/WXSelectComponent.h
new file mode 100644
index 0000000..7f8616c
--- /dev/null
+++ b/ios/playground/WeexDemo/extend/component/WXSelectComponent.h
@@ -0,0 +1,14 @@
+/**
+ * Created by Weex.
+ * Copyright (c) 2016, Alibaba, Inc. All rights reserved.
+ *
+ * This source code is licensed under the Apache Licence 2.0.
+ * For the full copyright and license information,please view the LICENSE file in the root directory of this source tree.
+ */
+
+#import <UIKit/UIKit.h>
+#import <WeexSDK/WXComponent.h>
+
+@interface WXSelectComponent : WXComponent <UIPickerViewDataSource, UIPickerViewDelegate>
+
+@end
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/185fe55c/ios/playground/WeexDemo/extend/component/WXSelectComponent.m
----------------------------------------------------------------------
diff --git a/ios/playground/WeexDemo/extend/component/WXSelectComponent.m b/ios/playground/WeexDemo/extend/component/WXSelectComponent.m
new file mode 100644
index 0000000..9ec52e9
--- /dev/null
+++ b/ios/playground/WeexDemo/extend/component/WXSelectComponent.m
@@ -0,0 +1,138 @@
+/**
+ * Created by Weex.
+ * Copyright (c) 2016, Alibaba, Inc. All rights reserved.
+ *
+ * This source code is licensed under the Apache Licence 2.0.
+ * For the full copyright and license information,please view the LICENSE file in the root directory of this source tree.
+ */
+
+#import "WXSelectComponent.h"
+#import "WXUtility.h"
+#import "WXComponent+Events.h"
+
+@interface WXSelectComponent()
+
+@property (nonatomic, strong) UITapGestureRecognizer *tap;
+@property (nonatomic, strong) UIPickerView *pickerView;
+@property (nonatomic, strong) NSArray *options;
+@property (nonatomic, assign) NSInteger selectIndex;
+@property (nonatomic, assign) BOOL disabled;
+
+@end
+
+@implementation WXSelectComponent
+- (instancetype)initWithRef:(NSString *)ref type:(NSString *)type styles:(NSDictionary *)styles attributes:(NSDictionary *)attributes events:(NSArray *)events weexInstance:(WXSDKInstance *)weexInstance
+{
+ self = [super initWithRef:ref type:type styles:styles attributes:attributes events:events weexInstance:weexInstance];
+ if (self) {
+ _tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(popupPicker)];
+ _tap.delegate = self;
+
+ if (attributes[@"options"]) {
+ _options = [attributes[@"options"] componentsSeparatedByString:@","];
+ }
+ if (attributes[@"selectIndex"]) {
+ _selectIndex = [attributes[@"selectIndex"] integerValue];
+ }
+ if (attributes[@"disabled"]) {
+ _disabled = [attributes[@"disabled"] boolValue];
+ }
+
+ if (styles[@""]) {
+ // setting style when init
+ }
+
+ UIWindow * window = [UIApplication sharedApplication].keyWindow;
+ CGSize windowSize = window.rootViewController.view.frame.size;
+ CGFloat pickerViewHeight = 200.0;
+ _pickerView = [[UIPickerView alloc] initWithFrame:CGRectMake(0, 0, windowSize.width, pickerViewHeight)];
+ [_pickerView setBackgroundColor:[UIColor redColor]];
+ _pickerView.dataSource = self;
+ _pickerView.delegate = self;
+ }
+
+ return self;
+}
+
+- (void)viewDidLoad
+{
+ [_pickerView selectRow:_selectIndex inComponent:0 animated:YES];
+ // show selected item
+ _pickerView.showsSelectionIndicator=YES;
+}
+
+- (void)viewWillUnload
+{
+}
+
+- (UIView *)loadView {
+
+ return _pickerView;
+}
+
+- (void)updateAttributes:(NSDictionary *)attributes
+{
+ if (attributes[@"options"]) {
+ _options = [attributes[@"options"] componentsSeparatedByString:@","];
+ }
+ if (attributes[@"selectIndex"]) {
+ _selectIndex = [attributes[@"selectIndex"] integerValue];
+ }
+ if (attributes[@"disabled"]) {
+ _disabled = [attributes[@"disabled"] boolValue];
+ }
+ [_pickerView reloadAllComponents];
+}
+
+- (void)updateStyles:(NSDictionary *)styles
+{
+
+}
+
+#pragma mark - action
+- (void)popupPicker
+{
+ if (_disabled)
+ return;
+
+ [self fireEvent:@"focus" params:nil];
+}
+
+- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer
+{
+ if (gestureRecognizer == _tap)
+ return YES;
+
+ if (otherGestureRecognizer == _tap)
+ return YES;
+
+ return [super gestureRecognizer:gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:otherGestureRecognizer];
+}
+
+#pragma mark - pickerView delegate
+- (NSInteger)numberOfComponentsInPickerView:(UIPickerView *)pickerView {
+ return 1;
+}
+
+
+- (NSInteger)pickerView:(UIPickerView *)pickerView numberOfRowsInComponent:(NSInteger)component {
+ return [_options count];
+}
+
+- (CGFloat)pickerView:(UIPickerView *)pickerView widthForComponent:(NSInteger)component {
+
+ return self.calculatedFrame.size.width;
+}
+
+- (void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component
+{
+ [self fireEvent:@"change" params:@{@"index":[NSNumber numberWithInteger:row],
+ @"value":[_options objectAtIndex:row]}];
+}
+
+-(NSString*)pickerView:(UIPickerView *)pickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component
+{
+ return [_options objectAtIndex:row];
+}
+
+@end
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/185fe55c/ios/playground/WeexDemo/extend/handler/WXImgLoaderDefaultImpl.h
----------------------------------------------------------------------
diff --git a/ios/playground/WeexDemo/extend/handler/WXImgLoaderDefaultImpl.h b/ios/playground/WeexDemo/extend/handler/WXImgLoaderDefaultImpl.h
new file mode 100644
index 0000000..3d420d4
--- /dev/null
+++ b/ios/playground/WeexDemo/extend/handler/WXImgLoaderDefaultImpl.h
@@ -0,0 +1,13 @@
+/**
+ * Created by Weex.
+ * Copyright (c) 2016, Alibaba, Inc. All rights reserved.
+ *
+ * This source code is licensed under the Apache Licence 2.0.
+ * For the full copyright and license information,please view the LICENSE file in the root directory of this source tree.
+ */
+
+#import <Foundation/Foundation.h>
+#import "WXImgLoaderProtocol.h"
+
+@interface WXImgLoaderDefaultImpl : NSObject<WXImgLoaderProtocol, WXModuleProtocol>
+@end
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/185fe55c/ios/playground/WeexDemo/extend/handler/WXImgLoaderDefaultImpl.m
----------------------------------------------------------------------
diff --git a/ios/playground/WeexDemo/extend/handler/WXImgLoaderDefaultImpl.m b/ios/playground/WeexDemo/extend/handler/WXImgLoaderDefaultImpl.m
new file mode 100644
index 0000000..37c1ec3
--- /dev/null
+++ b/ios/playground/WeexDemo/extend/handler/WXImgLoaderDefaultImpl.m
@@ -0,0 +1,52 @@
+/**
+ * Created by Weex.
+ * Copyright (c) 2016, Alibaba, Inc. All rights reserved.
+ *
+ * This source code is licensed under the Apache Licence 2.0.
+ * For the full copyright and license information,please view the LICENSE file in the root directory of this source tree.
+ */
+
+#import "WXImgLoaderDefaultImpl.h"
+#import <SDWebImage/UIImageView+WebCache.h>
+
+#define MIN_IMAGE_WIDTH 36
+#define MIN_IMAGE_HEIGHT 36
+
+#if OS_OBJECT_USE_OBJC
+#undef WXDispatchQueueRelease
+#undef WXDispatchQueueSetterSementics
+#define WXDispatchQueueRelease(q)
+#define WXDispatchQueueSetterSementics strong
+#else
+#undef WXDispatchQueueRelease
+#undef WXDispatchQueueSetterSementics
+#define WXDispatchQueueRelease(q) (dispatch_release(q))
+#define WXDispatchQueueSetterSementics assign
+#endif
+
+@interface WXImgLoaderDefaultImpl()
+
+@property (WXDispatchQueueSetterSementics, nonatomic) dispatch_queue_t ioQueue;
+
+@end
+
+@implementation WXImgLoaderDefaultImpl
+
+#pragma mark -
+#pragma mark WXImgLoaderProtocol
+
+- (id<WXImageOperationProtocol>)downloadImageWithURL:(NSString *)url imageFrame:(CGRect)imageFrame userInfo:(NSDictionary *)userInfo completed:(void(^)(UIImage *image, NSError *error, BOOL finished))completedBlock
+{
+ if ([url hasPrefix:@"//"]) {
+ url = [@"http:" stringByAppendingString:url];
+ }
+ return (id<WXImageOperationProtocol>)[[SDWebImageManager sharedManager] downloadImageWithURL:[NSURL URLWithString:url] options:0 progress:^(NSInteger receivedSize, NSInteger expectedSize) {
+
+ } completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, BOOL finished, NSURL *imageURL) {
+ if (completedBlock) {
+ completedBlock(image, error, finished);
+ }
+ }];
+}
+
+@end
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/185fe55c/ios/playground/WeexDemo/extend/module/WXEventModule.h
----------------------------------------------------------------------
diff --git a/ios/playground/WeexDemo/extend/module/WXEventModule.h b/ios/playground/WeexDemo/extend/module/WXEventModule.h
new file mode 100644
index 0000000..790a187
--- /dev/null
+++ b/ios/playground/WeexDemo/extend/module/WXEventModule.h
@@ -0,0 +1,15 @@
+/**
+ * Created by Weex.
+ * Copyright (c) 2016, Alibaba, Inc. All rights reserved.
+ *
+ * This source code is licensed under the Apache Licence 2.0.
+ * For the full copyright and license information,please view the LICENSE file in the root directory of this source tree.
+ */
+
+#import <Foundation/Foundation.h>
+#import <WeexSDK/WXEventModuleProtocol.h>
+#import <WeexSDK/WXModuleProtocol.h>
+
+@interface WXEventModule : NSObject <WXEventModuleProtocol, WXModuleProtocol>
+
+@end
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/185fe55c/ios/playground/WeexDemo/extend/module/WXEventModule.m
----------------------------------------------------------------------
diff --git a/ios/playground/WeexDemo/extend/module/WXEventModule.m b/ios/playground/WeexDemo/extend/module/WXEventModule.m
new file mode 100644
index 0000000..061ec5a
--- /dev/null
+++ b/ios/playground/WeexDemo/extend/module/WXEventModule.m
@@ -0,0 +1,36 @@
+/**
+ * Created by Weex.
+ * Copyright (c) 2016, Alibaba, Inc. All rights reserved.
+ *
+ * This source code is licensed under the Apache Licence 2.0.
+ * For the full copyright and license information,please view the LICENSE file in the root directory of this source tree.
+ */
+
+#import "WXEventModule.h"
+#import "WXDemoViewController.h"
+#import <WeexSDK/WXBaseViewController.h>
+
+@implementation WXEventModule
+
+@synthesize weexInstance;
+
+WX_EXPORT_METHOD(@selector(openURL:))
+
+- (void)openURL:(NSString *)url
+{
+ NSString *newURL = url;
+ if ([url hasPrefix:@"//"]) {
+ newURL = [NSString stringWithFormat:@"http:%@", url];
+ } else if (![url hasPrefix:@"http"]) {
+ // relative path
+ newURL = [NSURL URLWithString:url relativeToURL:weexInstance.scriptURL].absoluteString;
+ }
+
+ UIViewController *controller = [[WXDemoViewController alloc] init];
+ ((WXDemoViewController *)controller).url = [NSURL URLWithString:newURL];
+
+ [[weexInstance.viewController navigationController] pushViewController:controller animated:YES];
+}
+
+@end
+
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/185fe55c/ios/playground/WeexDemo/main.m
----------------------------------------------------------------------
diff --git a/ios/playground/WeexDemo/main.m b/ios/playground/WeexDemo/main.m
new file mode 100644
index 0000000..6eb9b2a
--- /dev/null
+++ b/ios/playground/WeexDemo/main.m
@@ -0,0 +1,16 @@
+/**
+ * Created by Weex.
+ * Copyright (c) 2016, Alibaba, Inc. All rights reserved.
+ *
+ * This source code is licensed under the Apache Licence 2.0.
+ * For the full copyright and license information,please view the LICENSE file in the root directory of this source tree.
+ */
+
+#import <UIKit/UIKit.h>
+#import "AppDelegate.h"
+
+int main(int argc, char * argv[]) {
+ @autoreleasepool {
+ return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/185fe55c/ios/playground/WeexDemo/weex-icon.png
----------------------------------------------------------------------
diff --git a/ios/playground/WeexDemo/weex-icon.png b/ios/playground/WeexDemo/weex-icon.png
new file mode 100644
index 0000000..396b78f
Binary files /dev/null and b/ios/playground/WeexDemo/weex-icon.png differ
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/185fe55c/ios/playground/WeexDemoTests/Info.plist
----------------------------------------------------------------------
diff --git a/ios/playground/WeexDemoTests/Info.plist b/ios/playground/WeexDemoTests/Info.plist
new file mode 100644
index 0000000..ba72822
--- /dev/null
+++ b/ios/playground/WeexDemoTests/Info.plist
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>CFBundleDevelopmentRegion</key>
+ <string>en</string>
+ <key>CFBundleExecutable</key>
+ <string>$(EXECUTABLE_NAME)</string>
+ <key>CFBundleIdentifier</key>
+ <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
+ <key>CFBundleInfoDictionaryVersion</key>
+ <string>6.0</string>
+ <key>CFBundleName</key>
+ <string>$(PRODUCT_NAME)</string>
+ <key>CFBundlePackageType</key>
+ <string>BNDL</string>
+ <key>CFBundleShortVersionString</key>
+ <string>1.0</string>
+ <key>CFBundleSignature</key>
+ <string>????</string>
+ <key>CFBundleVersion</key>
+ <string>1</string>
+</dict>
+</plist>
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/185fe55c/ios/playground/WeexDemoTests/WeexDemoTests.m
----------------------------------------------------------------------
diff --git a/ios/playground/WeexDemoTests/WeexDemoTests.m b/ios/playground/WeexDemoTests/WeexDemoTests.m
new file mode 100644
index 0000000..0596cb1
--- /dev/null
+++ b/ios/playground/WeexDemoTests/WeexDemoTests.m
@@ -0,0 +1,39 @@
+/**
+ * Created by Weex.
+ * Copyright (c) 2016, Alibaba, Inc. All rights reserved.
+ *
+ * This source code is licensed under the Apache Licence 2.0.
+ * For the full copyright and license information,please view the LICENSE file in the root directory of this source tree.
+ */
+
+#import <XCTest/XCTest.h>
+
+@interface WeexDemoTests : XCTestCase
+
+@end
+
+@implementation WeexDemoTests
+
+- (void)setUp {
+ [super setUp];
+ // Put setup code here. This method is called before the invocation of each test method in the class.
+}
+
+- (void)tearDown {
+ // Put teardown code here. This method is called after the invocation of each test method in the class.
+ [super tearDown];
+}
+
+- (void)testExample {
+ // This is an example of a functional test case.
+ // Use XCTAssert and related functions to verify your tests produce the correct results.
+}
+
+- (void)testPerformanceExample {
+ // This is an example of a performance test case.
+ [self measureBlock:^{
+ // Put the code you want to measure the time of here.
+ }];
+}
+
+@end
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/185fe55c/ios/playground/WeexUITestDemo-Info.plist
----------------------------------------------------------------------
diff --git a/ios/playground/WeexUITestDemo-Info.plist b/ios/playground/WeexUITestDemo-Info.plist
new file mode 100644
index 0000000..a249bfe
--- /dev/null
+++ b/ios/playground/WeexUITestDemo-Info.plist
@@ -0,0 +1,52 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>CFBundleDevelopmentRegion</key>
+ <string>en</string>
+ <key>CFBundleExecutable</key>
+ <string>$(EXECUTABLE_NAME)</string>
+ <key>CFBundleIdentifier</key>
+ <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
+ <key>CFBundleInfoDictionaryVersion</key>
+ <string>6.0</string>
+ <key>CFBundleName</key>
+ <string>$(PRODUCT_NAME)</string>
+ <key>CFBundlePackageType</key>
+ <string>APPL</string>
+ <key>CFBundleShortVersionString</key>
+ <string>1.0</string>
+ <key>CFBundleSignature</key>
+ <string>????</string>
+ <key>CFBundleVersion</key>
+ <string>1</string>
+ <key>LSRequiresIPhoneOS</key>
+ <true/>
+ <key>NSAppTransportSecurity</key>
+ <dict>
+ <key>NSAllowsArbitraryLoads</key>
+ <true/>
+ </dict>
+ <key>UILaunchStoryboardName</key>
+ <string>LaunchScreen</string>
+ <key>UIRequiredDeviceCapabilities</key>
+ <array>
+ <string>armv7</string>
+ </array>
+ <key>UIStatusBarStyle</key>
+ <string>UIStatusBarStyleLightContent</string>
+ <key>UISupportedInterfaceOrientations</key>
+ <array>
+ <string>UIInterfaceOrientationPortrait</string>
+ </array>
+ <key>UISupportedInterfaceOrientations~ipad</key>
+ <array>
+ <string>UIInterfaceOrientationPortrait</string>
+ <string>UIInterfaceOrientationPortraitUpsideDown</string>
+ <string>UIInterfaceOrientationLandscapeLeft</string>
+ <string>UIInterfaceOrientationLandscapeRight</string>
+ </array>
+ <key>UIViewControllerBasedStatusBarAppearance</key>
+ <false/>
+</dict>
+</plist>
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/185fe55c/ios/playground/WeexUITestDemoUITests/Info.plist
----------------------------------------------------------------------
diff --git a/ios/playground/WeexUITestDemoUITests/Info.plist b/ios/playground/WeexUITestDemoUITests/Info.plist
new file mode 100644
index 0000000..ba72822
--- /dev/null
+++ b/ios/playground/WeexUITestDemoUITests/Info.plist
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>CFBundleDevelopmentRegion</key>
+ <string>en</string>
+ <key>CFBundleExecutable</key>
+ <string>$(EXECUTABLE_NAME)</string>
+ <key>CFBundleIdentifier</key>
+ <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
+ <key>CFBundleInfoDictionaryVersion</key>
+ <string>6.0</string>
+ <key>CFBundleName</key>
+ <string>$(PRODUCT_NAME)</string>
+ <key>CFBundlePackageType</key>
+ <string>BNDL</string>
+ <key>CFBundleShortVersionString</key>
+ <string>1.0</string>
+ <key>CFBundleSignature</key>
+ <string>????</string>
+ <key>CFBundleVersion</key>
+ <string>1</string>
+</dict>
+</plist>
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/185fe55c/ios/playground/WeexUITestDemoUITests/WeexUITestDemoUITests.m
----------------------------------------------------------------------
diff --git a/ios/playground/WeexUITestDemoUITests/WeexUITestDemoUITests.m b/ios/playground/WeexUITestDemoUITests/WeexUITestDemoUITests.m
new file mode 100644
index 0000000..e5be497
--- /dev/null
+++ b/ios/playground/WeexUITestDemoUITests/WeexUITestDemoUITests.m
@@ -0,0 +1,40 @@
+/**
+ * Created by Weex.
+ * Copyright (c) 2016, Alibaba, Inc. All rights reserved.
+ *
+ * This source code is licensed under the Apache Licence 2.0.
+ * For the full copyright and license information,please view the LICENSE file in the root directory of this source tree.
+ */
+
+#import <XCTest/XCTest.h>
+
+@interface WeexUITestDemoUITests : XCTestCase
+
+@end
+
+@implementation WeexUITestDemoUITests
+
+- (void)setUp {
+ [super setUp];
+
+ // Put setup code here. This method is called before the invocation of each test method in the class.
+
+ // In UI tests it is usually best to stop immediately when a failure occurs.
+ self.continueAfterFailure = NO;
+ // UI tests must launch the application that they test. Doing this in setup will make sure it happens for each test method.
+ [[[XCUIApplication alloc] init] launch];
+
+ // In UI tests it\u2019s important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this.
+}
+
+- (void)tearDown {
+ // Put teardown code here. This method is called after the invocation of each test method in the class.
+ [super tearDown];
+}
+
+- (void)testExample {
+ // Use recording to get started writing UI tests.
+ // Use XCTAssert and related functions to verify your tests produce the correct results.
+}
+
+@end
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/185fe55c/ios/playground/weex.png
----------------------------------------------------------------------
diff --git a/ios/playground/weex.png b/ios/playground/weex.png
new file mode 100644
index 0000000..e8f8e52
Binary files /dev/null and b/ios/playground/weex.png differ
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/185fe55c/ios/playground/weex@2x.png
----------------------------------------------------------------------
diff --git a/ios/playground/weex@2x.png b/ios/playground/weex@2x.png
new file mode 100644
index 0000000..0b7542f
Binary files /dev/null and b/ios/playground/weex@2x.png differ
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/185fe55c/ios/sdk/LICENSE
----------------------------------------------------------------------
diff --git a/ios/sdk/LICENSE b/ios/sdk/LICENSE
new file mode 100755
index 0000000..cfc27db
--- /dev/null
+++ b/ios/sdk/LICENSE
@@ -0,0 +1,202 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright 2016 Alibaba Group
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/185fe55c/ios/sdk/NOTICE
----------------------------------------------------------------------
diff --git a/ios/sdk/NOTICE b/ios/sdk/NOTICE
new file mode 100755
index 0000000..8423281
--- /dev/null
+++ b/ios/sdk/NOTICE
@@ -0,0 +1,13 @@
+Weex Sdk iOS
+Copyright 2016 Alibaba Group
+
+This product includes software developed at Alibaba Group. (http://www.alibabagroup.com)
+
+This product contains software css-layout(https://github.com/facebook/css-layout) developed
+by Facebook Inc., licensed under the BSD License.
+
+This product contains software React Native(https://github.com/facebook/react-native) developed
+by Facebook Inc., licensed under the BSD License.
+
+This product contains software SRWebSocket (https://github.com/facebook/SocketRocket)by Facebook Inc., licensed under the Apache License, Version 2.0.
+
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/185fe55c/ios/sdk/README.md
----------------------------------------------------------------------
diff --git a/ios/sdk/README.md b/ios/sdk/README.md
new file mode 100644
index 0000000..e69de29
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/185fe55c/ios/sdk/WeexSDK.podspec
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK.podspec b/ios/sdk/WeexSDK.podspec
new file mode 100644
index 0000000..4e53655
--- /dev/null
+++ b/ios/sdk/WeexSDK.podspec
@@ -0,0 +1,33 @@
+# coding: utf-8
+Pod::Spec.new do |s|
+
+
+ s.name = "WeexSDK"
+ s.version = "0.6.0"
+ s.summary = "WeexSDK Source ."
+
+ s.description = <<-DESC
+ WeexSDK Source description
+ DESC
+
+ s.homepage = "https://github.com/alibaba/weex"
+ s.license = {
+ :type => 'Copyright',
+ :text => <<-LICENSE
+ Alibaba-INC copyright
+ LICENSE
+ }
+
+ s.platform = :ios
+ s.ios.deployment_target = '7.0'
+ s.source = { :path => '.' }
+ s.source_files = 'WeexSDK/Sources/**/*.{h,m,mm,c}'
+ s.resources = 'WeexSDK/Resources/weex_config.plist', 'WeexSDK/Resources/main.js'
+
+ s.requires_arc = true
+ s.prefix_header_file = 'WeexSDK/Sources/Supporting Files/WeexSDK-Prefix.pch'
+
+# s.xcconfig = { "GCC_PREPROCESSOR_DEFINITIONS" => '$(inherited) DEBUG=1' }
+ s.frameworks = 'AVKit'
+ s.dependency 'SocketRocket'
+end