From 13163c67c0c0423d3a4a2bed18f9041fd43e4f9e Mon Sep 17 00:00:00 2001 From: wwwcg Date: Fri, 13 Sep 2024 21:38:31 +0800 Subject: [PATCH] feat(ios): modular header import support --- .../RenderPage/HippyDemoViewController.m | 8 +-- .../HippyDemo/turbomodule/TurboConfig.m | 1 - framework/examples/ios-demo/podfile | 5 +- .../base/bridge/HippyBridge+PerformanceAPI.mm | 2 +- .../ios/base/bridge/HippyBridge+Private.h | 2 +- framework/ios/base/bridge/HippyBridge.mm | 2 +- .../base/executors/HippyJSExecutor+Internal.h | 62 +++++++++++++++++++ .../ios/base/executors/HippyJSExecutor.h | 34 +--------- .../ios/base/executors/HippyJSExecutor.mm | 16 +++-- .../ios/module/turbo/HippyOCTurboModule.mm | 2 +- .../module/turbo/HippyTurboModuleManager.mm | 5 +- hippy.podspec | 26 +++++--- .../vfs/ios}/HippyBase64DataHandler.h | 0 .../vfs/ios}/HippyBase64DataHandler.mm | 0 .../vfs/ios}/HippyBridge+VFSLoader.h | 0 .../vfs/ios}/HippyBridge+VFSLoader.mm | 0 .../vfs/ios}/HippyFileHandler.h | 0 .../vfs/ios}/HippyFileHandler.mm | 0 .../component/text/HippyShadowText+Internal.h | 44 +++++++++++++ .../renderer/component/text/HippyShadowText.h | 12 +--- .../component/text/HippyShadowText.mm | 8 ++- .../component/text/HippyTextManager.mm | 5 -- tests/ios/HippyUIManagerTest.mm | 3 +- tests/ios/HippyUIViewCategoryTest.m | 4 +- 24 files changed, 159 insertions(+), 82 deletions(-) create mode 100644 framework/ios/base/executors/HippyJSExecutor+Internal.h rename {framework/ios/module/loader => modules/vfs/ios}/HippyBase64DataHandler.h (100%) rename {framework/ios/module/loader => modules/vfs/ios}/HippyBase64DataHandler.mm (100%) rename {framework/ios/module/loader => modules/vfs/ios}/HippyBridge+VFSLoader.h (100%) rename {framework/ios/module/loader => modules/vfs/ios}/HippyBridge+VFSLoader.mm (100%) rename {framework/ios/module/loader => modules/vfs/ios}/HippyFileHandler.h (100%) rename {framework/ios/module/loader => modules/vfs/ios}/HippyFileHandler.mm (100%) create mode 100644 renderer/native/ios/renderer/component/text/HippyShadowText+Internal.h diff --git a/framework/examples/ios-demo/HippyDemo/RenderPage/HippyDemoViewController.m b/framework/examples/ios-demo/HippyDemo/RenderPage/HippyDemoViewController.m index 45f9e2abeeb..a72feaec16d 100644 --- a/framework/examples/ios-demo/HippyDemo/RenderPage/HippyDemoViewController.m +++ b/framework/examples/ios-demo/HippyDemo/RenderPage/HippyDemoViewController.m @@ -23,13 +23,7 @@ #import "HippyDemoViewController.h" #import "UIViewController+Title.h" #import "HippyPageCache.h" - -#import -#import -#import -#import -#import -#import +@import hippy; @interface HippyDemoViewController () { diff --git a/framework/examples/ios-demo/HippyDemo/turbomodule/TurboConfig.m b/framework/examples/ios-demo/HippyDemo/turbomodule/TurboConfig.m index 088a7d96e81..5d621ffe6dc 100644 --- a/framework/examples/ios-demo/HippyDemo/turbomodule/TurboConfig.m +++ b/framework/examples/ios-demo/HippyDemo/turbomodule/TurboConfig.m @@ -22,7 +22,6 @@ #import "TurboConfig.h" #import "HippyDefines.h" -#import "HippyDefines.h" @interface TurboConfig () diff --git a/framework/examples/ios-demo/podfile b/framework/examples/ios-demo/podfile index 506f7b68ee6..132a71715c7 100644 --- a/framework/examples/ios-demo/podfile +++ b/framework/examples/ios-demo/podfile @@ -9,7 +9,10 @@ workspace 'HippyDemo.xcworkspace' target "HippyDemo" do platform :ios, '11.0' - pod 'hippy', :path => '../../..', :testspecs => ['UnitTests'] + # pod hippy, + # set modular_headers to true if you want to use modular import + # no need to set testspecs in your production app + pod 'hippy', :path => '../../..', :modular_headers => true, :testspecs => ['UnitTests'] end diff --git a/framework/ios/base/bridge/HippyBridge+PerformanceAPI.mm b/framework/ios/base/bridge/HippyBridge+PerformanceAPI.mm index e60b3adc90b..8f4b31925e2 100644 --- a/framework/ios/base/bridge/HippyBridge+PerformanceAPI.mm +++ b/framework/ios/base/bridge/HippyBridge+PerformanceAPI.mm @@ -21,7 +21,7 @@ */ #import "HippyBridge+PerformanceAPI.h" -#import "HippyJSExecutor.h" +#import "HippyJSExecutor+Internal.h" #import "HippyLog.h" #import "driver/scope.h" diff --git a/framework/ios/base/bridge/HippyBridge+Private.h b/framework/ios/base/bridge/HippyBridge+Private.h index 2d7e45ed910..2a333975c9c 100644 --- a/framework/ios/base/bridge/HippyBridge+Private.h +++ b/framework/ios/base/bridge/HippyBridge+Private.h @@ -24,7 +24,7 @@ #define HippyBridge_Private_h #import "HippyBridge.h" -#import "footstone/time_point.h" +#include "footstone/time_point.h" #include class VFSUriLoader; diff --git a/framework/ios/base/bridge/HippyBridge.mm b/framework/ios/base/bridge/HippyBridge.mm index f3d54496e60..1de3a8eecb1 100644 --- a/framework/ios/base/bridge/HippyBridge.mm +++ b/framework/ios/base/bridge/HippyBridge.mm @@ -27,7 +27,7 @@ #import "HippyEventDispatcher.h" #import "HippyFileHandler.h" #import "HippyJSEnginesMapper.h" -#import "HippyJSExecutor.h" +#import "HippyJSExecutor+Internal.h" #import "HippyKeyCommands.h" #import "HippyModuleData.h" #import "HippyModuleMethod.h" diff --git a/framework/ios/base/executors/HippyJSExecutor+Internal.h b/framework/ios/base/executors/HippyJSExecutor+Internal.h new file mode 100644 index 00000000000..6980216d3e2 --- /dev/null +++ b/framework/ios/base/executors/HippyJSExecutor+Internal.h @@ -0,0 +1,62 @@ +/*! + * iOS SDK + * + * Tencent is pleased to support the open source community by making + * Hippy available. + * + * Copyright (C) 2019 THL A29 Limited, a Tencent company. + * All rights reserved. + * + * 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. + */ + +#ifndef HippyJSExecutor_Internal_h +#define HippyJSExecutor_Internal_h + +#import "HippyJSExecutor.h" +#include + +namespace hippy { +inline namespace driver { +inline namespace napi { +class CtxValue; +} +class Scope; +} +inline namespace vfs { +class UriLoader; +} +} + + +@protocol HippyJSExecutorInternal + +/// hippy scope +@property (atomic, readonly) std::shared_ptr pScope; + +/// Set Uri loader +/// - Parameter uriLoader: vfs::UriLoader +- (void)setUriLoader:(std::weak_ptr)uriLoader; + +/// Get turbo object +/// - Parameter name: NSString +- (std::shared_ptr)JSTurboObjectWithName:(NSString *)name; + +@end + +@interface HippyJSExecutor (Internal) + +@end + + +#endif /* HippyJSExecutor_Internal_h */ diff --git a/framework/ios/base/executors/HippyJSExecutor.h b/framework/ios/base/executors/HippyJSExecutor.h index 69d7ae174ae..64cc3ae47c9 100644 --- a/framework/ios/base/executors/HippyJSExecutor.h +++ b/framework/ios/base/executors/HippyJSExecutor.h @@ -24,36 +24,15 @@ #import "HippyDefines.h" #import "HippyDefines.h" #import "HippyInvalidating.h" -#include +@class HippyBridge; /** * Block that when js script execution completion */ typedef void (^HippyJavaScriptCallback)(id result, NSError *error); - - -namespace hippy { -inline namespace driver { - -inline namespace napi { -class CtxValue; -} - -class Scope; - -} - -inline namespace vfs { -class UriLoader; -} - -} - -@class HippyBridge; typedef void (^HippyContextCreatedBlock)(void); - /** * Uses a JavaScriptCore context as the execution engine. */ @@ -68,9 +47,6 @@ typedef void (^HippyContextCreatedBlock)(void); /// EngineKey @property (nonatomic, copy) NSString *enginekey; -/// hippy scope -@property (atomic, assign) std::shared_ptr pScope; - /// context created block @property (nonatomic, copy) HippyContextCreatedBlock contextCreatedBlock; @@ -95,14 +71,6 @@ typedef void (^HippyContextCreatedBlock)(void); /// - Parameter inspectable: BOOL - (void)setInspecable:(BOOL)inspectable; -/// Set Uri loader -/// - Parameter uriLoader: vfs::UriLoader -- (void)setUriLoader:(std::weak_ptr)uriLoader; - -/// Get turbo object -/// - Parameter name: NSString -- (std::shared_ptr)JSTurboObjectWithName:(NSString *)name; - // TODO: 疑似已废弃 /** * Executes BatchedBridge.flushedQueue on JS thread and calls the given callback diff --git a/framework/ios/base/executors/HippyJSExecutor.mm b/framework/ios/base/executors/HippyJSExecutor.mm index b905c7b87a0..b646c3f67b6 100644 --- a/framework/ios/base/executors/HippyJSExecutor.mm +++ b/framework/ios/base/executors/HippyJSExecutor.mm @@ -21,6 +21,7 @@ */ #import "HippyJSExecutor.h" +#import "HippyJSExecutor+Internal.h" #import "VFSUriHandler.h" #import "HippyAssert.h" #import "HippyBundleURLProvider.h" @@ -81,6 +82,9 @@ @interface HippyJSExecutor () { + // The hippy scope + std::shared_ptr _pScope; + #ifdef JS_JSC BOOL _isInspectable; #endif //JS_JSC @@ -96,6 +100,8 @@ @interface HippyJSExecutor () { @implementation HippyJSExecutor +@synthesize pScope = _pScope; + - (void)setup { auto engine = [[HippyJSEnginesMapper defaultInstance] createJSEngineResourceForKey:self.enginekey]; const char *pName = [self.enginekey UTF8String] ?: ""; @@ -106,7 +112,7 @@ - (void)setup { @autoreleasepool { HippyJSExecutor *strongSelf = weakSelf; if (strongSelf) { - handleJsExcepiton(strongSelf->_pScope); + handleJsExcepiton(strongSelf.pScope); } } }; @@ -126,7 +132,7 @@ - (void)setup { } dispatch_semaphore_wait(scopeSemaphore, DISPATCH_TIME_FOREVER); - auto scope = strongSelf->_pScope; + auto scope = strongSelf.pScope; scope->CreateContext(); auto context = scope->GetContext(); auto global_object = context->GetGlobalObject(); @@ -179,7 +185,7 @@ - (void)setup { }]; } }); - self.pScope = scope; + _pScope = scope; dispatch_semaphore_signal(scopeSemaphore); #ifdef ENABLE_INSPECTOR @@ -237,7 +243,7 @@ - (void)invalidate { } #endif //JS_JSC self.pScope->WillExit(); - self.pScope = nullptr; + _pScope = nullptr; NSString *enginekey = self.enginekey; if (!enginekey) { return; @@ -373,7 +379,7 @@ - (void)setSandboxDirectory:(NSString *)directory { - (SharedCtxValuePtr)JSTurboObjectWithName:(NSString *)name { // create HostObject by name HippyOCTurboModule *turboModule = [self->_bridge turboModuleWithName:name]; - auto scope = self->_pScope; + auto scope = self.pScope; auto context = scope->GetContext(); if (!turboModule) { return context->CreateNull(); diff --git a/framework/ios/module/turbo/HippyOCTurboModule.mm b/framework/ios/module/turbo/HippyOCTurboModule.mm index 0741570dd92..8a8d3274449 100644 --- a/framework/ios/module/turbo/HippyOCTurboModule.mm +++ b/framework/ios/module/turbo/HippyOCTurboModule.mm @@ -24,7 +24,7 @@ #import "HippyOCTurboModule.h" #import "HippyOCTurboModule+Inner.h" #import "HippyTurboModuleManager.h" -#import "HippyJSExecutor.h" +#import "HippyJSExecutor+Internal.h" #import "HippyAssert.h" #import "HippyLog.h" #import "HippyUtils.h" diff --git a/framework/ios/module/turbo/HippyTurboModuleManager.mm b/framework/ios/module/turbo/HippyTurboModuleManager.mm index 8fb172ae1fd..7f4dfd72006 100644 --- a/framework/ios/module/turbo/HippyTurboModuleManager.mm +++ b/framework/ios/module/turbo/HippyTurboModuleManager.mm @@ -20,9 +20,10 @@ * */ -#import "HippyJSExecutor.h" -#import "HippyModuleData.h" + #import "HippyTurboModuleManager.h" +#import "HippyJSExecutor+Internal.h" +#import "HippyModuleData.h" #import "HippyAssert.h" #include diff --git a/hippy.podspec b/hippy.podspec index d69ed9e39a7..ef43c7e17ff 100644 --- a/hippy.podspec +++ b/hippy.podspec @@ -24,9 +24,6 @@ Pod::Spec.new do |s| s.source = {:git => 'https://github.com/Tencent/Hippy.git', :tag => s.version} s.platform = :ios s.ios.deployment_target = '11.0' - # Disable module compilation - s.module_map = false - s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'NO' } s.prepare_command = <<-CMD ./xcodeinitscript.sh "#{layout_engine}" "#{js_engine}" @@ -58,6 +55,20 @@ Pod::Spec.new do |s| 'modules/vfs/ios/*.{h,m,mm}', 'modules/ios/image/*.{h,m,mm}', ] + framework.private_header_files = [ + 'framework/ios/**/*+Private.h', + 'framework/ios/**/*+Inne.h', + 'framework/ios/**/*+Internal.h', + 'framework/ios/**/HippyJSEnginesMapper.h', + 'framework/ios/**/NSObject+CtxValue.h', + 'framework/ios/**/HippyTurboModuleManager.h', + 'renderer/native/ios/**/*+Private.h', + 'renderer/native/ios/**/*+Internal.h', + 'renderer/native/ios/**/NativeRenderManager.h', + 'renderer/native/ios/**/HippyComponentMap.h', + 'renderer/native/ios/**/UIView+DirectionalLayout.h', + 'modules/vfs/ios/**/*.h', + ] framework.public_header_files = [ 'framework/ios/**/*.h', 'renderer/native/ios/**/*.h', @@ -74,6 +85,7 @@ Pod::Spec.new do |s| framework.dependency 'hippy/Base' framework.dependency 'hippy/JSDriver' framework.dependency 'hippy/VFS' + framework.dependency 'hippy/Dom' framework.dependency 'hippy/DomUtils' framework.dependency 'hippy/Footstone' framework.dependency 'hippy/FootstoneUtils' @@ -82,7 +94,7 @@ Pod::Spec.new do |s| s.subspec 'Footstone' do |footstone| footstone.libraries = 'c++' footstone.source_files = ['modules/footstone/**/*.{h,cc}'] - footstone.private_header_files = ['modules/footstone/**/*.h'] + footstone.project_header_files = ['modules/footstone/**/*.h'] footstone.exclude_files = ['modules/footstone/include/footstone/platform/adr', 'modules/footstone/src/platform/adr'] footstone.header_mappings_dir = 'modules/footstone/include/' @@ -99,7 +111,7 @@ Pod::Spec.new do |s| s.subspec 'FootstoneUtils' do |footstoneutils| footstoneutils.libraries = 'c++' footstoneutils.source_files = ['modules/ios/footstoneutils/*.{h,mm}'] - footstoneutils.private_header_files = ['modules/ios/footstoneutils/*.h'] + footstoneutils.project_header_files = ['modules/ios/footstoneutils/*.h'] footstoneutils.pod_target_xcconfig = { 'CLANG_CXX_LANGUAGE_STANDARD' => 'c++17', 'GCC_ENABLE_CPP_EXCEPTIONS' => false, @@ -112,7 +124,7 @@ Pod::Spec.new do |s| s.subspec 'VFS' do |vfs| vfs.libraries = 'c++' vfs.source_files = ['modules/vfs/native/**/*.{h,cc}'] - vfs.private_header_files = ['modules/vfs/native/include/**/*.h'] + vfs.project_header_files = ['modules/vfs/native/include/**/*.h'] vfs.header_mappings_dir = 'modules/vfs/native/include/' header_search_paths = '$(PODS_TARGET_SRCROOT)/modules/vfs/native/include/' @@ -197,7 +209,7 @@ Pod::Spec.new do |s| dom.libraries = 'c++' dom.source_files = dom_source_files - dom.private_header_files = ['dom/include/**/*.h'] + dom.project_header_files = ['dom/include/**/*.h'] dom.header_mappings_dir = 'dom/include/' dom.exclude_files = dom_exclude_files dom.pod_target_xcconfig = { diff --git a/framework/ios/module/loader/HippyBase64DataHandler.h b/modules/vfs/ios/HippyBase64DataHandler.h similarity index 100% rename from framework/ios/module/loader/HippyBase64DataHandler.h rename to modules/vfs/ios/HippyBase64DataHandler.h diff --git a/framework/ios/module/loader/HippyBase64DataHandler.mm b/modules/vfs/ios/HippyBase64DataHandler.mm similarity index 100% rename from framework/ios/module/loader/HippyBase64DataHandler.mm rename to modules/vfs/ios/HippyBase64DataHandler.mm diff --git a/framework/ios/module/loader/HippyBridge+VFSLoader.h b/modules/vfs/ios/HippyBridge+VFSLoader.h similarity index 100% rename from framework/ios/module/loader/HippyBridge+VFSLoader.h rename to modules/vfs/ios/HippyBridge+VFSLoader.h diff --git a/framework/ios/module/loader/HippyBridge+VFSLoader.mm b/modules/vfs/ios/HippyBridge+VFSLoader.mm similarity index 100% rename from framework/ios/module/loader/HippyBridge+VFSLoader.mm rename to modules/vfs/ios/HippyBridge+VFSLoader.mm diff --git a/framework/ios/module/loader/HippyFileHandler.h b/modules/vfs/ios/HippyFileHandler.h similarity index 100% rename from framework/ios/module/loader/HippyFileHandler.h rename to modules/vfs/ios/HippyFileHandler.h diff --git a/framework/ios/module/loader/HippyFileHandler.mm b/modules/vfs/ios/HippyFileHandler.mm similarity index 100% rename from framework/ios/module/loader/HippyFileHandler.mm rename to modules/vfs/ios/HippyFileHandler.mm diff --git a/renderer/native/ios/renderer/component/text/HippyShadowText+Internal.h b/renderer/native/ios/renderer/component/text/HippyShadowText+Internal.h new file mode 100644 index 00000000000..85c620ddf02 --- /dev/null +++ b/renderer/native/ios/renderer/component/text/HippyShadowText+Internal.h @@ -0,0 +1,44 @@ +/*! + * iOS SDK + * + * Tencent is pleased to support the open source community by making + * Hippy available. + * + * Copyright (C) 2019 THL A29 Limited, a Tencent company. + * All rights reserved. + * + * 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. + */ + + +#import "HippyShadowText.h" + +namespace hippy { +inline namespace dom { +enum class LayoutMeasureMode; +struct LayoutSize; +} +} + +NS_ASSUME_NONNULL_BEGIN + +@interface HippyShadowText (Internal) + +hippy::LayoutSize textMeasureFunc(HippyShadowText *weakShadowText, + float width, hippy::LayoutMeasureMode widthMeasureMode, + float height, hippy::LayoutMeasureMode heightMeasureMode, + void *layoutContext); + +@end + +NS_ASSUME_NONNULL_END diff --git a/renderer/native/ios/renderer/component/text/HippyShadowText.h b/renderer/native/ios/renderer/component/text/HippyShadowText.h index 0ab41e6d889..a9be9a1525b 100644 --- a/renderer/native/ios/renderer/component/text/HippyShadowText.h +++ b/renderer/native/ios/renderer/component/text/HippyShadowText.h @@ -29,27 +29,17 @@ typedef NS_ENUM(NSInteger, HippySizeComparison) { HippySizeWithinRange, }; -namespace hippy { -inline namespace dom { -enum class LayoutMeasureMode; -struct LayoutSize; -} -} extern NSAttributedStringKey const HippyIsHighlightedAttributeName; extern NSAttributedStringKey const HippyTagAttributeName; extern NSAttributedStringKey const HippyShadowViewAttributeName; -hippy::LayoutSize textMeasureFunc(float width, hippy::LayoutMeasureMode widthMeasureMode, - __unused float height, - __unused hippy::LayoutMeasureMode heightMeasureMode, - void *layoutContext); +/// Text's ShadowNode @interface HippyShadowText : HippyShadowView { @protected NSTextStorage *_cachedTextStorage; CGFloat _cachedTextStorageWidth; - hippy::LayoutMeasureMode _cachedTextStorageWidthMode; NSAttributedString *_cachedAttributedString; CGFloat _effectiveLetterSpacing; BOOL _textAlignSet; diff --git a/renderer/native/ios/renderer/component/text/HippyShadowText.mm b/renderer/native/ios/renderer/component/text/HippyShadowText.mm index b8d3d4b59df..f1fdc56bfb2 100644 --- a/renderer/native/ios/renderer/component/text/HippyShadowText.mm +++ b/renderer/native/ios/renderer/component/text/HippyShadowText.mm @@ -89,6 +89,7 @@ @interface HippyShadowText () { BOOL _isNestedText; // Indicates whether Text is nested, for speeding up typesetting calculations BOOL _needRelayoutText; // special styles require two layouts, eg. verticalAlign etc + hippy::LayoutMeasureMode _cachedTextStorageWidthMode; // cached width mode when building text storage } @end @@ -96,9 +97,10 @@ @interface HippyShadowText () @implementation HippyShadowText -hippy::LayoutSize textMeasureFunc( - HippyShadowText *weakShadowText, float width,hippy::LayoutMeasureMode widthMeasureMode, - float height, hippy::LayoutMeasureMode heightMeasureMode, void *layoutContext) { +hippy::LayoutSize textMeasureFunc(HippyShadowText *weakShadowText, + float width, hippy::LayoutMeasureMode widthMeasureMode, + float height, hippy::LayoutMeasureMode heightMeasureMode, + void *layoutContext) { hippy::LayoutSize retSize; HippyShadowText *strongShadowText = weakShadowText; if (strongShadowText) { diff --git a/renderer/native/ios/renderer/component/text/HippyTextManager.mm b/renderer/native/ios/renderer/component/text/HippyTextManager.mm index bc2159baf1a..edd534a17ea 100644 --- a/renderer/native/ios/renderer/component/text/HippyTextManager.mm +++ b/renderer/native/ios/renderer/component/text/HippyTextManager.mm @@ -37,11 +37,6 @@ static void collectDirtyNonTextDescendants(HippyShadowText *renderObject, NSMuta } } -@interface HippyShadowText (Private) -// hplayout -- (NSTextStorage *)buildTextStorageForWidth:(CGFloat)width widthMode:(hippy::LayoutMeasureMode)widthMode; -@end - @implementation HippyTextManager HIPPY_EXPORT_MODULE(Text) diff --git a/tests/ios/HippyUIManagerTest.mm b/tests/ios/HippyUIManagerTest.mm index 1c28442fecd..5255a3f278e 100644 --- a/tests/ios/HippyUIManagerTest.mm +++ b/tests/ios/HippyUIManagerTest.mm @@ -49,7 +49,8 @@ - (void)tearDown { } - (void)testGetComponentDataForViewName { - HippyUIManager *manager = [[HippyUIManager alloc] init]; + HippyBridge *bridge = [[HippyBridge alloc] init]; + HippyUIManager *manager = [[HippyUIManager alloc] initWithBridge:bridge]; [manager registerExtraComponent:@[ HippyViewManager.class ]]; XCTAssertNil([manager componentDataForViewName:nil]); diff --git a/tests/ios/HippyUIViewCategoryTest.m b/tests/ios/HippyUIViewCategoryTest.m index d6fb521c9b7..d1a879d1a31 100644 --- a/tests/ios/HippyUIViewCategoryTest.m +++ b/tests/ios/HippyUIViewCategoryTest.m @@ -63,8 +63,8 @@ - (void)testGetHippyRootView { - (void)testGetHippyUIManager { UIView *testView = [UIView new]; XCTAssertNil([testView uiManager]); - - HippyUIManager *uiManager = [[HippyUIManager alloc] init]; + HippyBridge *bridge = [[HippyBridge alloc] init]; + HippyUIManager *uiManager = [[HippyUIManager alloc] initWithBridge:bridge]; XCTAssertNoThrow(testView.uiManager = uiManager); XCTAssertTrue(testView.uiManager == uiManager); }