From 55e289836ed0c47ad9738a3f85704bf53ca40f20 Mon Sep 17 00:00:00 2001 From: Levi McCallum Date: Wed, 27 Jan 2016 18:34:21 -0800 Subject: [PATCH] Clean up output of NSStringFromASInterfaceState --- AsyncDisplayKit/ASDisplayNodeExtras.h | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/AsyncDisplayKit/ASDisplayNodeExtras.h b/AsyncDisplayKit/ASDisplayNodeExtras.h index 7cdecda107..319b5ff62d 100644 --- a/AsyncDisplayKit/ASDisplayNodeExtras.h +++ b/AsyncDisplayKit/ASDisplayNodeExtras.h @@ -36,24 +36,23 @@ inline BOOL ASInterfaceStateIncludesMeasureLayout(ASInterfaceState interfaceStat inline NSString * _Nonnull NSStringFromASInterfaceState(ASInterfaceState interfaceState) { - NSMutableString *result = [NSMutableString stringWithString:@"{ "]; + NSMutableArray *states = [NSMutableArray array]; if (interfaceState == ASInterfaceStateNone) { - [result appendString:@"No state"]; + [states addObject:@"No state"]; } if (ASInterfaceStateIncludesMeasureLayout(interfaceState)) { - [result appendString:@"MeasureLayout"]; + [states addObject:@"MeasureLayout"]; } if (ASInterfaceStateIncludesFetchData(interfaceState)) { - [result appendString:@" | FetchData"]; + [states addObject:@" | FetchData"]; } if (ASInterfaceStateIncludesDisplay(interfaceState)) { - [result appendString:@" | Display"]; + [states addObject:@" | Display"]; } if (ASInterfaceStateIncludesVisible(interfaceState)) { - [result appendString:@" | Visible"]; + [states addObject:@" | Visible"]; } - [result appendString:@" }"]; - return result; + return [NSString stringWithFormat:@"{ %@ }", [states componentsJoinedByString:@" | "]]; } NS_ASSUME_NONNULL_BEGIN