Explorar o código

fix Xcode8 warning

ibireme %!s(int64=9) %!d(string=hai) anos
pai
achega
a47f7728a0

+ 7 - 3
Framework/YYText.xcodeproj/project.pbxproj

@@ -315,7 +315,7 @@
 		D946DFD91BD2104E006B77F7 /* Project object */ = {
 			isa = PBXProject;
 			attributes = {
-				LastUpgradeCheck = 0700;
+				LastUpgradeCheck = 0800;
 				ORGANIZATIONNAME = ibireme;
 				TargetAttributes = {
 					D946DFE11BD2104E006B77F7 = {
@@ -398,8 +398,10 @@
 				CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
 				CLANG_WARN_EMPTY_BODY = YES;
 				CLANG_WARN_ENUM_CONVERSION = YES;
+				CLANG_WARN_INFINITE_RECURSION = YES;
 				CLANG_WARN_INT_CONVERSION = YES;
 				CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
+				CLANG_WARN_SUSPICIOUS_MOVE = YES;
 				CLANG_WARN_UNREACHABLE_CODE = YES;
 				CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
 				"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
@@ -422,7 +424,7 @@
 				GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
 				GCC_WARN_UNUSED_FUNCTION = YES;
 				GCC_WARN_UNUSED_VARIABLE = YES;
-				IPHONEOS_DEPLOYMENT_TARGET = 9.0;
+				IPHONEOS_DEPLOYMENT_TARGET = 8.0;
 				MTL_ENABLE_DEBUG_INFO = YES;
 				ONLY_ACTIVE_ARCH = YES;
 				SDKROOT = iphoneos;
@@ -445,8 +447,10 @@
 				CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
 				CLANG_WARN_EMPTY_BODY = YES;
 				CLANG_WARN_ENUM_CONVERSION = YES;
+				CLANG_WARN_INFINITE_RECURSION = YES;
 				CLANG_WARN_INT_CONVERSION = YES;
 				CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
+				CLANG_WARN_SUSPICIOUS_MOVE = YES;
 				CLANG_WARN_UNREACHABLE_CODE = YES;
 				CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
 				"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
@@ -463,7 +467,7 @@
 				GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
 				GCC_WARN_UNUSED_FUNCTION = YES;
 				GCC_WARN_UNUSED_VARIABLE = YES;
-				IPHONEOS_DEPLOYMENT_TARGET = 9.0;
+				IPHONEOS_DEPLOYMENT_TARGET = 8.0;
 				MTL_ENABLE_DEBUG_INFO = NO;
 				SDKROOT = iphoneos;
 				TARGETED_DEVICE_FAMILY = "1,2";

+ 1 - 1
Framework/YYText.xcodeproj/xcshareddata/xcschemes/YYText.xcscheme

@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <Scheme
-   LastUpgradeVersion = "0700"
+   LastUpgradeVersion = "0800"
    version = "1.3">
    <BuildAction
       parallelizeBuildables = "YES"

+ 0 - 1
YYText/Component/YYTextLayout.m

@@ -111,7 +111,6 @@ static CGColorRef YYTextGetCGColor(CGColorRef color) {
 }
 
 + (instancetype)containerWithPath:(UIBezierPath *)path {
-    if (!path) return nil;
     YYTextContainer *one = [self new];
     one.path = path;
     return one;

+ 3 - 3
YYText/Component/YYTextLine.h

@@ -53,9 +53,9 @@ NS_ASSUME_NONNULL_BEGIN
 @property (nonatomic, readonly) CGFloat lineWidth;  ///< line width
 @property (nonatomic, readonly) CGFloat trailingWhitespaceWidth;
 
-@property (nonatomic, readonly) NSArray<YYTextAttachment *> *attachments; ///< YYTextAttachment
-@property (nonatomic, readonly) NSArray<NSValue *> *attachmentRanges;     ///< NSRange(NSValue)
-@property (nonatomic, readonly) NSArray<NSValue *> *attachmentRects;      ///< CGRect(NSValue)
+@property (nullable, nonatomic, readonly) NSArray<YYTextAttachment *> *attachments; ///< YYTextAttachment
+@property (nullable, nonatomic, readonly) NSArray<NSValue *> *attachmentRanges;     ///< NSRange(NSValue)
+@property (nullable, nonatomic, readonly) NSArray<NSValue *> *attachmentRects;      ///< CGRect(NSValue)
 
 @end
 

+ 1 - 1
YYText/Component/YYTextLine.m

@@ -30,7 +30,7 @@
     if (_CTLine) CFRelease(_CTLine);
 }
 
-- (void)setCTLine:(CTLineRef)CTLine {
+- (void)setCTLine:(_Nonnull CTLineRef)CTLine {
     if (_CTLine != CTLine) {
         if (CTLine) CFRetain(CTLine);
         if (_CTLine) CFRelease(_CTLine);

+ 6 - 0
YYText/Utility/NSParagraphStyle+YYText.m

@@ -25,10 +25,13 @@
     
     NSMutableParagraphStyle *style = [[NSParagraphStyle defaultParagraphStyle] mutableCopy];
     
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wdeprecated-declarations"
     CGFloat lineSpacing;
     if (CTParagraphStyleGetValueForSpecifier(CTStyle, kCTParagraphStyleSpecifierLineSpacing, sizeof(CGFloat), &lineSpacing)) {
         style.lineSpacing = lineSpacing;
     }
+#pragma clang diagnostic pop
     
     CGFloat paragraphSpacing;
     if (CTParagraphStyleGetValueForSpecifier(CTStyle, kCTParagraphStyleSpecifierParagraphSpacing, sizeof(CGFloat), &paragraphSpacing)) {
@@ -117,11 +120,14 @@
     CTParagraphStyleSetting set[kCTParagraphStyleSpecifierCount] = { 0 };
     int count = 0;
     
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wdeprecated-declarations"
     CGFloat lineSpacing = self.lineSpacing;
     set[count].spec = kCTParagraphStyleSpecifierLineSpacing;
     set[count].valueSize = sizeof(CGFloat);
     set[count].value = &lineSpacing;
     count++;
+#pragma clang diagnostic pop
     
     CGFloat paragraphSpacing = self.paragraphSpacing;
     set[count].spec = kCTParagraphStyleSpecifierParagraphSpacing;

+ 1 - 1
YYText/Utility/YYTextAsyncLayer.m

@@ -117,7 +117,7 @@ static dispatch_queue_t YYTextAsyncLayerGetReleaseQueue() {
 #pragma mark - Private
 
 - (void)_displayAsync:(BOOL)async {
-    __strong id<YYTextAsyncLayerDelegate> delegate = self.delegate;
+    __strong id<YYTextAsyncLayerDelegate> delegate = (id)self.delegate;
     YYTextAsyncLayerDisplayTask *task = [delegate newAsyncDisplayTask];
     if (!task.display) {
         if (task.willDisplay) task.willDisplay(self);

+ 1 - 1
YYText/YYLabel.m

@@ -1156,7 +1156,7 @@ static dispatch_queue_t YYLabelGetReleaseQueue() {
         }
         [layer removeAnimationForKey:@"contents"];
         
-        YYLabel *view = layer.delegate;
+        __strong YYLabel *view = (YYLabel *)layer.delegate;
         if (!view) return;
         if (view->_state.layoutNeedUpdate && layoutUpdated) {
             view->_innerLayout = layout;

+ 1 - 1
YYText/YYTextView.m

@@ -1073,7 +1073,7 @@ typedef NS_ENUM(NSUInteger, YYTextMoveDirection) {
         }
     }
     
-    if (range.asRange.length == 0) {
+    if (!range || range.asRange.length == 0) {
         range = [_innerLayout textRangeByExtendingPosition:position inDirection:UITextLayoutDirectionRight offset:1];
         range = [self _correctedTextRange:range];
         if (range.asRange.length == 0) {