Skip to content

Instantly share code, notes, and snippets.

@nevyn
Created December 11, 2015 19:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nevyn/86c7f4710bf1ad48918b to your computer and use it in GitHub Desktop.
Save nevyn/86c7f4710bf1ad48918b to your computer and use it in GitHub Desktop.
Use loops instead of copy pasting
for(NSString *when in @[@"will", @"did"]) {
[_output writeRowWithValues:@[ // COLUMNS:
[NSString stringWithFormat:@"%.4f", [_output currentSessionTime]], // Time
type, // {interface|device}
when, // {will|did}
[NSString stringWithFormat:@"%d", newDegrees], // newOrientationInDegreesWhere0IsPortrait
[NSString stringWithFormat:@"%.2f", duration], // transitionDurationForInterfaceRotation
]];
}
NSString *when = @"will";
GFLog(GFDebug, @"%@ orientation %@ become %d°", type, when, newDegrees);
[_output writeRowWithValues:@[ // COLUMNS:
[NSString stringWithFormat:@"%.4f", [_output currentSessionTime]], // Time
type, // {interface|device}
when, // {will|did}
[NSString stringWithFormat:@"%d", newDegrees], // newOrientationInDegreesWhere0IsPortrait
[NSString stringWithFormat:@"%.2f", duration], // transitionDurationForInterfaceRotation
]];
when = @"did";
[_output writeRowWithValues:@[ // COLUMNS:
[NSString stringWithFormat:@"%.4f", [_output currentSessionTime]], // Time
type, // {interface|device}
when, // {will|did}
[NSString stringWithFormat:@"%d", newDegrees], // newOrientationInDegreesWhere0IsPortrait
[NSString stringWithFormat:@"%.2f", duration], // transitionDurationForInterfaceRotation
]];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment