Xcode extension provide a way to extend Xcode functionality for the source editor. As stated by Apple: > New Xcode extensions for the source editor let you customize your coding experience. Extensions are a new feature in Xcode 8.
Questions tagged [xcode-extension]
32 questions
19
votes
3 answers
Xcode 8 Extension Not Visible In Editor Menu
I have the Xcode 8 GM installed and am trying to mess around with the editor extensions. I've followed the tutorial on this site:
https://littlebitesofcocoa.com/239-creating-an-xcode-source-editor-extension
but for some reason when I run the…

RPK
- 1,830
- 14
- 30
10
votes
2 answers
How to install Xcode source editor extension?
I created a source editor extension but don't understand how to use it. It works fine in debugging version of Xcode (with gray icon) but I cannot find a way to install this extension to "real" Xcode. Documentation is quite obscure for this topic.…

Alexander Doloz
- 4,078
- 1
- 20
- 36
10
votes
2 answers
Xcode 8 extension executing NSTask
My goal is to create an extension that executes clang-format. My code looks something like this:
- (void)performCommandWithInvocation:(XCSourceEditorCommandInvocation *)invocation completionHandler:(void (^)(NSError * _Nullable…

Guy Kogus
- 7,251
- 1
- 27
- 32
7
votes
1 answer
Is it possible to apply an Xcode extension to multiple source files at once? If so, how?
I want to write an Xcode extension that scans the source code for particular code fragments. However, it seems that such extension would work only on a per-file basis. For example, here you can see that upon pushing a button only the current source…

You_got_it
- 331
- 3
- 12
7
votes
1 answer
Xcode 8 Extension disabled
I tried to create new Xcode 8 Source Editor Extension, but for some reason basic examples are always disabled(screenshot) for me and I am not sure whether it is some bug with beta version or I am missing something.
So I created almost basic…

B.S.
- 21,660
- 14
- 87
- 109
6
votes
0 answers
XcodeKit extension cursor position
I am creating for myself Xcode 8 extension with new XcodeKit. I get text with XCSourceTextBuffer and range with XCSourceTextRange. With that I have start and end position of selected text and I can append some text to beginning of the line. The…

Flipper
- 1,107
- 1
- 11
- 32
3
votes
5 answers
Can't get a Source Editor extension working in Xcode 10
Using Xcode 10 running in Mojave I can't get a simple test source editor extension working. I use to be able to do it under Xcode 9 High Sierra. I created a bare bones source editor extension. I then run it but doesn't show up under the debut Xcode…

mretondo
- 187
- 1
- 9
3
votes
2 answers
Can't change share extension navigation bar title color (Swift)
I am trying to change the navigation bars title color using the below code but it won't change. The tint and background color work perfectly.
let nav = navigationController?.navigationBar
nav?.titleTextAttributes =…

Connor V
- 231
- 3
- 15
3
votes
1 answer
Why are app group (i.e. suiteName)-based NSUserDefaults returning different instances?
Kinda stumped by this. I'm working on an Xcode extension that needs to communicate with its container app via NSUserDefaults. To do this, you need to set up an app group entitlement in both the extension and the container app, sign your app, then…

Mark A. Donohoe
- 28,442
- 25
- 137
- 286
3
votes
2 answers
xcode 8 searching for editor extensions
Xcode8 now officially support editor extensions, and forbids code injection, preventing previous extensions (served by Alcatraz for example) to execute.
It may be a dumb question, but I'm totally unable to find an answer:
Where can I search for…

Martin
- 11,881
- 6
- 64
- 110
3
votes
4 answers
Documentation for Xcode Source Editor Extension
I'm looking for some documentation of the new Xcode Source Editor Extensions in Xcode 8.
As far as I can see there is only the "documentation" found in the header file for XcodeKit. Would be great to get something that's more detailed and more…

benrudhart
- 1,406
- 2
- 13
- 25
2
votes
1 answer
How do I allow my Xcode Source Editor Extension to use XPC?
In this article on Xcode Source Editor extensions, it mentions that XPC is a way to circumvent the app sandbox:
The extension must be sandboxed just to be loaded by Xcode, whereas calls to SourceKit needs to be un-sandboxed, which of course won’t…

Senseful
- 86,719
- 67
- 308
- 465
2
votes
0 answers
How do I read from a folder in the user's home directory from an Xcode Source Editor Extension?
I created an Xcode Source Editor Extension. I'd like to build a linting command, for example. The user's existing lint file is located in a location like /Users/Tim/CalculatorApp/swiftlint.yml.
If I try to use try! String(contentsOfFile:…

Senseful
- 86,719
- 67
- 308
- 465
2
votes
0 answers
upgraded to "Xcode 10" and now my Source Editor extension is not displayed under the Editor menu
I opened my Source Editor Extension I created in Xcode 9 in Xcode 10.0. I tried to debug it but it doesn't show up under the Editor menu. It's not listed in System Preferences either. I'm thinking that I need to update a setting somewhere. Any…

mretondo
- 187
- 1
- 9
2
votes
1 answer
Get project location for Xcode extension
I'm working on an Xcode extension, which needs to get the project path, i.e. the path of the project/workspace from which you run the extension command which I'm making. I've tried something like this:
let workspace = NSWorkspace.shared()
let path =…

damjandd
- 708
- 2
- 9
- 24