From 5214cd9dd0073867a38f10cf0bdc6b211af52870 Mon Sep 17 00:00:00 2001 From: chdo002 <1107661983@qq.com> Date: Fri, 17 Nov 2017 10:34:20 +0800 Subject: [PATCH 1/2] Fix Xcode warnings and demo bugs --- Demo/YYTextDemo.xcodeproj/project.pbxproj | 6 +++++- Demo/YYTextDemo/UIView+YYAdd.h | 4 ++-- Demo/YYTextDemo/YYImage/YYAnimatedImageView.m | 2 +- Demo/YYTextDemo/YYImage/YYImageCoder.h | 8 ++++---- Demo/YYTextDemo/YYTextAsyncExample.m | 7 ++++++- Demo/YYTextDemo/YYTextEditExample.m | 5 ++++- YYText/Utility/YYTextAsyncLayer.m | 2 +- YYText/Utility/YYTextUtilities.h | 12 ++++++------ 8 files changed, 29 insertions(+), 17 deletions(-) diff --git a/Demo/YYTextDemo.xcodeproj/project.pbxproj b/Demo/YYTextDemo.xcodeproj/project.pbxproj index db1f1efa..b7a5dbfd 100644 --- a/Demo/YYTextDemo.xcodeproj/project.pbxproj +++ b/Demo/YYTextDemo.xcodeproj/project.pbxproj @@ -477,7 +477,7 @@ D94EE9831F37304200F37AD6 /* Project object */ = { isa = PBXProject; attributes = { - LastUpgradeCheck = 0900; + LastUpgradeCheck = 0910; ORGANIZATIONNAME = ibireme; TargetAttributes = { D94EE98A1F37304200F37AD6 = { @@ -627,6 +627,8 @@ CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; CLANG_WARN_STRICT_PROTOTYPES = YES; @@ -680,6 +682,8 @@ CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; CLANG_WARN_STRICT_PROTOTYPES = YES; diff --git a/Demo/YYTextDemo/UIView+YYAdd.h b/Demo/YYTextDemo/UIView+YYAdd.h index f8edfd95..153b3649 100644 --- a/Demo/YYTextDemo/UIView+YYAdd.h +++ b/Demo/YYTextDemo/UIView+YYAdd.h @@ -51,7 +51,7 @@ @end -double YYDeviceSystemVersion(); +double YYDeviceSystemVersion(void); #ifndef kSystemVersion #define kSystemVersion YYDeviceSystemVersion() @@ -73,7 +73,7 @@ double YYDeviceSystemVersion(); #define kiOS9Later (kSystemVersion >= 9) #endif -CGSize YYDeviceScreenSize(); +CGSize YYDeviceScreenSize(void); /// 屏幕宽度 diff --git a/Demo/YYTextDemo/YYImage/YYAnimatedImageView.m b/Demo/YYTextDemo/YYImage/YYAnimatedImageView.m index 8c50ef7c..f3f386aa 100644 --- a/Demo/YYTextDemo/YYImage/YYAnimatedImageView.m +++ b/Demo/YYTextDemo/YYImage/YYAnimatedImageView.m @@ -578,7 +578,7 @@ - (void)setCurrentAnimatedImageIndex:(NSUInteger)currentAnimatedImageIndex { if (currentAnimatedImageIndex >= _curAnimatedImage.animatedImageFrameCount) return; if (_curIndex == currentAnimatedImageIndex) return; - void (^block)() = ^{ + void (^block)(void) = ^{ LOCK( [_requestQueue cancelAllOperations]; [_buffer removeAllObjects]; diff --git a/Demo/YYTextDemo/YYImage/YYImageCoder.h b/Demo/YYTextDemo/YYImage/YYImageCoder.h index 61a931c4..d6443172 100644 --- a/Demo/YYTextDemo/YYImage/YYImageCoder.h +++ b/Demo/YYTextDemo/YYImage/YYImageCoder.h @@ -264,7 +264,7 @@ typedef NS_ENUM(NSUInteger, YYImageBlendOperation) { /** Add an image from a file path to encoder. - @param image Image file path. + @param path Image file path. @param duration Image duration for animation. Pass 0 to ignore this parameter. */ - (void)addImageWithFile:(NSString *)path duration:(NSTimeInterval)duration; @@ -368,10 +368,10 @@ CG_EXTERN NSString *_Nullable YYImageTypeGetExtension(YYImageType type); /// Returns the shared DeviceRGB color space. -CG_EXTERN CGColorSpaceRef YYCGColorSpaceGetDeviceRGB(); +CG_EXTERN CGColorSpaceRef YYCGColorSpaceGetDeviceRGB(void); /// Returns the shared DeviceGray color space. -CG_EXTERN CGColorSpaceRef YYCGColorSpaceGetDeviceGray(); +CG_EXTERN CGColorSpaceRef YYCGColorSpaceGetDeviceGray(void); /// Returns whether a color space is DeviceRGB. CG_EXTERN BOOL YYCGColorSpaceIsDeviceRGB(CGColorSpaceRef space); @@ -446,7 +446,7 @@ CG_EXTERN CFDataRef _Nullable YYCGImageCreateEncodedData(CGImageRef imageRef, YY /** Whether WebP is available in YYImage. */ -CG_EXTERN BOOL YYImageWebPAvailable(); +CG_EXTERN BOOL YYImageWebPAvailable(void); /** Get a webp image frame count; diff --git a/Demo/YYTextDemo/YYTextAsyncExample.m b/Demo/YYTextDemo/YYTextAsyncExample.m index 2a1246d2..e9e91bd3 100644 --- a/Demo/YYTextDemo/YYTextAsyncExample.m +++ b/Demo/YYTextDemo/YYTextAsyncExample.m @@ -120,11 +120,16 @@ - (void)viewDidLoad { UIView *toolbar; + UIVisualEffectView *toolbarEffectView; if ([UIVisualEffectView class]) { - toolbar = [[UIVisualEffectView alloc] initWithEffect:[UIBlurEffect effectWithStyle:UIBlurEffectStyleExtraLight]]; + toolbarEffectView = [[UIVisualEffectView alloc] initWithEffect:[UIBlurEffect effectWithStyle:UIBlurEffectStyleExtraLight]]; + toolbar = [UIView new]; + [toolbarEffectView.contentView addSubview:toolbar]; } else { toolbar = [UIToolbar new]; } + + toolbar.size = CGSizeMake(kScreenWidth, 40); toolbar.top = kiOS7Later ? 64 : 0; [self.view addSubview:toolbar]; diff --git a/Demo/YYTextDemo/YYTextEditExample.m b/Demo/YYTextDemo/YYTextEditExample.m index 7329418b..8722438c 100644 --- a/Demo/YYTextDemo/YYTextEditExample.m +++ b/Demo/YYTextDemo/YYTextEditExample.m @@ -39,8 +39,11 @@ - (void)viewDidLoad { __weak typeof(self) _self = self; UIView *toolbar; + UIVisualEffectView *toolbarEffectView; if ([UIVisualEffectView class]) { - toolbar = [[UIVisualEffectView alloc] initWithEffect:[UIBlurEffect effectWithStyle:UIBlurEffectStyleExtraLight]]; + toolbarEffectView = [[UIVisualEffectView alloc] initWithEffect:[UIBlurEffect effectWithStyle:UIBlurEffectStyleExtraLight]]; + toolbar = [UIView new]; + [toolbarEffectView.contentView addSubview:toolbar]; } else { toolbar = [UIToolbar new]; } diff --git a/YYText/Utility/YYTextAsyncLayer.m b/YYText/Utility/YYTextAsyncLayer.m index 9f09700a..242a2a47 100644 --- a/YYText/Utility/YYTextAsyncLayer.m +++ b/YYText/Utility/YYTextAsyncLayer.m @@ -130,7 +130,7 @@ - (void)_displayAsync:(BOOL)async { if (task.willDisplay) task.willDisplay(self); _YYTextSentinel *sentinel = _sentinel; int32_t value = sentinel.value; - BOOL (^isCancelled)() = ^BOOL() { + BOOL (^isCancelled)(void) = ^BOOL() { return value != sentinel.value; }; CGSize size = self.bounds.size; diff --git a/YYText/Utility/YYTextUtilities.h b/YYText/Utility/YYTextUtilities.h index 0c80199d..98c63825 100644 --- a/YYText/Utility/YYTextUtilities.h +++ b/YYText/Utility/YYTextUtilities.h @@ -233,13 +233,13 @@ static inline CGRect YYTextEmojiGetGlyphBoundingRectWithFontSize(CGFloat fontSiz Get the character set which should rotate in vertical form. @return The shared character set. */ -NSCharacterSet *YYTextVerticalFormRotateCharacterSet(); +NSCharacterSet *YYTextVerticalFormRotateCharacterSet(void); /** Get the character set which should rotate and move in vertical form. @return The shared character set. */ -NSCharacterSet *YYTextVerticalFormRotateAndMoveCharacterSet(); +NSCharacterSet *YYTextVerticalFormRotateAndMoveCharacterSet(void); @@ -364,10 +364,10 @@ static inline CGFloat YYTextCGPointGetDistanceToRect(CGPoint p, CGRect r) { /// Get main screen's scale. -CGFloat YYTextScreenScale(); +CGFloat YYTextScreenScale(void); /// Get main screen's size. Height is always larger than width. -CGSize YYTextScreenSize(); +CGSize YYTextScreenSize(void); /// Convert point to pixel. static inline CGFloat YYTextCGFloatToPixel(CGFloat value) { @@ -555,9 +555,9 @@ static inline CFRange YYTextCFRangeFromNSRange(NSRange range) { /// Returns YES in App Extension. -BOOL YYTextIsAppExtension(); +BOOL YYTextIsAppExtension(void); /// Returns nil in App Extension. -UIApplication * _Nullable YYTextSharedApplication(); +UIApplication * _Nullable YYTextSharedApplication(void); NS_ASSUME_NONNULL_END From f567cd7d2fb1f04be21279e9872305e06bcdb4a3 Mon Sep 17 00:00:00 2001 From: dchen Date: Sun, 30 Sep 2018 13:57:41 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E5=8F=88=E6=90=9E=E4=BA=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index cb9e9a61..ac7eefd9 100755 --- a/README.md +++ b/README.md @@ -1080,7 +1080,8 @@ debugOptions.CGGlyphBorderColor = [UIColor colorWithRed:1.000 green:0.524 blue:0 文档 ============== -你可以在 [CocoaDocs](http://cocoadocs.org/docsets/YYText/) 查看在线 API 文档,也可以用 [appledoc](https://github.com/tomaz/appledoc) 本地生成文档。 +你可以在 [CocoaDocs](http://cocoadocs.org/docsets/YYText/) 查看在线 API 文档, +也可以用 [appledoc](https://github.com/tomaz/appledoc) 本地生成文档。 系统要求