$ echo 'public func f() { print("YES") }' > x.swift
$ swiftc -emit-library -emit-module -module-link-name x x.swift
$ swift -L . -I .
Welcome to Apple Swift version 5.4 (swiftlang-1205.0.26.9 clang-1205.0.19.55).
Type :help for assistance.
1> import x
import x
2> f()
f()
YES
Last active
May 18, 2021 00:16
-
-
Save dabrahams/c7de10507e98463e71bf8b4586f5e51a to your computer and use it in GitHub Desktop.
Linking and importing a swift module for use in the REPL
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks, updated the Gist for use with stock Swift.