![]() What I forget exists is that you can ⌃+⇧+Click anywhere to add extra cursors. You can place additional cursors with the mouse via ⌃+⇧+Click or with column select (⌥+Click+Drag), or with the keyboard using ⌃+⇧+Up to column select up or ⌃+⇧+Down to column select down. The Xcode Source Editor now supports multi-cursor editing allowing you to quickly edit multiple ranges of code at once. Here’s what they said about multi-cursor editing: Go to the navigation bar, click the Go button while hosting the option key and go the library. Source Editor Release Notes for Xcode 10.Enter your Key ID, which you can find in the Apple Developer Portal (its. That was apparently a big year for the source editor as Apple published separate release notes: First, add the Push Notifications capability to your apps Xcode project. Apple added support to Xcode 10 back in 2018. Multi-cursor Editing (Control-Shift-Click) You can move all four cursors with keyboard arrow keys or hit the escape key to get out of multi-cursor mode. Note the four cursors positioned at the end of the let. ![]() Now if I type var I replace the let on all four lines in one go: ![]() If you don’t want to use the mouse you can select a column above or below the cursor position using the ⌃⇧+Up or ⌃+⇧+Down keys. Here I’ve dragged down with the mouse to select the let keyword on four consecutive lines: I’ve never known what to call it, but I think the multi-cursor feature that I use the most starts by holding down the option (⌥) key and dragging to select a column. Now you can let Xcode take care of the formatting.I recently found myself rediscovering Xcode’s multi-cursor support. This action needs "Accessibility" permissions, so you will need to navigate to "System Preferences" > "Security & Privacy" and give permission to Xcode. Add a new shortcut, the "Application" is XCode, the "Menu Title" is the name of our Quick Action (in my case XcodeFormatAndSave), and the "Keyboard Shortcut" is Cmd+S!Īnd there you go! If you go to Xcode and try to save a Swift file, it will run SwiftFormat before it saves.Īctually, it will probably throw an error. Go to "System Preferences" > "Keyboard" and pick the "Shortcuts" tab. Now the last step: Step 3: Add a Keyboard shortcut The steps to install a completion script depend on the shell that you use. We will address this further down the post!Īnd there you go! A Format and Save macro. xcodes can generate completion scripts which allow you to press the tab key on your keyboard to autocomplete commands and arguments when typing an xcodes command. If you try to run it via Automator you will probably get a permission related error. This action requires access to "Accessibility" permissions. Automator will place it directly into a macOS "Services" folder, and that will make it available in the "Xcode" > "Services" menu. I've changed the "Workflow receives" to "no input" and "in" to "Xcode". If it does exist then click "Format File", otherwise do nothing.Check to see if "SwiftFormat" > "Format File" menu item exists in Xcode.On run tell application "System Events" tell process "Xcode" set frontmost to true if menu item "Format File" of menu of menu item "SwiftFormat" of menu "Editor" of menu bar 1 exists thenĬlick menu item "Format File" of menu of menu item "SwiftFormat" of menu "Editor" of menu bar 1 end ifĬlick menu item "Save" of menu "File" of menu bar 1 end tell end tell return input
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |