Skip to content
This repository has been archived by the owner on Jun 3, 2021. It is now read-only.

Commit

Permalink
Merge pull request #2849 from Txink/txink-swift-adapter
Browse files Browse the repository at this point in the history
[iOS] WeexSDK Swift Adapt
  • Loading branch information
wqyfavor committed Aug 29, 2019
2 parents a5698e3 + 9e5fc1f commit 6d1cb9b
Show file tree
Hide file tree
Showing 85 changed files with 521 additions and 306 deletions.
32 changes: 22 additions & 10 deletions ios/sdk/WeexSDK.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,6 @@
74A4BA9B1CB3BAA100195969 /* WXThreadSafeMutableDictionary.m in Sources */ = {isa = PBXBuildFile; fileRef = 74A4BA991CB3BAA100195969 /* WXThreadSafeMutableDictionary.m */; };
74A4BA9E1CB3C0A100195969 /* WXHandlerFactory.h in Headers */ = {isa = PBXBuildFile; fileRef = 74A4BA9C1CB3C0A100195969 /* WXHandlerFactory.h */; settings = {ATTRIBUTES = (Public, ); }; };
74A4BA9F1CB3C0A100195969 /* WXHandlerFactory.m in Sources */ = {isa = PBXBuildFile; fileRef = 74A4BA9D1CB3C0A100195969 /* WXHandlerFactory.m */; };
74A4BAA61CB4F98300195969 /* WXStreamModule.h in Headers */ = {isa = PBXBuildFile; fileRef = 74A4BAA41CB4F98300195969 /* WXStreamModule.h */; settings = {ATTRIBUTES = (Public, ); }; };
74A4BAA71CB4F98300195969 /* WXStreamModule.m in Sources */ = {isa = PBXBuildFile; fileRef = 74A4BAA51CB4F98300195969 /* WXStreamModule.m */; };
74AD99841D5B0E59008F0336 /* WXPolyfillSet.h in Headers */ = {isa = PBXBuildFile; fileRef = 74AD99821D5B0E59008F0336 /* WXPolyfillSet.h */; };
74AD99851D5B0E59008F0336 /* WXPolyfillSet.m in Sources */ = {isa = PBXBuildFile; fileRef = 74AD99831D5B0E59008F0336 /* WXPolyfillSet.m */; };
Expand Down Expand Up @@ -613,7 +612,6 @@
D334510D1D3E19B80083598A /* WXCanvasModule.m in Sources */ = {isa = PBXBuildFile; fileRef = D334510B1D3E19B80083598A /* WXCanvasModule.m */; };
D362F94F1C83EDA20003F546 /* WXWebViewModule.h in Headers */ = {isa = PBXBuildFile; fileRef = D362F94D1C83EDA20003F546 /* WXWebViewModule.h */; };
D362F9501C83EDA20003F546 /* WXWebViewModule.m in Sources */ = {isa = PBXBuildFile; fileRef = D362F94E1C83EDA20003F546 /* WXWebViewModule.m */; };
D3FC0DF71C508B2A002B9E31 /* WXTimerModule.h in Headers */ = {isa = PBXBuildFile; fileRef = D3FC0DF51C508B2A002B9E31 /* WXTimerModule.h */; };
D3FC0DF81C508B2A002B9E31 /* WXTimerModule.m in Sources */ = {isa = PBXBuildFile; fileRef = D3FC0DF61C508B2A002B9E31 /* WXTimerModule.m */; };
D735F1B022D761F800B53CDF /* log_utils.h in Headers */ = {isa = PBXBuildFile; fileRef = D735F1AB22D761F800B53CDF /* log_utils.h */; };
D735F1B122D761F800B53CDF /* log_utils.h in Headers */ = {isa = PBXBuildFile; fileRef = D735F1AB22D761F800B53CDF /* log_utils.h */; };
Expand Down Expand Up @@ -888,6 +886,8 @@
ED053501207F4DEB007B4568 /* JSContext+Weex.h in Headers */ = {isa = PBXBuildFile; fileRef = ED0534FE207F4DEB007B4568 /* JSContext+Weex.h */; settings = {ATTRIBUTES = (Public, ); }; };
ED053502207F4DEB007B4568 /* JSContext+Weex.m in Sources */ = {isa = PBXBuildFile; fileRef = ED0534FF207F4DEB007B4568 /* JSContext+Weex.m */; };
ED053503207F4DEB007B4568 /* JSContext+Weex.m in Sources */ = {isa = PBXBuildFile; fileRef = ED0534FF207F4DEB007B4568 /* JSContext+Weex.m */; };
F75C58EB2313C03C002FFF94 /* WXTimerModule.h in Headers */ = {isa = PBXBuildFile; fileRef = D3FC0DF51C508B2A002B9E31 /* WXTimerModule.h */; };
F75C591C2313C1FC002FFF94 /* WXStreamModule.h in Headers */ = {isa = PBXBuildFile; fileRef = 74A4BAA41CB4F98300195969 /* WXStreamModule.h */; settings = {ATTRIBUTES = (Public, ); }; };
/* End PBXBuildFile section */

/* Begin PBXContainerItemProxy section */
Expand Down Expand Up @@ -2410,8 +2410,8 @@
isa = PBXHeadersBuildPhase;
buildActionMask = 2147483647;
files = (
F75C591C2313C1FC002FFF94 /* WXStreamModule.h in Headers */,
74A4BA9E1CB3C0A100195969 /* WXHandlerFactory.h in Headers */,
74A4BAA61CB4F98300195969 /* WXStreamModule.h in Headers */,
59A583081CF5B2FD0081FD3E /* WXNavigationDefaultImpl.h in Headers */,
2A837AB61CD9DE9200AEDF03 /* WXRefreshComponent.h in Headers */,
2A919DA61E321F1F006EB6B5 /* WXBridgeMethod.h in Headers */,
Expand Down Expand Up @@ -2466,7 +2466,6 @@
DC6836E61EBB12B200AD2D84 /* WXConfigCenterProtocol.h in Headers */,
DC7764941F3C2CA300B5727E /* WXRecyclerDragController.h in Headers */,
77788B712229252D000D5102 /* render_page_custom.h in Headers */,
74A4BAA61CB4F98300195969 /* WXStreamModule.h in Headers */,
B8D66CB321255730003960BD /* make_copyable.h in Headers */,
740451EA1E14BB26004157CB /* WXServiceFactory.h in Headers */,
744BEA591D0520F300452B5D /* WXComponent+Layout.h in Headers */,
Expand All @@ -2484,6 +2483,7 @@
591DD3321D23AD5800BE8709 /* WXErrorView.h in Headers */,
B8D66C8D21255730003960BD /* render_creator.h in Headers */,
17C74F0B2072145100AB4CAB /* WXAnalyzerCenter+Transfer.h in Headers */,
F75C58EB2313C03C002FFF94 /* WXTimerModule.h in Headers */,
D362F94F1C83EDA20003F546 /* WXWebViewModule.h in Headers */,
C4F012861E150307003378D0 /* WXWebSocketLoader.h in Headers */,
77D161381C02DE940010B15B /* WXBridgeManager.h in Headers */,
Expand Down Expand Up @@ -2552,7 +2552,6 @@
B8D66C5B21255730003960BD /* render_action_add_element.h in Headers */,
745B2D701E5A8E1E0092D38A /* WXSectionDataController.h in Headers */,
745B2D6E1E5A8E1E0092D38A /* WXRecyclerUpdateController.h in Headers */,
D3FC0DF71C508B2A002B9E31 /* WXTimerModule.h in Headers */,
D312CE3B1C730DEB00046D68 /* WXWebComponent.h in Headers */,
741081261CEDB4EC001BC6E5 /* WXComponent_internal.h in Headers */,
77E65A191C155F25008B8775 /* WXScrollerComponent.h in Headers */,
Expand Down Expand Up @@ -2992,11 +2991,14 @@
};
74C8963C1D2AC2210043B82A = {
CreatedOnToolsVersion = 8.0;
DevelopmentTeam = 5783442933;
DevelopmentTeamName = "Nanjing Taobao Software Co., Ltd.";
ProvisioningStyle = Manual;
ProvisioningStyle = Automatic;
};
77D160FC1C02DBE70010B15B = {
CreatedOnToolsVersion = 7.1.1;
DevelopmentTeam = 5783442933;
ProvisioningStyle = Automatic;
};
DCA445241EFA555400D0CFA8 = {
CreatedOnToolsVersion = 8.3.3;
Expand Down Expand Up @@ -3562,7 +3564,9 @@
CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES = NO;
CLANG_ANALYZER_NONNULL = YES;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
DEVELOPMENT_TEAM = "";
CODE_SIGN_IDENTITY = "iPhone Developer";
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = 5783442933;
HEADER_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/WeexSDK/Dependency",
Expand All @@ -3578,6 +3582,7 @@
OTHER_LDFLAGS = "-ObjC";
PRODUCT_BUNDLE_IDENTIFIER = com.taobao.weex.WeexSDKTests;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
};
name = Debug;
};
Expand All @@ -3587,7 +3592,9 @@
CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES = NO;
CLANG_ANALYZER_NONNULL = YES;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
DEVELOPMENT_TEAM = "";
CODE_SIGN_IDENTITY = "iPhone Developer";
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = 5783442933;
HEADER_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/WeexSDK/Dependency",
Expand All @@ -3603,6 +3610,7 @@
OTHER_LDFLAGS = "-ObjC";
PRODUCT_BUNDLE_IDENTIFIER = com.taobao.weex.WeexSDKTests;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
};
name = Release;
};
Expand Down Expand Up @@ -3735,9 +3743,10 @@
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = NO;
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "";
CODE_SIGN_STYLE = Automatic;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = "";
DEVELOPMENT_TEAM = 5783442933;
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
DYLIB_INSTALL_NAME_BASE = "@rpath";
Expand Down Expand Up @@ -3775,6 +3784,7 @@
PODS_ROOT = "";
PRODUCT_BUNDLE_IDENTIFIER = com.taobao.WeexSDK;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
SKIP_INSTALL = YES;
VALID_ARCHS = "arm64 armv7 x86_64 i386";
WARNING_CFLAGS = "";
Expand All @@ -3792,8 +3802,9 @@
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = NO;
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "";
CODE_SIGN_STYLE = Automatic;
DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = "";
DEVELOPMENT_TEAM = 5783442933;
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
DYLIB_INSTALL_NAME_BASE = "@rpath";
Expand Down Expand Up @@ -3831,6 +3842,7 @@
PODS_ROOT = "";
PRODUCT_BUNDLE_IDENTIFIER = com.taobao.WeexSDK;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
SKIP_INSTALL = YES;
VALID_ARCHS = "arm64 armv7 x86_64 i386";
WARNING_CFLAGS = "";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForRunning = "NO"
buildForProfiling = "NO"
buildForArchiving = "NO"
buildForAnalyzing = "NO">
Expand Down Expand Up @@ -39,6 +39,15 @@
</BuildableReference>
</TestableReference>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "74C8963C1D2AC2210043B82A"
BuildableName = "WeexSDKTests.xctest"
BlueprintName = "WeexSDKTests"
ReferencedContainer = "container:WeexSDK.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
Expand All @@ -52,15 +61,6 @@
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "74C8963C1D2AC2210043B82A"
BuildableName = "WeexSDKTests.xctest"
BlueprintName = "WeexSDKTests"
ReferencedContainer = "container:WeexSDK.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
Expand All @@ -70,15 +70,6 @@
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "74C8963C1D2AC2210043B82A"
BuildableName = "WeexSDKTests.xctest"
BlueprintName = "WeexSDKTests"
ReferencedContainer = "container:WeexSDK.xcodeproj">
</BuildableReference>
</MacroExpansion>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
Expand Down
6 changes: 5 additions & 1 deletion ios/sdk/WeexSDK/Sources/Bridge/JSContext+Weex.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,12 @@

#import <JavaScriptCore/JavaScriptCore.h>

NS_ASSUME_NONNULL_BEGIN

@interface JSContext (Weex)

@property (nonatomic, strong) NSString *instanceId;
@property (nonatomic, strong) NSString * _Nullable instanceId;

@end

NS_ASSUME_NONNULL_END
6 changes: 5 additions & 1 deletion ios/sdk/WeexSDK/Sources/Bridge/WXBridgeMethod.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@
*/

#import <Foundation/Foundation.h>

NS_ASSUME_NONNULL_BEGIN

@class WXSDKInstance;

@interface WXBridgeMethod : NSObject
Expand All @@ -27,10 +30,11 @@
@property (nonatomic, weak, readonly) WXSDKInstance *instance;

- (instancetype)initWithMethodName:(NSString *)methodName
arguments:(NSArray *)arguments
arguments:(NSArray * _Nullable)arguments
instance:(WXSDKInstance *)instance;

- (NSInvocation *)invocationWithTarget:(id)target selector:(SEL)selector;

@end

NS_ASSUME_NONNULL_END
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,12 @@
* under the License.
*/

#import "WXScrollerComponent.h"
#import <WeexSDK/WXScrollerComponent.h>

NS_ASSUME_NONNULL_BEGIN

@interface WXRecyclerComponent : WXScrollerComponent

@end

NS_ASSUME_NONNULL_END
6 changes: 5 additions & 1 deletion ios/sdk/WeexSDK/Sources/Component/WXAComponent.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,12 @@
* under the License.
*/

#import "WXComponent.h"
#import <WeexSDK/WXComponent.h>

NS_ASSUME_NONNULL_BEGIN

@interface WXAComponent : WXComponent <UIGestureRecognizerDelegate>

@end

NS_ASSUME_NONNULL_END
6 changes: 5 additions & 1 deletion ios/sdk/WeexSDK/Sources/Component/WXIndicatorComponent.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@
* under the License.
*/

#import "WXComponent.h"
#import <WeexSDK/WXComponent.h>

NS_ASSUME_NONNULL_BEGIN

typedef enum
{
Expand Down Expand Up @@ -50,3 +52,5 @@ typedef enum
@property (nonatomic, weak) id<WXIndicatorComponentDelegate> delegate;

@end

NS_ASSUME_NONNULL_END
6 changes: 5 additions & 1 deletion ios/sdk/WeexSDK/Sources/Component/WXListComponent.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,12 @@
* under the License.
*/

#import "WXScrollerComponent.h"
#import <WeexSDK/WXScrollerComponent.h>

NS_ASSUME_NONNULL_BEGIN

@interface WXListComponent : WXScrollerComponent

@end

NS_ASSUME_NONNULL_END
6 changes: 5 additions & 1 deletion ios/sdk/WeexSDK/Sources/Component/WXRefreshComponent.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@
* under the License.
*/

#import "WXComponent.h"
#import <WeexSDK/WXComponent.h>

NS_ASSUME_NONNULL_BEGIN

#define REFRESH_DISTANCE_Y @"dy"
#define REFRESH_PULLINGDISTANCE @"pullingDistance"
Expand All @@ -36,3 +38,5 @@
- (void)setDisplay;

@end

NS_ASSUME_NONNULL_END
6 changes: 5 additions & 1 deletion ios/sdk/WeexSDK/Sources/Component/WXRichText.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,15 @@
* under the License.
*/

#import "WXComponent.h"
#import <WeexSDK/WXComponent.h>

NS_ASSUME_NONNULL_BEGIN

@interface WXRichText : WXComponent<UITextViewDelegate>
- (void)addChildNode:(NSString *)type ref:(NSString*)ref styles:(NSDictionary*)styles attributes:(NSDictionary*)attributes toSuperNodeRef:(NSString *)superNodeRef;
- (void)updateChildNodeAttributes:(NSDictionary *)attributes ref:(NSString*)ref parentRef:(NSString*)parentRef;
- (void)updateChildNodeStyles:(NSDictionary *)styles ref:(NSString*)ref parentRef:(NSString*)parentRef;
- (void)removeChildNode:(NSString*)ref superNodeRef:(NSString *)superNodeRef;
@end

NS_ASSUME_NONNULL_END
9 changes: 6 additions & 3 deletions ios/sdk/WeexSDK/Sources/Component/WXScrollerComponent.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,16 @@
* under the License.
*/

#import "WXScrollerProtocol.h"
#import "WXComponent.h"
#import <WeexSDK/WXScrollerProtocol.h>
#import <WeexSDK/WXComponent.h>

NS_ASSUME_NONNULL_BEGIN

@interface WXScrollerComponent : WXComponent <WXScrollerProtocol, UIScrollViewDelegate>

@property (nonatomic, copy) void (^onScroll)(UIScrollView *scrollView);

@property (nonatomic, copy) void (^scrollEventListener)(WXScrollerComponent* sender, NSString* event, NSDictionary* params);
@property (nonatomic, copy) void (^scrollEventListener)(WXScrollerComponent* sender, NSString* event, NSDictionary* _Nullable params);

@property (nonatomic, assign) NSUInteger loadmoreretry;

Expand All @@ -36,3 +38,4 @@

@end

NS_ASSUME_NONNULL_END
4 changes: 4 additions & 0 deletions ios/sdk/WeexSDK/Sources/Controller/WXBaseViewController.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@

#import <UIKit/UIKit.h>

NS_ASSUME_NONNULL_BEGIN

/**
* The WXBaseViewController class provides the infrastructure for managing the weex view in your app. It is
* responsible for creating a weex instance or rendering the weex view, for observing the lifecycle of the
Expand All @@ -44,3 +46,5 @@
- (void)refreshWeex;

@end

NS_ASSUME_NONNULL_END
4 changes: 4 additions & 0 deletions ios/sdk/WeexSDK/Sources/Controller/WXRootViewController.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@

#import <UIKit/UIKit.h>

NS_ASSUME_NONNULL_BEGIN

/**
* The WXRootViewController class inherited from UINavigationController class which implements a specialized
* view controller that manages the navigation of hierarchical content. Developing an iOS application, you
Expand All @@ -42,3 +44,5 @@
- (id)initWithSourceURL:(NSURL *)sourceURL;

@end

NS_ASSUME_NONNULL_END
Loading

0 comments on commit 6d1cb9b

Please sign in to comment.