Improving Disaster Preparedness in an Era of Scarce Resources A View from California
ComponentKit basics presentation: Improving View Performance with ComponentKit
-
Upload
corneliu-chitanu -
Category
Software
-
view
390 -
download
2
Transcript of ComponentKit basics presentation: Improving View Performance with ComponentKit
![Page 1: ComponentKit basics presentation: Improving View Performance with ComponentKit](https://reader034.fdocuments.in/reader034/viewer/2022051521/5a677e067f8b9a656a8b5905/html5/thumbnails/1.jpg)
Improving View Performance with
ComponentKit
![Page 2: ComponentKit basics presentation: Improving View Performance with ComponentKit](https://reader034.fdocuments.in/reader034/viewer/2022051521/5a677e067f8b9a656a8b5905/html5/thumbnails/2.jpg)
1. Caracteristici ComponentKit 2. De tinut cont in utilizarea
ComponentKit 3. Code:
1.Sintaxa 2.Componente de bază 3.Good practices
![Page 3: ComponentKit basics presentation: Improving View Performance with ComponentKit](https://reader034.fdocuments.in/reader034/viewer/2022051521/5a677e067f8b9a656a8b5905/html5/thumbnails/3.jpg)
Caracteristicile
ComponentKit
![Page 4: ComponentKit basics presentation: Improving View Performance with ComponentKit](https://reader034.fdocuments.in/reader034/viewer/2022051521/5a677e067f8b9a656a8b5905/html5/thumbnails/4.jpg)
Facebook și-a dorit să mute complexitatea în
infrastructură
![Page 5: ComponentKit basics presentation: Improving View Performance with ComponentKit](https://reader034.fdocuments.in/reader034/viewer/2022051521/5a677e067f8b9a656a8b5905/html5/thumbnails/5.jpg)
![Page 6: ComponentKit basics presentation: Improving View Performance with ComponentKit](https://reader034.fdocuments.in/reader034/viewer/2022051521/5a677e067f8b9a656a8b5905/html5/thumbnails/6.jpg)
Immutability
![Page 7: ComponentKit basics presentation: Improving View Performance with ComponentKit](https://reader034.fdocuments.in/reader034/viewer/2022051521/5a677e067f8b9a656a8b5905/html5/thumbnails/7.jpg)
Immutability
![Page 8: ComponentKit basics presentation: Improving View Performance with ComponentKit](https://reader034.fdocuments.in/reader034/viewer/2022051521/5a677e067f8b9a656a8b5905/html5/thumbnails/8.jpg)
E declarativ
pentru specificarea 1. ierarhiei de view-uri 2. layout 3. modificarilor de stare
![Page 9: ComponentKit basics presentation: Improving View Performance with ComponentKit](https://reader034.fdocuments.in/reader034/viewer/2022051521/5a677e067f8b9a656a8b5905/html5/thumbnails/9.jpg)
@implementation DCCTextComponent
+(instancetype)newWithText:(NSString *)postText context:(id)context { CGFloat componentWidth = [[context objectForKey:@"componentWidth"] doubleValue]; return [super newWithComponent: [CKStackLayoutComponent newWithView:{} size:{.width = componentWidth - 20} style:{} children:{ {[CKTextComponent newWithTextAttributes:{ .attributedString = [[NSAttributedString alloc] initWithString:postText attributes:@{NSFontAttributeName:[UIFont preferredFontForTextStyle:UIFontTextStyleBody], NSForegroundColorAttributeName:[UIColor blackColor]}], } viewAttributes:{ } accessibilityContext:{}]} }]];}
@end
![Page 10: ComponentKit basics presentation: Improving View Performance with ComponentKit](https://reader034.fdocuments.in/reader034/viewer/2022051521/5a677e067f8b9a656a8b5905/html5/thumbnails/10.jpg)
Componentele = functii pure@implementation DCCTextComponent
+(instancetype)newWithText:(NSString *)postText context:(id)context { CGFloat componentWidth = [[context objectForKey:@"componentWidth"] doubleValue]; return [super newWithComponent: [CKStackLayoutComponent newWithView:{} size:{.width = componentWidth - 20} style:{} children:{ {[CKTextComponent newWithTextAttributes:{ .attributedString = [[NSAttributedString alloc] initWithString:postText attributes:@{NSFontAttributeName:[UIFont preferredFontForTextStyle:UIFontTextStyleBody], NSForegroundColorAttributeName:[UIColor blackColor]}], } viewAttributes:{ } accessibilityContext:{}]} }]];}
@end
![Page 11: ComponentKit basics presentation: Improving View Performance with ComponentKit](https://reader034.fdocuments.in/reader034/viewer/2022051521/5a677e067f8b9a656a8b5905/html5/thumbnails/11.jpg)
Composable & Reusable@implementation DCCTextComponent
+(instancetype)newWithText:(NSString *)postText context:(id)context { CGFloat componentWidth = [[context objectForKey:@"componentWidth"] doubleValue]; return [super newWithComponent: [CKStackLayoutComponent newWithView:{} size:{.width = componentWidth - 20} style:{} children:{ {[CKTextComponent newWithTextAttributes:{ .attributedString = [[NSAttributedString alloc] initWithString:postText attributes:@{NSFontAttributeName:[UIFont preferredFontForTextStyle:UIFontTextStyleBody], NSForegroundColorAttributeName:[UIColor blackColor]}], } viewAttributes:{ } accessibilityContext:{}]} }]];}
@end
![Page 12: ComponentKit basics presentation: Improving View Performance with ComponentKit](https://reader034.fdocuments.in/reader034/viewer/2022051521/5a677e067f8b9a656a8b5905/html5/thumbnails/12.jpg)
De tinut cont cand utilizam
ComponentKit
![Page 13: ComponentKit basics presentation: Improving View Performance with ComponentKit](https://reader034.fdocuments.in/reader034/viewer/2022051521/5a677e067f8b9a656a8b5905/html5/thumbnails/13.jpg)
Tipuri de view potrivite pentru ComponentKit:
Liste care au un continut
complex
![Page 14: ComponentKit basics presentation: Improving View Performance with ComponentKit](https://reader034.fdocuments.in/reader034/viewer/2022051521/5a677e067f8b9a656a8b5905/html5/thumbnails/14.jpg)
Puncte forte:
1.Performanta la scroll 2.Reciclarea view-urilor 3.Putin cod pentru o componentă
(if done right)
![Page 15: ComponentKit basics presentation: Improving View Performance with ComponentKit](https://reader034.fdocuments.in/reader034/viewer/2022051521/5a677e067f8b9a656a8b5905/html5/thumbnails/15.jpg)
Puncte slabe:
1.Animațiile sunt mai greu de implementat
2.Nu e potrivit pentru view-uri dinamice, care se modifica des la interactiunea cu utilizatorul
3.Nu se poate integra cu Swift (Swift nu poate conlucra cu C++)
![Page 16: ComponentKit basics presentation: Improving View Performance with ComponentKit](https://reader034.fdocuments.in/reader034/viewer/2022051521/5a677e067f8b9a656a8b5905/html5/thumbnails/16.jpg)
Code