Skip to content

Commit a47f772

Browse files
committed
fix Xcode8 warning
1 parent 1a7834e commit a47f772

File tree

9 files changed

+21
-12
lines changed

9 files changed

+21
-12
lines changed

Framework/YYText.xcodeproj/project.pbxproj

+7-3
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@
315315
D946DFD91BD2104E006B77F7 /* Project object */ = {
316316
isa = PBXProject;
317317
attributes = {
318-
LastUpgradeCheck = 0700;
318+
LastUpgradeCheck = 0800;
319319
ORGANIZATIONNAME = ibireme;
320320
TargetAttributes = {
321321
D946DFE11BD2104E006B77F7 = {
@@ -398,8 +398,10 @@
398398
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
399399
CLANG_WARN_EMPTY_BODY = YES;
400400
CLANG_WARN_ENUM_CONVERSION = YES;
401+
CLANG_WARN_INFINITE_RECURSION = YES;
401402
CLANG_WARN_INT_CONVERSION = YES;
402403
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
404+
CLANG_WARN_SUSPICIOUS_MOVE = YES;
403405
CLANG_WARN_UNREACHABLE_CODE = YES;
404406
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
405407
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
@@ -422,7 +424,7 @@
422424
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
423425
GCC_WARN_UNUSED_FUNCTION = YES;
424426
GCC_WARN_UNUSED_VARIABLE = YES;
425-
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
427+
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
426428
MTL_ENABLE_DEBUG_INFO = YES;
427429
ONLY_ACTIVE_ARCH = YES;
428430
SDKROOT = iphoneos;
@@ -445,8 +447,10 @@
445447
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
446448
CLANG_WARN_EMPTY_BODY = YES;
447449
CLANG_WARN_ENUM_CONVERSION = YES;
450+
CLANG_WARN_INFINITE_RECURSION = YES;
448451
CLANG_WARN_INT_CONVERSION = YES;
449452
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
453+
CLANG_WARN_SUSPICIOUS_MOVE = YES;
450454
CLANG_WARN_UNREACHABLE_CODE = YES;
451455
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
452456
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
@@ -463,7 +467,7 @@
463467
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
464468
GCC_WARN_UNUSED_FUNCTION = YES;
465469
GCC_WARN_UNUSED_VARIABLE = YES;
466-
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
470+
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
467471
MTL_ENABLE_DEBUG_INFO = NO;
468472
SDKROOT = iphoneos;
469473
TARGETED_DEVICE_FAMILY = "1,2";

Framework/YYText.xcodeproj/xcshareddata/xcschemes/YYText.xcscheme

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<Scheme
3-
LastUpgradeVersion = "0700"
3+
LastUpgradeVersion = "0800"
44
version = "1.3">
55
<BuildAction
66
parallelizeBuildables = "YES"

YYText/Component/YYTextLayout.m

-1
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,6 @@ + (instancetype)containerWithSize:(CGSize)size insets:(UIEdgeInsets)insets {
111111
}
112112

113113
+ (instancetype)containerWithPath:(UIBezierPath *)path {
114-
if (!path) return nil;
115114
YYTextContainer *one = [self new];
116115
one.path = path;
117116
return one;

YYText/Component/YYTextLine.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,9 @@ NS_ASSUME_NONNULL_BEGIN
5353
@property (nonatomic, readonly) CGFloat lineWidth; ///< line width
5454
@property (nonatomic, readonly) CGFloat trailingWhitespaceWidth;
5555

56-
@property (nonatomic, readonly) NSArray<YYTextAttachment *> *attachments; ///< YYTextAttachment
57-
@property (nonatomic, readonly) NSArray<NSValue *> *attachmentRanges; ///< NSRange(NSValue)
58-
@property (nonatomic, readonly) NSArray<NSValue *> *attachmentRects; ///< CGRect(NSValue)
56+
@property (nullable, nonatomic, readonly) NSArray<YYTextAttachment *> *attachments; ///< YYTextAttachment
57+
@property (nullable, nonatomic, readonly) NSArray<NSValue *> *attachmentRanges; ///< NSRange(NSValue)
58+
@property (nullable, nonatomic, readonly) NSArray<NSValue *> *attachmentRects; ///< CGRect(NSValue)
5959

6060
@end
6161

YYText/Component/YYTextLine.m

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ - (void)dealloc {
3030
if (_CTLine) CFRelease(_CTLine);
3131
}
3232

33-
- (void)setCTLine:(CTLineRef)CTLine {
33+
- (void)setCTLine:(_Nonnull CTLineRef)CTLine {
3434
if (_CTLine != CTLine) {
3535
if (CTLine) CFRetain(CTLine);
3636
if (_CTLine) CFRelease(_CTLine);

YYText/Utility/NSParagraphStyle+YYText.m

+6
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,13 @@ + (NSParagraphStyle *)yy_styleWithCTStyle:(CTParagraphStyleRef)CTStyle {
2525

2626
NSMutableParagraphStyle *style = [[NSParagraphStyle defaultParagraphStyle] mutableCopy];
2727

28+
#pragma clang diagnostic push
29+
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
2830
CGFloat lineSpacing;
2931
if (CTParagraphStyleGetValueForSpecifier(CTStyle, kCTParagraphStyleSpecifierLineSpacing, sizeof(CGFloat), &lineSpacing)) {
3032
style.lineSpacing = lineSpacing;
3133
}
34+
#pragma clang diagnostic pop
3235

3336
CGFloat paragraphSpacing;
3437
if (CTParagraphStyleGetValueForSpecifier(CTStyle, kCTParagraphStyleSpecifierParagraphSpacing, sizeof(CGFloat), &paragraphSpacing)) {
@@ -117,11 +120,14 @@ - (CTParagraphStyleRef)yy_CTStyle CF_RETURNS_RETAINED {
117120
CTParagraphStyleSetting set[kCTParagraphStyleSpecifierCount] = { 0 };
118121
int count = 0;
119122

123+
#pragma clang diagnostic push
124+
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
120125
CGFloat lineSpacing = self.lineSpacing;
121126
set[count].spec = kCTParagraphStyleSpecifierLineSpacing;
122127
set[count].valueSize = sizeof(CGFloat);
123128
set[count].value = &lineSpacing;
124129
count++;
130+
#pragma clang diagnostic pop
125131

126132
CGFloat paragraphSpacing = self.paragraphSpacing;
127133
set[count].spec = kCTParagraphStyleSpecifierParagraphSpacing;

YYText/Utility/YYTextAsyncLayer.m

+1-1
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ - (void)display {
117117
#pragma mark - Private
118118

119119
- (void)_displayAsync:(BOOL)async {
120-
__strong id<YYTextAsyncLayerDelegate> delegate = self.delegate;
120+
__strong id<YYTextAsyncLayerDelegate> delegate = (id)self.delegate;
121121
YYTextAsyncLayerDisplayTask *task = [delegate newAsyncDisplayTask];
122122
if (!task.display) {
123123
if (task.willDisplay) task.willDisplay(self);

YYText/YYLabel.m

+1-1
Original file line numberDiff line numberDiff line change
@@ -1156,7 +1156,7 @@ - (YYTextAsyncLayerDisplayTask *)newAsyncDisplayTask {
11561156
}
11571157
[layer removeAnimationForKey:@"contents"];
11581158

1159-
YYLabel *view = layer.delegate;
1159+
__strong YYLabel *view = (YYLabel *)layer.delegate;
11601160
if (!view) return;
11611161
if (view->_state.layoutNeedUpdate && layoutUpdated) {
11621162
view->_innerLayout = layout;

YYText/YYTextView.m

+1-1
Original file line numberDiff line numberDiff line change
@@ -1073,7 +1073,7 @@ - (YYTextRange *)_getClosestTokenRangeAtPosition:(YYTextPosition *)position {
10731073
}
10741074
}
10751075

1076-
if (range.asRange.length == 0) {
1076+
if (!range || range.asRange.length == 0) {
10771077
range = [_innerLayout textRangeByExtendingPosition:position inDirection:UITextLayoutDirectionRight offset:1];
10781078
range = [self _correctedTextRange:range];
10791079
if (range.asRange.length == 0) {

0 commit comments

Comments
 (0)