Reputation: 2550
If I use Xcode's "Find/Replace in workspace" it seems to skip any text contained in the UIViews in XIB files.
Anyway to do this in Xcode or do I need to use another tool?
Thanks!
Upvotes: 3
Views: 1104
Reputation: 8695
You can use find and sed from the command line
find . -name '*.xib' -type f -exec sed -i "" 's/OldText/NewText/g' {} \
For instance, I just had to find and replace all class prefixed from SC to MCSC and I used:
find . -name '*.xib' -type f -exec sed -i "" 's/[[:<:]]SC/MCSC/g' {} \
The [[:<:]] indicates a word boundary on OS X (see https://stackoverflow.com/a/5734237/456366).
Upvotes: 2
Reputation: 12900
XCode will successfully Refactor IBOutlet names even if they are connected up in the nib. So to answer you:
Before choosing Find/Replace on the text, first see if Xcode will Refactor it instead. It won't refactor certain things (such as enums and #defines). If it will Refactor your target text then choose that and it should be okay.
Upvotes: 2
Reputation: 18875
If you really have a lot of this text you want to find/replace, you might find IBTool usefull.
It's usually used to export/import texts from/into .XIB for translation reasons, but it should fit your needs, too.
You can see example of IBTool usage on iPhone Applications Localization Guide. You'd be interested in points 2 and 5 of the guide.
Upvotes: 1
Reputation: 11839
Find and replace option of Xcode if for text/string replacement not for files.
If you want to do this you can have your shell script/ apple script.
Upvotes: 1