Fix iOS Sample App

Summary:
Encountered when trying to build the sample app on iOS. Seemed `initWithComponentProvider` is now for Swift only and cannot be called in Objective-C.

Change to call `initWithComponentProviderFunc` instead

Reviewed By: passy

Differential Revision: D21629319

fbshipit-source-id: bf39f67ad22259b9c72694e43c507f8869e7bf22
This commit is contained in:
Chaiwat Ekkaewnumchai
2020-05-19 09:41:15 -07:00
committed by Facebook GitHub Bot
parent 9ae0511f16
commit e216764238

View File

@@ -29,10 +29,11 @@
- (instancetype)init {
if (self = [super init]) {
_rootCKHostingView = [[CKComponentHostingView alloc]
initWithComponentProvider:[self class]
sizeRangeProvider:[CKComponentFlexibleSizeRangeProvider
providerWithFlexibility:
CKComponentSizeRangeFlexibleHeight]];
initWithComponentProviderFunc:componentForModel
sizeRangeProvider:
[CKComponentFlexibleSizeRangeProvider
providerWithFlexibility:
CKComponentSizeRangeFlexibleHeight]];
[self.view addSubview:_rootCKHostingView];
[self loadViewIfNeeded];
@@ -51,8 +52,9 @@
_rootCKHostingView.frame = self.view.bounds;
}
+ (CKComponent*)componentForModel:(id<NSObject>)model
context:(id<NSObject>)context {
static CKComponent* componentForModel(
id<NSObject> model,
id<NSObject> context) {
return [CKBackgroundLayoutComponent
newWithComponent:
[CKFlexboxComponent newWithView:{}