jerrymarino / swiftplayground.vim Goto Github PK
View Code? Open in Web Editor NEWPlay with Swift code in Vim!
License: Other
Play with Swift code in Vim!
License: Other
It should be possible to compile and execute a playground for every Swift file.
A few important use cases come to mind that can leverage this:
Simple programs which are executable: a program where logic is in a main.swift.
Unit testing. Playgrounds are super applicable to unit testing, since it allows the user to see program state within a test case. This is easier to work with than the existing approach people have adpoted: copying all of the code they want to play with into a playground file.
I think this is a good addition and would make Swift development more interactive overall.
Many Swift files don't contain don't contain code that executes, so for a large subset of files, this isn't 100% useful. For example, MyModel.swift is just a class definition.
Copy all of the code in question into a playground.
At the compiler level, we are just performing a transform that inserts the playground logging code in a module. I think this pass should work for any file. In my initial testing, it seems to work fine on some sample code.
Pass 1 will use compile_commands.json
to get a base a compiler invocation and augment it to include the playground bits.
The embedded excerpt's of Apple's Playground runtime code no longer match the Playground runtime code which Apple ships, so the function signatures do not match, so this doesn't work anymore, I believe.
Details described here: https://gitlab.com/michael.sanders/swift-playground-mode/-/issues/3
Hi, I'm seeing the following errors when running SwiftPlayground.vim against the latest Xcode:
use of unresolved identifier '__builtin_log_with_id'; did you mean '$builtin_log_with_id'?
'$builtin_log_with_id' declared here
use of unresolved identifier '__builtin_log_with_id'; did you mean '$builtin_log_with_id'?
'$builtin_log_with_id' declared here
use of unresolved identifier '__builtin_log_scope_exit'; did you mean '$builtin_log_scope_exit'?
'$builtin_log_scope_exit' declared here
use of unresolved identifier '__builtin_log_scope_entry'; did you mean '$builtin_log_scope_entry'?
'$builtin_log_scope_entry' declared here
use of unresolved identifier '__builtin_log_scope_exit'; did you mean '$builtin_log_scope_exit'?
'$builtin_log_scope_exit' declared here
use of unresolved identifier '__builtin_log_with_id'; did you mean '$builtin_log_with_id'?
'$builtin_log_with_id' declared here
use of unresolved identifier '__builtin_log_with_id'; did you mean '$builtin_log_with_id'?
'$builtin_log_with_id' declared here
use of unresolved identifier '__builtin_log_with_id'; did you mean '$builtin_log_with_id'?
'$builtin_log_with_id' declared here
To reproduce, run
bash ./runner.sh ~/src/etc/SwiftPlayground.vim/TestPlayground.playground/Contents.swift
Any ideas?
By default, the playground is compiled and executed under OSX. It should be able to build run for both iOS and OSX.
Read in the contents.xcplayground
to determine an iOS ish invocation. Execute the program under the simulator for iOS.
xcplayground
stores the playground type in it's XML file which can be used to derive a base compiler invocation:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<playground version='5.0' target-platform='ios'>
<timeline fileName='timeline.xctimeline'/>
</playground>
Note: simctl spawn
will allow execution of the program in the background without booting up a simulator instance, so prefer this to save time
Does this project have a license? Interested in using the foundation to port over to another editor ๐
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.