Xcode Source Editor Extensions are really starting to come into their own. Today we'll look at one that solves an age-old annoyance for Xcode users: Importing.
We've all been there. We're deep down in the depths of file, and we realize we need to import
a module. We dutifully scroll all the way up, type the import, then scroll back down trying to find our place, and get back in "the zone". Yuck.
Let's try out a new Source Editor Extension (Bite #239) from Marko Hlebar called Import.
As the name suggests, it allows us to type an import Module
statement anywhere, then press a keyboard shortcut and have the import fly to the top where it belongs.
Let's try it out.
After installing the extension, we'll import CoreGraphics
.
Xcode's Autocomplete still works here to help us find the module we want to import. Neat!
By default the keyboard shortcut is Command + Control + P. This trigger is also available via the menu item: Editor > Import > ☝️.
Success! Now we don't have to lose our place, or our train of thought when we need to import
something.
Learn more about Import (including full installation instructions) at git.io/import