From 6064638b59e239ab768d3545bf23ca9d792dfb9c Mon Sep 17 00:00:00 2001 From: Elon Chan Date: Mon, 22 Apr 2019 15:41:41 +0800 Subject: [PATCH] v1.24.0 Do not depend on lottie by default --- CYLTabBarController.podspec | 18 ++++++++++++++---- .../CYLTabBar+CYLTabBarControllerExtention.m | 14 +++++++++----- CYLTabBarController/CYLTabBarController.m | 3 +++ .../UIControl+CYLTabBarControllerExtention.m | 5 +++-- .../UIView+CYLTabBarControllerExtention.m | 3 +++ Example/CYLMainRootViewController.m | 4 +++- Podfile | 6 +++--- 7 files changed, 38 insertions(+), 15 deletions(-) diff --git a/CYLTabBarController.podspec b/CYLTabBarController.podspec index 83e87623..8a958640 100644 --- a/CYLTabBarController.podspec +++ b/CYLTabBarController.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "CYLTabBarController" - s.version = "1.23.1" + s.version = "1.24.0" s.summary = "Highly customizable tabBar and tabBarController for iOS" s.description = "CYLTabBarController is iPad and iPhone compatible. Supports landscape and portrait orientations and can be used inside UINavigationController." s.homepage = "https://github.com/ChenYilong/CYLTabBarController" @@ -9,9 +9,19 @@ Pod::Spec.new do |s| s.social_media_url = 'http://weibo.com/luohanchenyilong/' s.platform = :ios, '8.0' s.source = { :git => "https://github.com/ChenYilong/CYLTabBarController.git", :tag => s.version.to_s } - s.source_files = 'CYLTabBarController', 'CYLTabBarController/**/*.{h,m}' - s.public_header_files = 'CYLTabBarController/**/*.h' + s.requires_arc = true - s.dependency "lottie-ios" , '~> 2.5.0' + + s.default_subspec = 'Core' + + s.subspec 'Core' do |core| + core.source_files = 'CYLTabBarController', 'CYLTabBarController/**/*.{h,m}' + core.public_header_files = 'CYLTabBarController/**/*.h' + end + + s.subspec 'Lottie' do |lottie| + lottie.dependency 'CYLTabBarController/Core' + lottie.dependency "lottie-ios" , '~> 2.5.3' + end end diff --git a/CYLTabBarController/CYLTabBar+CYLTabBarControllerExtention.m b/CYLTabBarController/CYLTabBar+CYLTabBarControllerExtention.m index 6d45f6c9..29379374 100644 --- a/CYLTabBarController/CYLTabBar+CYLTabBarControllerExtention.m +++ b/CYLTabBarController/CYLTabBar+CYLTabBarControllerExtention.m @@ -13,7 +13,10 @@ #import #import "CYLTabBar.h" +#if __has_include() #import +#else +#endif @implementation CYLTabBar (CYLTabBarControllerExtention) @@ -153,14 +156,10 @@ - (UIControl *)cyl_visibleControlWithIndex:(NSUInteger)index { return selectedControl; } -//- (void)cyl_animationLottieImageWithSelectedIndex:(NSUInteger)selectedIndex { -// UIControl *selectedControl = [self cyl_subTabBarButtonWithIndex:selectedIndex]; -// [self cyl_animationLottieImageWithSelectedControl:selectedControl]; -//} - - (void)cyl_animationLottieImageWithSelectedControl:(UIControl *)selectedControl lottieURL:(NSURL *)lottieURL size:(CGSize)size { +#if __has_include() [selectedControl cyl_addLottieImageWithLottieURL:lottieURL size:size]; [self cyl_stopAnimationOfAllLottieView]; LOTAnimationView *lottieView = selectedControl.cyl_lottieAnimationView; @@ -171,12 +170,17 @@ - (void)cyl_animationLottieImageWithSelectedControl:(UIControl *)selectedControl lottieView.animationProgress = 0; [lottieView play]; } +#else +#endif } - (void)cyl_stopAnimationOfAllLottieView { +#if __has_include() [self.cyl_visibleControls enumerateObjectsUsingBlock:^(UIControl * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) { [obj.cyl_lottieAnimationView stop]; }]; +#else +#endif } @end diff --git a/CYLTabBarController/CYLTabBarController.m b/CYLTabBarController/CYLTabBarController.m index cbd7e777..9d028c1d 100644 --- a/CYLTabBarController/CYLTabBarController.m +++ b/CYLTabBarController/CYLTabBarController.m @@ -12,7 +12,10 @@ #import "UIViewController+CYLTabBarControllerExtention.h" #import "UIControl+CYLTabBarControllerExtention.h" #import "UIImage+CYLTabBarControllerExtention.h" +#if __has_include() #import +#else +#endif NSString *const CYLTabBarItemTitle = @"CYLTabBarItemTitle"; NSString *const CYLTabBarItemImage = @"CYLTabBarItemImage"; diff --git a/CYLTabBarController/UIControl+CYLTabBarControllerExtention.m b/CYLTabBarController/UIControl+CYLTabBarControllerExtention.m index c95aeee3..4daec5ea 100644 --- a/CYLTabBarController/UIControl+CYLTabBarControllerExtention.m +++ b/CYLTabBarController/UIControl+CYLTabBarControllerExtention.m @@ -11,7 +11,10 @@ #import "UIView+CYLTabBarControllerExtention.h" #import "CYLConstants.h" #import "CYLTabBarController.h" +#if __has_include() #import +#else +#endif @implementation UIControl (CYLTabBarControllerExtention) @@ -321,9 +324,7 @@ - (void)cyl_addLottieImageWithLottieURL:(NSURL *)lottieURL lottieView.translatesAutoresizingMaskIntoConstraints = NO; [lottieView setClipsToBounds:NO]; [tabButton cyl_replaceTabImageViewWithNewView:lottieView show:YES]; - #else - return; #endif } diff --git a/CYLTabBarController/UIView+CYLTabBarControllerExtention.m b/CYLTabBarController/UIView+CYLTabBarControllerExtention.m index 0a249f85..11b2d6cd 100644 --- a/CYLTabBarController/UIView+CYLTabBarControllerExtention.m +++ b/CYLTabBarController/UIView+CYLTabBarControllerExtention.m @@ -9,7 +9,10 @@ #import #import "UIView+CYLTabBarControllerExtention.h" #import "CYLPlusButton.h" +#if __has_include() #import +#else +#endif @implementation UIView (CYLTabBarControllerExtention) diff --git a/Example/CYLMainRootViewController.m b/Example/CYLMainRootViewController.m index 42cbcfb9..c77e4757 100644 --- a/Example/CYLMainRootViewController.m +++ b/Example/CYLMainRootViewController.m @@ -9,8 +9,10 @@ #import "CYLMainRootViewController.h" #import "MainTabBarController.h" #import "CYLPlusButtonSubclass.h" - +#if __has_include() #import +#else +#endif #define RANDOM_COLOR [UIColor colorWithHue: (arc4random() % 256 / 256.0) saturation:((arc4random()% 128 / 256.0 ) + 0.5) brightness:(( arc4random() % 128 / 256.0 ) + 0.5) alpha:1] diff --git a/Podfile b/Podfile index e4810351..9d86217a 100644 --- a/Podfile +++ b/Podfile @@ -6,8 +6,8 @@ source 'git@github.com:CocoaPods/Specs.git' target 'CYLTabBarController' do # Comment the next line if you don't want to use dynamic frameworks use_frameworks! -#pod 'lottie-ios', '~> 2.5.0' -pod 'CYLTabBarController', :path => './' -#pod 'CYLTabBarController', '~> 1.23.1' + +#pod 'CYLTabBarController', '~> 1.24.0' # 默认不依赖Lottie +pod 'CYLTabBarController/Lottie', '~> 1.24.0' # 依赖Lottie库 end