From e2167642384c7289b9c7f1ee867ba92d1e4d62ac Mon Sep 17 00:00:00 2001 From: Chaiwat Ekkaewnumchai Date: Tue, 19 May 2020 09:41:15 -0700 Subject: [PATCH] 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 --- iOS/Sample/RootViewController.mm | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/iOS/Sample/RootViewController.mm b/iOS/Sample/RootViewController.mm index 1582c8224..2d610cd0c 100644 --- a/iOS/Sample/RootViewController.mm +++ b/iOS/Sample/RootViewController.mm @@ -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)model - context:(id)context { +static CKComponent* componentForModel( + id model, + id context) { return [CKBackgroundLayoutComponent newWithComponent: [CKFlexboxComponent newWithView:{}