{"id":13994139,"url":"https://github.com/keith/xcode-ast-dump","last_synced_at":"2025-10-02T23:35:12.909Z","repository":{"id":143169516,"uuid":"83176594","full_name":"keith/xcode-ast-dump","owner":"keith","description":"Dump the AST of your Swift Xcode project","archived":false,"fork":false,"pushed_at":"2017-10-17T19:26:44.000Z","size":10,"stargazers_count":84,"open_issues_count":1,"forks_count":5,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-01-09T03:22:58.806Z","etag":null,"topics":["ast","swift","xcode"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/keith.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2017-02-26T02:10:06.000Z","updated_at":"2024-12-27T01:40:25.000Z","dependencies_parsed_at":null,"dependency_job_id":"574a9183-dbdc-4534-b9a0-9e963f952014","html_url":"https://github.com/keith/xcode-ast-dump","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/keith%2Fxcode-ast-dump","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/keith%2Fxcode-ast-dump/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/keith%2Fxcode-ast-dump/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/keith%2Fxcode-ast-dump/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/keith","download_url":"https://codeload.github.com/keith/xcode-ast-dump/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":235050204,"owners_count":18927915,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ast","swift","xcode"],"created_at":"2024-08-09T14:02:43.609Z","updated_at":"2025-10-02T23:35:12.573Z","avatar_url":"https://github.com/keith.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"# xcode-ast-dump\n\nThis is a simple script for dumping the Swift AST from within Xcode.\nRead more about how and why this works\n[here](http://stackoverflow.com/a/42463996/902968).\n\n## Usage\n\nIn Xcode:\n\n1. In the build settings for the target that you're interested in\n   dumping the AST for, set the `SWIFT_EXEC` user defined build setting\n   to the path of `ast.py`.\n1. Add `AST_DUMP_FILE=\"$(SRCROOT)/$(TARGET_NAME).ast\"` to \n   `Preprocessor Macros`(`GCC_PREPROCESSOR_DEFINITIONS`) setting.\n   You can put any path you want. This path will be used for saving build \n   log information with ast tree dump\n1. Build the target\n1. Check output file, you set in `AST_DUMP_FILE` setting.\n\nIn a shell:\n\n1. Build your target normally\n1. Go to the Report Navigator\n1. Find the \"Compile Swift Sources\" step from your build (if it was an\n   incremental build you may have to clean your project first)\n1. Copy the arguments that were passed to `swiftc`\n1. Escape any special characters such as `\u0026` (Xcode escapes spaces but\n   not special shell characters. In order to pass them to this script\n   you'll have to escape them yourself)\n1. Run `./ast.py ARGUMENTS \u003e output.ast 2\u003e\u00261`\n\n### Notes\n\n- For larger projects this will take a very long time to run and may\n  cause Xcode to hang, if this happens it might be easier to run from a\n  shell\n- If you integrate the script in Xcode, the build will fail but the AST\n  output will still be in the build log\n- The larger the project, the larger the output, you may end up opening\n  a very large file\n- This script calls `swiftc` based on the environment variables from\n  Xcode, or the first one that's found in your `$PATH`. This may not be\n  what you expect. Set the `AST_SWIFTC` environment variable if you\n  would like to change this\n- This has only been tested with a small number of projects, please file\n  any issues you find\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkeith%2Fxcode-ast-dump","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkeith%2Fxcode-ast-dump","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkeith%2Fxcode-ast-dump/lists"}