Skip to content

Commit

Permalink
fix Xcode8 warning
Browse files Browse the repository at this point in the history
  • Loading branch information
ibireme committed Sep 13, 2016
1 parent 1a7834e commit a47f772
Show file tree
Hide file tree
Showing 9 changed files with 21 additions and 12 deletions.
10 changes: 7 additions & 3 deletions Framework/YYText.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@
D946DFD91BD2104E006B77F7 /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 0700;
LastUpgradeCheck = 0800;
ORGANIZATIONNAME = ibireme;
TargetAttributes = {
D946DFE11BD2104E006B77F7 = {
Expand Down Expand Up @@ -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";
Expand All @@ -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;
Expand All @@ -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";
Expand All @@ -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";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0700"
LastUpgradeVersion = "0800"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
1 change: 0 additions & 1 deletion YYText/Component/YYTextLayout.m
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,6 @@ + (instancetype)containerWithSize:(CGSize)size insets:(UIEdgeInsets)insets {
}

+ (instancetype)containerWithPath:(UIBezierPath *)path {
if (!path) return nil;
YYTextContainer *one = [self new];
one.path = path;
return one;
Expand Down
6 changes: 3 additions & 3 deletions YYText/Component/YYTextLine.h
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion YYText/Component/YYTextLine.m
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ - (void)dealloc {
if (_CTLine) CFRelease(_CTLine);
}

- (void)setCTLine:(CTLineRef)CTLine {
- (void)setCTLine:(_Nonnull CTLineRef)CTLine {
if (_CTLine != CTLine) {
if (CTLine) CFRetain(CTLine);
if (_CTLine) CFRelease(_CTLine);
Expand Down
6 changes: 6 additions & 0 deletions YYText/Utility/NSParagraphStyle+YYText.m
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,13 @@ + (NSParagraphStyle *)yy_styleWithCTStyle:(CTParagraphStyleRef)CTStyle {

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)) {
Expand Down Expand Up @@ -117,11 +120,14 @@ - (CTParagraphStyleRef)yy_CTStyle CF_RETURNS_RETAINED {
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;
Expand Down
2 changes: 1 addition & 1 deletion YYText/Utility/YYTextAsyncLayer.m
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ - (void)display {
#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);
Expand Down
2 changes: 1 addition & 1 deletion YYText/YYLabel.m
Original file line number Diff line number Diff line change
Expand Up @@ -1156,7 +1156,7 @@ - (YYTextAsyncLayerDisplayTask *)newAsyncDisplayTask {
}
[layer removeAnimationForKey:@"contents"];

YYLabel *view = layer.delegate;
__strong YYLabel *view = (YYLabel *)layer.delegate;
if (!view) return;
if (view->_state.layoutNeedUpdate && layoutUpdated) {
view->_innerLayout = layout;
Expand Down
2 changes: 1 addition & 1 deletion YYText/YYTextView.m
Original file line number Diff line number Diff line change
Expand Up @@ -1073,7 +1073,7 @@ - (YYTextRange *)_getClosestTokenRangeAtPosition:(YYTextPosition *)position {
}
}

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) {
Expand Down

0 comments on commit a47f772

Please sign in to comment.