Giter Site home page Giter Site logo

macschema's Introduction

macschema

GoDoc Go Report Card @progriumHQ on Twitter Project Forum Sponsor Project


Toolchain for generating JSON definitions for Apple APIs like this:

macschema example

Getting macschema

You can download from releases or use Homebrew:

$ brew install progrium/taps/macschema

Chrome is required for downloading topic data. You can also use headless Chrome in Docker. We recommend chromedp/headless-shell.

Using macschema

The macschema tool has several subcommands for downloading topics from Apple documentation and parsing topics into schemas. The commands will assume they can use two directories in the working directory: api and doc, where schemas and topics are downloaded and saved as JSON.

To pull and show a schema, which will download relevant topics and parse into schema:

$ macschema pull appkit/nswindow --show

Other commands:

$ macschema
Generates JSON definitions for Apple APIs

Usage:
  macschema [command]

Available Commands:
  crawl       Downloads topics linked from a topic to doc dir
  fetch       Download a topic to doc dir
  help        Help about any command
  pull        Generate a schema in api dir fetching topics if needed

Flags:
  -h, --help          help for macschema
      --lang string   use language (default "objc")
      --show          show resulting JSON to stdout
  -v, --version       version for macschema

Use "macschema [command] --help" for more information about a command.

Project Status

Currently able to generate schemas for most classes, but other high level constructs coming soon:

  • Classes
  • Functions
  • Typedefs and enums
  • Constants / variables

Currently it focuses on Objective-C APIs, but is designed to support Swift in the future if needed.

Declaration Parsing / AST

There is a lexer/parser system and AST for Objective-C declarations in declparse. This is where most development will happen to support new language constructs, so if you run into a problem it may involve a declaration that has not been added to tests.

For debugging parser issues, you can use a lexer tool to see what tokens the parser is working with:

$ echo "@interface NSScreen : NSObject" | go run ./tools/lexer/main.go

About

macschema come out of the macdriver project, primarily for code generation use.

MIT Licensed

macschema's People

Contributors

progrium avatar anhoder avatar tmc avatar

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.