You have some code you need to incorporate into a multi-line string. What’s the quickest and best way to handle it? Although I see people do this all the time, manually adding spaces to each line isn’t the best solution.
Here’s a quick Xcode tip:
- First, paste your material into scope. Retain the indentation by using Edit > Paste and Preserve Formatting.
- Next, if you haven’t placed them already, add the assignment and triple-quotes above and below the pasted material.
- Select your material and use Editor > Structure > Shift-Right (Command-]) to line up the left edge of the text with the closing triple-quote. This command moves all selected material n spaces to the right, depending on how you’ve set up your tabbing. There’s a matching Shift-Left if you indent a little too much.
Hope this helps someone.