Skip to content

Instantly share code, notes, and snippets.

@cdzombak
Created Jun 19, 2012
Embed
What would you like to do?
switch vs if with pointers (if C allowed switch on ptrs)
// `item` is a UINavigationItem*
if (item == self.welcomeNavItem) {
return NO;
}
else if (item == self.emailNavItem) {
[self transitionToWelcomeScreen:YES];
return YES;
}
else if (item == self.passwordNavItem) {
[self transitionToEmailScreen:YES];
return YES;
}
// `item` is a UINavigationItem*
switch(item) {
case self.welcomeNavItem:
return NO;
case self.emailNavItem:
[self transitionToWelcomeScreen:YES];
return YES;
case self.passwordNavItem:
[self transitionToEmailScreen:YES];
return YES;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment