Code Monkey home page Code Monkey 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.

xcode-graphql's People

Contributors

adysart avatar anhar avatar ankushsplash avatar calvincestari avatar craigsiemens avatar croberts22 avatar daisyramos317 avatar designatednerd avatar diraulo avatar donnywdavis avatar ferranabello avatar gois avatar jbouaziz avatar kdawgwilk avatar martijnwalraven avatar michaelnisi avatar mirko-milovanovic-vidiemme avatar noahemmet avatar nrivard avatar p4checo avatar peakematt avatar pwc3 avatar svc-secops avatar thexande avatar valentindusollier avatar valpertui avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

xcode-graphql's Issues

Initial Setup iOS SPM

I've been trying to work with the Getting Started documentation here... https://www.apollographql.com/docs/ios/get-started

But I'm struggling to work out what I need to do. I don't have any experience with setting up any GraphQL API and I feel like the docs assume quite a bit of knowledge. Either that or there are possibly missing a few steps?

I don't yet have a schema for the project we're working on. I'm just involved in the initial exploration of the Apollo SDK in the project and so I decided to use the StarWars schema mentioned here... https://www.apollographql.com/docs/ios/code-generation/downloading-schema

It mentions using the drop down menu on the right of the Apollo Studio screen to download the JSON file rather than the raw file.

But then it drops any mention of using the Star Wars schema. I have a [email protected] file in my project but I'm not sure what to do with it.

It says to run this line... swift package --allow-writing-to-package-directory apollo-initialize-codegen-config --schema-name ${MySchemaName}... Should I be using the downloaded star wars file to find the schema name? Is star-wars-swapi the schema name? Or is the schema name contained inside that file?

I also have an apollo-codegen-config file. But I'm also not sure what to do with that.

I've added the apollo-ios-cli to the package and I can right click and see the initialise, fetch, generate options but they don't seem to do anything.

I'm trying to follow the instructions for using a Package.swift file with SPM rather than doing it through Xcode.

I have a package and target in the SPM package called GraphQL located at ./Sources/GraphQL.

I'm stuck right now with trying to get hold of a .graphql or .graphqls file. I think I'm supposed to have some of those in the project but I can't find where I am supposed to get them from.

Thanks

Create an X-code extension for xcode GraphQL

Since Apple started code-signing Xcode with Xcode 9, Xcode plugins are no longer supported and it's recommended to use extensions

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. However given x-code extensions seem to be the way forward to support iOS developers individual add-on / plugin needs, we'll consider if it's worthy to create an extension that offers similar functionality to what is available in this x-code plugin.

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

This repository currently has no open or pending branches.

Vulnerabilities

Renovate has not found any CVEs on osv.dev.

Detected dependencies

circleci
.circleci/config.yml
  • secops 2.0.7

Cannot install add-on

Steps done:

  • cd into repo directory
  • perform ./setup.sh
  • restart Xcode

After restarting Xcode nothing happens. Plugin and spec files exist at required locations: ~/Library/Developer/Xcode/Plug-ins/ and ~/Library/Developer/Xcode/Specifications/.

Environment:

  • MacOS Ventura 13.6.4
  • Xcode 15.0.1

Xcode 11.5/11.6 Compatible

This plugin works with Xcode 11.5 because the UUID for that version is identical to 11.4. If you're having any trouble, please run the installer again. Thank you!

Edit, 7/15: Also with Xcode 11.6, still the same UUID

Segfault on open XCode 13.3 ARM

  1. checked out latest master
  2. ran ./setup.sh
  3. Open xcode

Result

  1. Accept plugin prompt opens and immediately crashes before any user interaction can be set.

Workaround:
leaving the language spec but removing the plug-in and XCode starts normally.

Version 13.3 (13E113)
macOS 12.3 M1

Logs:
Xcode-2022-03-19-175848.ips.zip

Version 11.4.1 (11E503a)

Not working on Version 11.4.1 (11E503a). I ran sudo ./setup.sh and restarted xcode but not highlighting.

Re-indent uses tabs when the project is set use spaces

I'm not sure if this is an issue with Xcode 12.2 or the plugin but when I press ^I (Editor > Structure > Re-indent), all the spaces used for indenting are changed to tabs.

Xcode shows shows that it should be using spaces in the File Inspector.
Padded Screen Shot 2020-12-03 at 1 17 35 PM

Installation issues

I had previously installed the syntax highlighting for Xcode 11, but noticed that it stopped working with Xcode 12. I deleted the plugin and specification files and tried the install script again, but it still did not work. I tried both setup.sh and setup-xcode11.sh. Neither script seems to work for me.

Here is the output that I get. It seems to be failing on the copy statement, which seems odd to me.

sudo xcode-graphql/setup.sh
+ plugins_dir=/Users/ddavis/Library/Developer/Xcode/Plug-ins/
+ '[' '!' -d /Users/ddavis/Library/Developer/Xcode/Plug-ins/ ']'
+ cp -r GraphQL.ideplugin /Users/ddavis/Library/Developer/Xcode/Plug-ins/
cp: GraphQL.ideplugin: No such file or directory
+ spec_dir=/Users/ddavis/Library/Developer/Xcode/Specifications
+ '[' '!' -d /Users/ddavis/Library/Developer/Xcode/Specifications ']'
+ echo '🎉 Apollo Xcode Add-ons installation has completed! Please restart Xcode and click "Load bundle" when an alert shows about GraphQL.ideplugin.'

If I run these commands directly in the terminal then the copy works.
sudo cp -r ~/Desktop/xcode-graphql/GraphQL.ideplugin ~/Library/Developer/Xcode/Plug-ins/
sudo cp ~/Desktop/xcode-graphql/GraphQL.xclangspec ~/Library/Developer/Xcode/Specifications/

Xcode 11.4 (11E146)

Looks like the plugin is not working for this particular version. Loaded bundle after ./setup.sh but still no highlighting.

Folder locations don't exist in Xcode 8.3.3

Neither of the two folders listed in the readme, are created by default for Xcode 8.3.3 installations. Should they be manually created, or is a different location necessary now?

~/Library/Developer/Xcode/Plug-ins
~/Library/Developer/Xcode/Specifications

Edit: I did go ahead and create the folders, and highlighting seems to be working now. I might recommend updating the readme to be more clear that those folders might need to be created.

XCode 12 : Could not find module ‘Apollo’ for target ‘arm64-apple-ios-simulator’; found: x86_64-apple-ios-simulator, x86_64

Our product is created on XCode base 3.2, Recently moved on to XCode 11.6 with New build system.

Initially we were getting some issue with pods and carthage while importing Apollo framework but We have implemented Apollo framework successfully by Swift package manager.

Now we are moving to XCode 12 and getting error on simulator "Could not find module ‘Apollo’ for target ‘arm64-apple-ios-simulator’; found: x86_64-apple-ios-simulator, x86_64".

It is successfully compiling for iOS Device and Build... Only issue with running on simulator.

Possible solution tried till now -
1)Adding arm64 in excluded architecture...errors are coming added screenshot.
Add Arm64 in exlude archi

2)Add valid architecture in build settings - from arm64 arm64e to arm64 arm64e x86_64 .... getting more errors.

It would be good if we can get some solution soon.

Thanks in advance.

  • blocking
  • good first issue

@designatednerd @apollo-cla

xcode 12 support

hello deras
is this plugin is supported on xcode 12 ?
Regards

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.