From 307fc189169e64e319479c6ef782fa58da5a3b5a Mon Sep 17 00:00:00 2001 From: Chaiwat Ekkaewnumchai Date: Mon, 9 Nov 2020 23:26:06 -0800 Subject: [PATCH] Change CK Construction Summary: The sample iOS project can't be built by `buck` because the internal(?) reference codes aren't available anymore. This diff change the way to instantiate the components and add CK dependency (not sure if the correct one or not). Reviewed By: passy Differential Revision: D24782764 fbshipit-source-id: 809245771fc3b542fe63dfccdc8bbc6913aa63af --- iOS/Sample/RootViewController.mm | 53 +++++++++++++------------------- 1 file changed, 22 insertions(+), 31 deletions(-) diff --git a/iOS/Sample/RootViewController.mm b/iOS/Sample/RootViewController.mm index 77b1ca25b..6fc025c5a 100644 --- a/iOS/Sample/RootViewController.mm +++ b/iOS/Sample/RootViewController.mm @@ -55,37 +55,28 @@ static CKComponent* componentForModel( id model, id context) { - return [CKBackgroundLayoutComponent - newWithComponent: - [CKFlexboxComponent newWithView:{} - size:{} - style:{} - children:{ - {[CKButtonComponent - newWithAction:nil - options:{ - .titles = @"Purple", - .titleColors = - UIColor.purpleColor, - }]}, - {[CKButtonComponent - newWithAction:nil - options:{ - .titles = @"Brown", - .titleColors = - UIColor.brownColor, - }]}, - {[CKButtonComponent - newWithAction:nil - options:{ - .titles = @"Cyan", - .titleColors = - UIColor.cyanColor, - }]}, - }] - background:CK::ImageComponentBuilder() - .image([UIImage imageNamed:@"sonarpattern"]) - .build()]; + return CK::BackgroundLayoutComponentBuilder() + .component(CK::FlexboxComponentBuilder() + .child({.component = CK::ButtonComponentBuilder() + .action(nil) + .title(@"Purple") + .titleColor(UIColor.purpleColor) + .build()}) + .child({.component = CK::ButtonComponentBuilder() + .action(nil) + .title(@"Brown") + .titleColor(UIColor.brownColor) + .build()}) + .child({.component = CK::ButtonComponentBuilder() + .action(nil) + .title(@"Cyan") + .titleColor(UIColor.cyanColor) + .build()}) + .build()) + .background(CK::ImageComponentBuilder() + .image([UIImage imageNamed:@"sonarpattern"]) + .build()) + .build(); } @end