One thing I’ve noticed while working with iOS is that magic strings seem to be quite common.
They’re in Core Data:
[NSEntityDescription insertNewObjectForEntityForName:@"Foo" inManagedObjectContext:context];
They’re in Storyboards and View Controllers:
[self.storyboard instantiateViewControllerWithIdentifier:@"SomeViewControllerIdentifier"];
They’re in Segues:
[self performSegueWithIdentifier:@"SomeSegueIdentifier" sender:self];
They’re in sorting:
NSSortDescriptor* sortDescriptor = [[NSSortDescriptor alloc] initWithKey:@"name"
ascending:YES];
They’re in the instantiation of table cells:
static NSString* CellIdentifier = @"Cell";
UITableViewCell* cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
Coming from the C# world of lambdas, generics, first-class enums, and strong typing, I find all of this incredibly bizzare. But hey, who needs refactorability and type safety when you can use strings!