All Projects → profburke → swiftreplmadness

profburke / swiftreplmadness

Licence: other
Example of using your own packages in the Swift REPL

Programming Languages

swift
15916 projects
Makefile
30231 projects

Projects that are alternatives of or similar to swiftreplmadness

Calvin
A minimalistic build tool for clojurescript projects that does not require the jvm
Stars: ✭ 181 (+905.56%)
Mutual labels:  repl
Ldb
A C++ REPL / CLI for LevelDB
Stars: ✭ 201 (+1016.67%)
Mutual labels:  repl
Mond
A scripting language for .NET Core
Stars: ✭ 237 (+1216.67%)
Mutual labels:  repl
Fridayuserbot
A Pluggable And Powerful Telegram Manager Bot
Stars: ✭ 183 (+916.67%)
Mutual labels:  repl
Blazorrepl
Write, compile, execute and share Blazor components entirely in the browser
Stars: ✭ 196 (+988.89%)
Mutual labels:  repl
Vsh
vsh - HashiCorp Vault interactive shell and cli tool
Stars: ✭ 209 (+1061.11%)
Mutual labels:  repl
Elm Repl
A REPL for Elm
Stars: ✭ 174 (+866.67%)
Mutual labels:  repl
Ipython
Official repository for IPython itself. Other repos in the IPython organization contain things like the website, documentation builds, etc.
Stars: ✭ 15,107 (+83827.78%)
Mutual labels:  repl
Gluon
A static, type inferred and embeddable language written in Rust.
Stars: ✭ 2,457 (+13550%)
Mutual labels:  repl
Box
A mruby-based Builder for Docker Images
Stars: ✭ 236 (+1211.11%)
Mutual labels:  repl
Charly
🐈 The Charly Programming Language | Written by @KCreate
Stars: ✭ 185 (+927.78%)
Mutual labels:  repl
Dynaml
Scala Library/REPL for Machine Learning Research
Stars: ✭ 195 (+983.33%)
Mutual labels:  repl
Unrepl
A common ground for better Clojure REPLs
Stars: ✭ 222 (+1133.33%)
Mutual labels:  repl
Alive Progress
A new kind of Progress Bar, with real-time throughput, ETA, and very cool animations!
Stars: ✭ 2,940 (+16233.33%)
Mutual labels:  repl
Tslab
Interactive JavaScript and TypeScript programming with Jupyter
Stars: ✭ 240 (+1233.33%)
Mutual labels:  repl
Jupyter Php
A PHP Kernel for Jupyter
Stars: ✭ 179 (+894.44%)
Mutual labels:  repl
Codi.vim
📔 The interactive scratchpad for hackers.
Stars: ✭ 2,464 (+13588.89%)
Mutual labels:  repl
SwiftMC
A Minecraft server and proxy written from scratch in Swift.
Stars: ✭ 22 (+22.22%)
Mutual labels:  swift-package-manager
Go Pry
An interactive REPL for Go that allows you to drop into your code at any point.
Stars: ✭ 2,747 (+15161.11%)
Mutual labels:  repl
Lfortran
Official mirror of https://gitlab.com/lfortran/lfortran. Please submit pull requests (PR) there. Any PR sent here will be closed automatically.
Stars: ✭ 220 (+1122.22%)
Mutual labels:  repl

Swift REPL Madness

(Thanks to @Pitometsu I was able to update this for Swift 4)

In order to use a Swift package in the REPL you need to add a dynamic library product to Package.swift So, for example, if you have a package named Sample, you need to add the following to the package manifest:

products: [

    . . .
    
    .library(
        name: "Sample",
        type: .dynamic,
        targets: ["Sample"]),

    . . .

],        

Now build as usual:

swift build

Then to be able to use it from the REPL:

swift -I .build/debug -L .build/debug -lSample

At this point, the REPL will start up and from its prompt, you can import the package and use it's public declarations:

Welcome to Apple Swift version 4.0.2 (swiftlang-900.0.69.1....
  1> import Sample
  2> // do something with the Sample package...

See it in action

The code in this repo includes a sample package named swiftreplmadness which defines one public data type, simplestruct. You can use the included Makefile to build the package and start up the REPL. Simply change to the project's root directory and type make.

(Un)License

This is free and unencumbered software released into the public domain.

Anyone is free to copy, modify, publish, use, compile, sell, or distribute this software, either in source code form or as a compiled binary, for any purpose, commercial or non-commercial, and by any means.

In jurisdictions that recognize copyright laws, the author or authors of this software dedicate any and all copyright interest in the software to the public domain. We make this dedication for the benefit of the public at large and to the detriment of our heirs and successors. We intend this dedication to be an overt act of relinquishment in perpetuity of all present and future rights to this software under copyright law.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

For more information, please refer to http://unlicense.org/

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].