- Mastering macOS Programming
- Stuart Grimshaw
- 357字
- 2021-07-02 22:54:23
Behaviors
There's one little corner of Xcode that has huge potential to make your work with it significantly faster, smoother, and presumably more satisfying: Xcode Behaviors.
To get there, complete the following steps:
- Open up Xcode's Preferences window with command + ,(that is to say, command + comma).
- Select the Behaviors tab.
This is where you get to tell Xcode how you want things to be when it builds, tests, runs, searches, or engages in several other activities.
As an example, we're going to get Xcode to use a separate window for debug logging (it will create one if it doesn't exist yet), which will keep the code editor window that we are working in free of debug-clutter. The following screenshot shows the settings needed to make our new, non-disruptive, debug window:
This is especially useful when you are working with more than one monitor, or if you have a crazy-big screen with a corner free for a console.
You're not limited to setting Xcode's behavior while running the processes listed; you can also add custom behaviors which are triggered by keyboard shortcuts.
Have you ever wanted a button that made everything except your code just go away? The navigators, debugger, Utilities panes, all of it? Well this is where you can do just that:
- Click on the little button to the right of your custom behavior name, and enter the key combination that will be the shortcut.
- Give the new behavior a name more descriptive than New Behavior. I used Big Reset, but whatever floats your boat is good. There is now a new Custom category in the behaviors list, with your new behavior in it.
- At the bottom of the behaviors list on the left of the Behaviors tab, click the + button.
- Set the following values:
Given that these behaviors can launch scripts, you might like to use this as a method of running scripts via keyboard shortcuts.