Octopus for Xcode is a source editor extension that adds several convenience features.
- Expand selection selects the nearest scope that contains the current selection.
- Shrink selection goes back to the previous selection.
expand-shrink.mov
- Select next/previous command finds the next/previous instance of the selected text in the current file and adds a selection for it. Unlike a similar feature built into Xcode, it allows you to backtrack if you end up selecting too many instances.
- Select all occurrences selects all instances at once.
select-next-previous-all.mov
This feature provides better Xcode integration with nicklockwood/SwiftFormat.
It combines the benefits of an Xcode extension, like:
- formatting instantly by pressing a shortcut,
- keeping the undo history for the formatted file,
- formatting only selected code
with the benefits of formatting via command line:
- automatically using the correct project-specific and folder-specific configs,
- taking
.swift-versioninto account.
- Xcode 16+
- Swift code (Objective-C and other languages are not supported).
Octopus may work in Xcode versions as old as 8, but it has not been tested with anything older than Xcode 16.
Octopus for Xcode doesn't collect or send any information, even analytics. Nothing ever leaves your computer.
-
Download Octopus.zip from the Releases page.
-
Unzip the file, move Octopus.app to the Applications folder.
-
Launch Octopus.app. This will automatically add a login item.
-
On launch, Octopus will request accessibility permissions. Press the Open System Settings button:
Alternatively, go to Settings > Privacy & Security > Accessibility
Enable the toggle for Octopus:
-
Open Settings > General > Login Settings & Extensions. Scroll down to the App Background Activity section and make sure the item for Octopus is enabled:
While on the same page, scroll down to the Extensions section and select By Category. Then find the Xcode Source Editor item and press the "i" button next to it:
In the dialog that opens, make sure the Octopus extension is enabled:
-
Start Xcode. When you open a project, you should see the Octopus submenu in the Editor menu:
-
(Optional) Assign shortcuts for Octopus commands in Xcode settings (no shortcuts are assigned by default).
- Download the new version of Octopus from the Releases page.
- Quit Xcode and the Octopus app using the menu bar item.
- Replace Octopus.app in the Applications folder with the new version.
- Start Xcode and Octopus.