Giter VIP home page Giter VIP logo

xcode-graphql's Introduction

Apollo Xcode Add-ons

These add-ons add syntax highlighting for GraphQL query document files to Xcode.

Wait, aren't Xcode plugins dead?

Since Apple started code-signing Xcode with Xcode 9, Xcode plugins are indeed mostly dead.

However, there are a few small, limited purposes for which they still work, including recognizing particular file types as tied to particular languages, which is what this plugin allows Xcode to do.

Installation via script

The fastest way to install is to cd into the directory where this repo has been checked out or downloaded, and run one of the included install scripts.

Once the setup script has finished, restart Xcode and click the "Load bundle" button on the permissions dialog that appears in Xcode when it restarts.

Anything other than Xcode 11

The script to run for versions of Xcode other than 11.x is setup.sh:

./setup.sh

Xcode 11

NOTE: This requires some mucking around with files provided directly by Xcode due to some bugs for adding syntax highlighting in Xcode 11. These issues are addressed as of Xcode 12 beta 2.

This all works as Xcode of 11.5, but be aware that it's a bit more fragile than we'd like it to be. Please file an issue on this repo if it stops working in a new version and we'll investigate.

The script to run for versions of Xcode other than 11.x is setup.sh:

sudo ./setup-xcode11.sh

Particularly if you are running Catalina, you will need to use sudo in order to make this work due to changes in the permissions model.

Manual installation

Due to the aforementioned broken APIs, manual installation works slightly differently for Xcode 11 vs. other versions.

Anything other than Xcode 11

Please note that the Plug-ins and Specifications directories might not exist, and if they don't, you'll need to create them.

  • Copy the GraphQL.ideplugin directory to ~/Library/Developer/Xcode/Plug-ins/:

     cp -r GraphQL.ideplugin ~/Library/Developer/Xcode/Plug-ins/
    
  • Copy the GraphQL.xclangspec file to ~/Library/Developer/Xcode/Specifications:

     cp GraphQL.xclangspec ~/Library/Developer/Xcode/Specifications/
    

Xcode 11

Note: On Catalina you will need to sudo to get these commands to work.

  • Copy the GraphQL.ideplugin directory to ~/Library/Developer/Xcode/Plug-ins/:

     cp -r GraphQL.ideplugin ~/Library/Developer/Xcode/Plug-ins/
    
  • Copy the GraphQL.xclangspec file to /Applications/Xcode.app/Contents/SharedFrameworks/SourceModel.framework/Versions/A/Resources/LanguageSpecifications:

     cp GraphQL.xclangspec /Applications/Xcode.app/Contents/SharedFrameworks/SourceModel.framework/Versions/A/Resources/LanguageSpecifications
    
  • Copy the Xcode.SourceCodeLanguage.GraphQL.plist file to /Applications/Xcode.app/Contents/SharedFrameworks/SourceModel.framework/Versions/A/Resources/LanguageMetadata:

cp Xcode.SourceCodeLanguage.GraphQL.plist /Applications/Xcode.app/Contents/SharedFrameworks/SourceModel.framework/Versions/A/Resources/LanguageMetadata

How to update this plugin for new versions of Xcode

  1. Install the new version of Xcode.

  2. Get the UUID of the version using the following command in Terminal:

    defaults read /Applications/Xcode.app/Contents/Info DVTPlugInCompatibilityUUID

    or, for beta versions,

    defaults read /Applications/Xcode-beta.app/Contents/Info DVTPlugInCompatibilityUUID

  3. Copy the UUID.

  4. Paste the UUID into the list of DVTPlugInCompatibilityUUIDs in Graphql.ideplugin/Contents/Info.plist. Do not remove any old IDs, just add the new one.

  5. Reinstall the plugin using whatever method you were using above. You will need to restart Xcode to validate that your changes worked.

  6. If it worked, submit a pull request with this change. If it didn't work, please file an issue.

Note that most UUIDs change from the beta to the final version, so we do not recommend adding UUIDs for betas except during "beta season" of an upcoming major release.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.