yahoo open source - the tour & mystery of appdevkit (mopcon 2016)
TRANSCRIPT
The Tour & Mystery of AppDevKit
Anistar SungSenior Engineering Manager, Yahoo
Yahoo Open Source
MOPCON 2016
Sure!
Challenge on Color Design easy sync tool for designer
Developer said:
self.backgroundColor = [UIColor redColor];
I want #7b19a9 color background.
Challenge on Color Design easy sync tool for designer
Designer said:
I want Yahoo purple background.
Challenge on Color Design easy sync tool for designer
Designer said:
Using Category to improve UIColor
+ (UIColor *)ADKColorWithHexString:(NSString *)hexString;+ (UIColor *)ADKColorWithHexNumber:(NSUInteger)hexNumber;
Challenge on Color Design easy sync tool for designer
Management your theme color
+ (UIColor *)themeBackground; + (UIColor *)themeForeground; + (UIColor *)themeDisabled; + (UIColor *)themeFocus; + (UIColor *)themeHighlight; + (UIColor *)themeTitle; + (UIColor *)themeSubtitle;
Challenge on Color Design easy sync tool for designer
+ (UIColor *)themeBackground{ return [UIColor ADKColorWithHexString:@"1f2f3b"];}
+ (UIColor *)themePanel{ return [UIColor ADKColorWithHexString:@"333e49"];}
Change once apply anywhere Theme color management
+ (UIColor *)themeBackground{ return [UIColor ADKColorWithHexString:@"dedede"];}
+ (UIColor *)themePanel{ return [UIColor ADKColorWithHexString:@"f4f4f4"];}
Change once apply anywhere Theme color management
Objectives of AppDevKit
Saving developing time
Supporting daily required
Maintaining easier
High performance / reliable solution
AppDevKit
Hex ColorDate Formatter
Number Formatter
Gradient View
Over 100+ featuresAnimation
App Util
Nib Size Calculator
CalculatorHelper
AutoLayout Constraint Tool
Image Filters
ModalMaskView
Dynamic width/height Cell
Pull to RefreshInfinite scrolling
AppDevKit
Hex ColorDate Formatter
Number Formatter
Gradient View
Over 100+ featuresAnimation
App Util
Nib Size Calculator
CalculatorHelper
AutoLayout Constraint Tool
Image Filters
ModalMaskView
Dynamic width/height Cell
Pull to RefreshInfinite scrolling
@import “UIView+ADKAutoLayoutSupport.h” [self.presetImageView ADKHideTopConstraint]; [self.presetImageView ADKUnhideTopConstraint];
Using AutoLayout Easier Solve UI elements alignment problem
@import “UIView+AutoLayoutSupport.h”
- (void)ADKSetConstraintConstant:(CGFloat)constant forAttribute:(NSLayoutAttribute)attribute;
Using AutoLayout Easier Solve UI elements alignment problem
UIImage+ADKColorReplacement.h
+ (UIImage *)ADKImage:(UIImage *)image tintColor:(UIColor *)color; + (UIImage *)ADKImage:(UIImage *)image replaceColor:(UIColor *)color;
+ (UIImage *)ADKImageNamed:(NSString *)name tintColor:(UIColor *)color; + (UIImage *)ADKImageNamed:(NSString *)name replaceColor:(UIColor *)color;
Fast materials replacement Implement category for UIImage
Change ICON’s theme color
@import “UIImage+ADKColorReplacement.h” self.presetImageView.image = [UIImage ADKImageNamed:@“icon-folder.png" replaceColor:[UIColor themeLightWhite]]; UIImage *settingButtonImage = [UIImage ADKImageNamed:@"icon-setting.png" replaceColor:[UIColor themeForeground]]; [settingButton setImage:settingButtonImage forState:UIControlStateNormal];
Fast materials replacement Implement category for UIImage
UIViewController
- (void)presentViewController:(UIViewController *)viewControllerToPresent animated:(BOOL)flag completion:(void (^)(void))completion
Providing Fancy Modal View Customizing your modal effect
@import “ADKModalMaskView.h” [(ADKModalMaskView *)self.modalView showInView:self.view withAnimation:YES completion:^(BOOL finished) { // Do something you want }];
Providing Fancy Modal View Customizing your modal effect
UICollectionView can set up cell size SMARTER!
@import ADKCellDynamicSizeCalculator.h
- (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath { CGSize cellSize = [[NibSizeCalculator sharedInstance] sizeForNibNamed:@“Cell”]; return [[ADKCellDynamicSizeCalculator sharedInstance] sizeForDynamicHeightCellInstance:sampleCell preferredSize:cellSize]; }
Change once apply anywhere Interface change
UICollectionView can set up cell size SMARTER! - (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath { CGFloat height = 100.0f; // 2nd requirement: height = 120.0f; // 3rd requirement: height = 150.0f; // I can try this all day…
return CGSize(320.0f,height) }
Change once apply anywhere Interface change
UICollectionView can set up cell size SMARTER!
@import ADKNibSizeCalculator.h
- (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath { return [[ADKNibSizeCalculator sharedInstance] sizeForNibNamed:@"Cell"]; }
Change once apply anywhere Interface change
Customized pull to refresh feature
[self.collectionView ADKAddPullToRefreshWithHandleView:refreshView actionHandler:^{
// Calling API to get data and present on list
[self.collectionView reloadData];
}];
Implement Easy Refresh MechanismSupport UICollectionView & UITableView
Cache Heavy Calculated Result+ (UIImage *)ADKImageNamed:(NSString *)name replaceColor:(UIColor *)color
{
NSString *cacheKeyString =
[UIImage cacheKeyStringWithImageNamed:name
colorReplaceMode:ADKColorReplaceModeReplace
color:color];
UIImage *resultImage = [s_imageCache objectForKey:cacheKeyString];
if (resultImage) return resultImage;
…
}
Avoid Using BAD Solution- (void)ADKHideView:(BOOL)isHidden withConstraints:(ADKLayoutAttribute)attributes
{
ADKAutoLayoutValueObject *valueObject = self.cachedConstraintValueObject;
if (isHidden) {
if (attributes & ADKLayoutAttributeLeading) {
NSLayoutConstraint *constraint =
[self ADKConstraintForAttribute:NSLayoutAttributeLeading];
valueObject.cachedLeadingConstraintConstant = constraint.constant;
…
}
Separate Libraries into small pieces s.subspec 'AppDevCommonKit' do |appDevCommonKit|
appDevCommonKit.source_files = …
appDevCommonKit.public_header_files = …
end
s.subspec 'AppDevUIKit' do |appDevUIKit|
appDevUIKit.source_files = …
appDevUIKit.public_header_files = …
appDevUIKit.dependency 'AppDevKit/AppDevCommonKit'
end
Platform Detection
if (ADKIsBelowIOS10()) { ... }
if (ADKIsLongerScreen()) { ... }
if ([UIImage instancesRespondToSelector:@selector(…)]) {…}
Friendly UI Would be Better
IB_DESIGNABLE
@interface ADKGradientView : UIView
@property (nonatomic, strong) IBInspectable UIColor *beginColor;
@property (nonatomic, strong) IBInspectable UIColor *endColor;
AppDevKit Core Team
Anistar Anson Jeff QC
Anistar Sung Yahoo Senior Engineering [email protected]
AppDevKit Yahoo Core TeamYahoo Engineering Engineers [email protected]
ADKCamera *camera = [[ADKCamera alloc] initCamcoderWithDelegate:self quality:AVCaptureSessionPresetHigh position:ADKCameraPositionRear];
camera.alignDeviceOrientation = YES;
[self.view.layer insertSublayer:camera.captureVideoPreviewLayer atIndex:0];
Initialize Customize CameraQuick & powerful camera developing
– iOS BDD
DAY 1 - 16:15 R2QC Lin, Senior App Engineer, Yahoo
iOS self-sizing cell
DAY 2 - 10:15 R2Jeff Lin, Senior App Engineer, Yahoo
More Sessions in MOPCON 2016