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