Giter Club home page Giter Club logo

swiftplayground.vim's People

Contributors

benwoodward avatar berrymelonteamblind avatar jerrymarino avatar msanders avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

swiftplayground.vim's Issues

Support Playgrounds in any Swift file

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.

Caveats

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.

Alternatives Considered

Copy all of the code in question into a playground.

Implementation

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.

Use of unresolved identifier '__builtin_log_with_id'

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?

iOS compilation & execution

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

License

Does this project have a license? Interested in using the foundation to port over to another editor ๐Ÿ™‚

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.