Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Dump the Swift-synthesized headers for a module
#! /bin/sh
# usage: <shellscript> [--osx] typename
if [ "$1" = "--osx" ] ; then
echo ":print_module $2" | xcrun swift -deprecated-integrated-repl
else
sdk_path=$(echo `xcrun --show-sdk-path` | sed 's#MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk#iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator8.1.sdk#')
echo ":print_module $1" | xcrun swift -deprecated-integrated-repl -sdk "$sdk_path"
fi

I just learned from https://bugs.swift.org/browse/SR-2502 that :type lookup Foo works in the non-deprecated REPL (just regular swift)!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment