Clean up output of NSStringFromASInterfaceState

This commit is contained in:
Levi McCallum
2016-01-27 18:34:21 -08:00
parent ee23830318
commit 55e289836e

View File

@@ -36,24 +36,23 @@ inline BOOL ASInterfaceStateIncludesMeasureLayout(ASInterfaceState interfaceStat
inline NSString * _Nonnull NSStringFromASInterfaceState(ASInterfaceState interfaceState) inline NSString * _Nonnull NSStringFromASInterfaceState(ASInterfaceState interfaceState)
{ {
NSMutableString *result = [NSMutableString stringWithString:@"{ "]; NSMutableArray *states = [NSMutableArray array];
if (interfaceState == ASInterfaceStateNone) { if (interfaceState == ASInterfaceStateNone) {
[result appendString:@"No state"]; [states addObject:@"No state"];
} }
if (ASInterfaceStateIncludesMeasureLayout(interfaceState)) { if (ASInterfaceStateIncludesMeasureLayout(interfaceState)) {
[result appendString:@"MeasureLayout"]; [states addObject:@"MeasureLayout"];
} }
if (ASInterfaceStateIncludesFetchData(interfaceState)) { if (ASInterfaceStateIncludesFetchData(interfaceState)) {
[result appendString:@" | FetchData"]; [states addObject:@" | FetchData"];
} }
if (ASInterfaceStateIncludesDisplay(interfaceState)) { if (ASInterfaceStateIncludesDisplay(interfaceState)) {
[result appendString:@" | Display"]; [states addObject:@" | Display"];
} }
if (ASInterfaceStateIncludesVisible(interfaceState)) { if (ASInterfaceStateIncludesVisible(interfaceState)) {
[result appendString:@" | Visible"]; [states addObject:@" | Visible"];
} }
[result appendString:@" }"]; return [NSString stringWithFormat:@"{ %@ }", [states componentsJoinedByString:@" | "]];
return result;
} }
NS_ASSUME_NONNULL_BEGIN NS_ASSUME_NONNULL_BEGIN