codenamepenryn
codenamepenryn

Reputation: 461

Replace defined code in Xcode with actual code

For example, if I have #define example(__thing__) [__thing__ doSomeStuff].

Later in the code, I write example(a) the compiler will treat it as [a doSomeStuff].

However, is there a way for it to replace it in the source code for debugging purposes? I want every occurrence of example(a) to be replaced with [a doSomeStuff]. Since the actual defined things are much longer it would be a lot easier to debug if I could see what the actual code is.

Upvotes: 1

Views: 126

Answers (2)

virindh
virindh

Reputation: 3765

Try, CMD + F and then there will be a small box that says 'Replace' then find example(a) and replace with [a doSomeStuff]. If you then want to undo, just reverse the fields.

UPDATE: If you are looking for batch find and replace, consider using wildcards: Find & Replace with a wildcard in Xcode 4

Upvotes: 0

Gavin
Gavin

Reputation: 8200

In Xcode, go to Product menu -> Perform Action -> Preprocess "".

This will give you the preprocessed output of your source. You can then see how your code actually looks when compiled. This won't help for debugging, but you could always copy the appropriate sections and paste it into the actual code for debugging purposes. Otherwise, it at least lets you see the preprocessed code. I think this is the closest you're going to get to what you want.

Upvotes: 6

Related Questions