Giter Club home page Giter Club logo

swiftfiddle-web's People

Contributors

dependabot[bot] avatar github-actions[bot] avatar kaitomuraoka avatar kateinoigakukun avatar kishikawakatsumi avatar renovate-bot avatar renovate[bot] 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  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  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  avatar

swiftfiddle-web's Issues

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Repository problems

These problems occurred while renovating this repository. View logs.

  • WARN: Package lookup failures

Warning

Renovate failed to look up the following dependencies: Failed to look up npm package @fortawesome/pro-duotone-svg-icons, Failed to look up npm package @fortawesome/pro-light-svg-icons, Failed to look up npm package @fortawesome/pro-regular-svg-icons, Failed to look up npm package @fortawesome/pro-solid-svg-icons.

Files affected: package.json


Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Detected dependencies

dockerfile
Dockerfile
  • swift 5.10-jammy
  • swift 5.10-jammy-slim
github-actions
.github/workflows/codeql-analysis.yml
  • actions/checkout v4
  • github/codeql-action v3
  • github/codeql-action v3
  • github/codeql-action v3
.github/workflows/spm.yml
  • actions/checkout v4
.github/workflows/test.yml
  • actions/checkout v4
npm
package.json
  • @fortawesome/fontawesome-svg-core 6.5.2
  • @fortawesome/free-brands-svg-icons 6.5.2
  • @fortawesome/pro-duotone-svg-icons 6.4.0
  • @fortawesome/pro-light-svg-icons 6.4.0
  • @fortawesome/pro-regular-svg-icons 6.4.0
  • @fortawesome/pro-solid-svg-icons 6.4.0
  • @popperjs/core 2.11.8
  • bootstrap 5.3.3
  • monaco-editor 0.47.0
  • pako 2.1.0
  • plausible-tracker 0.3.8
  • reconnecting-websocket 4.4.0
  • xterm 5.3.0
  • xterm-addon-fit 0.8.0
  • xterm-addon-web-links 0.9.0
  • autoprefixer 10.4.19
  • copy-webpack-plugin 12.0.2
  • css-loader 7.1.1
  • html-webpack-plugin 5.6.0
  • mini-css-extract-plugin 2.8.1
  • monaco-editor-webpack-plugin 7.1.0
  • postcss 8.4.38
  • postcss-loader 8.1.1
  • sass 1.75.0
  • sass-loader 14.2.0
  • style-loader 4.0.0
  • webpack 5.91.0
  • webpack-bundle-analyzer 4.10.2
  • webpack-cli 5.1.4
  • webpack-merge 5.10.0
  • worker-loader 3.0.8
swift
Package.swift
  • vapor/vapor from: "4.92.6"
  • vapor/leaf from: "4.3.0"

  • Check this box to trigger a request for Renovate to run again on this repository

Ability to clear output

Recently you made a change for the command line output to remember previous output history.

Personally, I appreciated it when the command line was reset per run. It would be very great if there was a toggle for this kind of option that would be saved. Or even just a button to clear it, or even a keyboard shortcut like Cmd K in Xcode. The current workaround is to refresh the page (and remember to copy the code).

error: no such module 'SwiftUI'

Hi!

I'm new to Swift and I was trying to use the playground to create an HStack using this code:

struct ContentView: View {
    
    var body: some View {
        
        HStack {
                        
            Text("Some Text")
            Text("Another Text")
            
        }
        
    }
    
}

When running, the error occurred "cannot find type 'View' in scope"
Then I added "import SwiftUI" to the top of the code and the error changed to "no such module 'SwiftUI'".

As far as I understand, "View" is one of the most basic things in Swift. Is there a way I can use it in your playground?

How to copy code on iOS?

Today I was AFK, but needed to try out some Swift code for a StackOverflow answer. I used my iPhone and SwiftFiddle worked beautifully. 🚀

I could not find a simple way to copy the code I typed in though. I took the scenic route (screenshot, extract code via OCR). Is there a better way that I missed? If not, I would love a “Copy to Clipboard” button :)

Run an asynchronous task

Can I run an asynchronous task in swiftfiddle?
Nothing was printed with this code

import Foundation

let main = DispatchQueue.main

main.async {
    print("on main")
}

Share window does not appear

Hi,

When I try to share a code snipper, the share windows appears very briefly and then disappears. After that, this error appears

TypeError: Cannot set properties of null (setting 'href')

Thanks for providing this cool tool :)

Long execution time when sending a POST request using Swift

Simple code:

import Foundation

func sendPostRequest(urlString: String, headers: [String: String], jsonObject: [String: Any], completion: @escaping (Data?, URLResponse?, Error?) -> Void) {
    // Convert the JSON object to Data
    guard let jsonData = try? JSONSerialization.data(withJSONObject: jsonObject) else {
        print("Error converting JSON object to data")
        return
    }

    // Create the URL
    guard let url = URL(string: urlString) else {
        print("Invalid URL")
        return
    }

    // Create the request
    var request = URLRequest(url: url)
    request.httpMethod = "POST"
    request.allHTTPHeaderFields = headers
    request.httpBody = jsonData

    // Create the URLSession and task
    let session = URLSession.shared
    let task = session.dataTask(with: request, completionHandler: completion)

    // Start the task
    task.resume()
}

// Example usage
let url = "https://swiftfiddle.com/runner/5.9.2/run"
let headers = [
    "Content-Type": "application/json; charset=UTF-8"
]
let script = "print(\"Hello, Swift!\")"  // Replace this with your actual script
let jsonObject = [
    "code": script
]

sendPostRequest(urlString: url, headers: headers, jsonObject: jsonObject) { (data, response, error) in
    // Handle the response here
    if let error = error {
        print("Error: \(error)")
    } else if let data = data {
        if let resultString = String(data: data, encoding: .utf8) {
            print("Response: \(resultString)")
        } else {
            print("Unable to convert data to string")
        }
    } else {
        print("No data received")
    }
}

output:

Response: {"output":"Hello, Swift!\n","errors":"","version":"Swift version 5.9.2 (swift-5.9.2-RELEASE)\nTarget: x86_64-unknown-linux-gnu\n"}

Execution Time: Approximately 50 seconds.
Please note that the execution time for the same code and Swift version on the website is approximately 19 seconds.

Support for interactive input on terminal

Hi, I'd like to thank you for creating this great online swift playground.

The only thing lacks from this application is an interactive terminal. It seems I can't use readLine() function (will produces lots of error messages). The terminal also doesn't seem to support ANSI escape sequence, so this print("\u{1B}[93mTest") (should print Test in yellow) doesn't work either.

Other than that, it's a great online swift playground. Keep up the good work! 👍

Thank you.

Line and column numbers are wrong

code: print(
output: 2:1: error: expected expression in list of expressions
expected: 1:7: error: expected expression in list of expressions

Critical Bug

Any comment containing a single quote will trigger this bug.:

Example 1
code:

//'
print("hello")

output:

//
sh: 2: Syntax error: word unexpected (expecting ")")

Example 2
code:

//blah blah blah
//blah blah bla'h
//blah blah blah
//blah blah blah
//blah blah blah

output:

//blah blah blah
//blah blah blah
sh: 3: 
//blah: not found
sh: 4: //blah: not found
sh: 5: 
Syntax error: Unterminated quoted string

Laggy Editor

SwiftFiddle has possibly the laggiest editor I've ever used. Even things like Ctrl-A (select all) are slow. I find it easier to write my code in Notepad, and then copy-paste it into the browser to test it.

I recently got a new computer and it hasn't been as bad there, so it might be hardware-related, but I don't understand how an in-browser editor can be unusable with a 10th gen i7 and then work fine on newer hardware. It isn't browser-specific; I've noticed the same behavior on both Firefox and Chrome.

Confidentiality maybe

If I use swiftfiddle.com can like my code stay confidential and not stolen or legally used against like my wishes? Like does your swiftFiddle.com save without permission? Are you in WIPO Copyright Treaty area (look up WIPO Copyright Treaty then contracting parties in it to check) so there are legal reprocussions if you use like my code unauthorized? Why do I have to open an issue to contact you? Can you contact me at [email protected] or +1 804-547-9934 via text or email?

Bug in output

Sometimes for the same input there are different outputs.
Example code:

print("sentence1")
#warning("warning1")
print("sentence2")
#warning("warning2")
#warning("warning3")

output1:
Screenshot 2024-01-13 at 4 39 33 AM
output2:
Screenshot 2024-01-13 at 4 42 38 AM

Response1:

{"kind":"version","text":"Swift version 5.9.2 (swift-5.9.2-RELEASE)\nTarget: x86_64-unknown-linux-gnu\n"}
{"kind":"stderr","text":"<stdin>:2:10: warning: warning1\n#warning(\"warning1\")\n         ^~~~~~~~~~\n<stdin>:4:10: warning: warning2\n#warning(\"warning2\")\n         ^~~~~~~~~~\n<stdin>:5:10: warning: warning3\n#warning(\"warning3\")\n         ^~~~~~~~~~\n"}
{"kind":"stdout","text":"sentence1\nsentence2\n"}

Response2:

{"kind":"version","text":"Swift version 5.9.2 (swift-5.9.2-RELEASE)\nTarget: x86_64-unknown-linux-gnu\n"}
{"kind":"stderr","text":"<stdin>"}
{"kind":"stderr","text":":2:10: warning: warning1\n#warning(\"warning1\")\n         ^~~~~~~~~~\n<stdin>:4:10: warning: warning2\n#warning(\"warning2\")\n         ^~~~~~~~~~\n<stdin>:5:10: warning: warning3\n#warning(\"warning3\")\n         ^~~~~~~~~~\n"}
{"kind":"stdout","text":"sentence1\nsentence2\n"}

In response2 there is two "stderr".

another example:

// print("ssssss")
// print("aaaaa")
//  #warning("ikkkkk"
//  print("adsdd")
//  #warning("asas")
//  #warning("mimo")

 print("ssssss")
 #warning("ikkkkk")
 print("adsdd")
 #warning("asas")
 #warning(\"mimo\")

output (sometimes there is two stderr):

{"kind":"version","text":"Swift version 5.9.2 (swift-5.9.2-RELEASE)\nTarget: x86_64-unknown-linux-gnu\n"}
{"kind":"stderr","text":"<stdin>:12:12: error: unterminated string literal\n #warning(\\\"mimo\\\")\n           ^\n<stdin>:12:11: error: expected string literal in #warning directive\n #warning(\\\"mimo\\\")\n          ^\n          \"        \")\n<stdin>:9:11: warning: ikkkkk\n #warning(\"ikkkkk\")\n          ^~~~~~~~\n"}
{"kind":"stderr","text":"<stdin>:11:11: warning: asas\n #warning(\"asas\")\n          ^~~~~~\n"}

UX issue - share button tries to walk off the screen

I was exploring SwiftFiddle, which is tremendous, and while doing so noticed a minor bug.

When you mouse over back and forth between the button LSP and the button Share, the position of the Share button migrates just slightly to the right. I made a short video illustrating what I'm seeing. I didn't see a version or reference to provide you specific release detail, but this was happening on 5 may, 2023 15:13 UTC

Screen.Recording.2023-05-05.at.8.10.23.AM.mov

'docker: invalid reference format' when >= Nightly-5.7

When running with the nightly releases, I get the following error message (example from nightly-main:

Swift version 5.11-dev (LLVM 6751d2aa5dca44c, Swift 90f192abfeb5f17)
Target: x86_64-unknown-linux-gnu
docker: invalid reference format.
See 'docker run --help'.

Impacting Runners:

  • nightly-5.7
  • nightly-5.8
  • nightly-5.9
  • nightly-5.10
  • nightly-main

incorrect Swift version when choosing nightly-5.7

When we choose Swift Version: nightly-5.7 , the output is for: Swift version 5.7.1
expected: Swift version 5.7

output example:
Swift version 5.7.1-dev (LLVM 597c04db307f4ed, Swift 2e814ca5d704c9f)
Target: x86_64-unknown-linux-gnu
Hello, World!
Hello, Swift!

Is it possible to wait for async code to complete?

Hi. I'm trying to test async procedures. Here's what I'm working with:

import Foundation

let plusOneError = NSError(
  domain: "addOne",
  code: 10,
  userInfo: [
      NSLocalizedDescriptionKey: "Plus one error."
  ])

func addOne(_ value: Int, delay: Double = 0.0) async throws -> Void {
  try await withCheckedThrowingContinuation { (continuation: CheckedContinuation<Void, Error>) in
        DispatchQueue.main.asyncAfter(deadline: .now() + delay) {
            if value < 0 { continuation.resume(throwing: plusOneError) }
            print(value + 1)
            continuation.resume(returning: Void())
        }
    }
}

func startProcess() -> Void {

  let group = DispatchGroup()
  group.enter()

  Task {
    do {

      try await addOne(5, delay: 1.0)
      group.leave()

    } catch {
      print(error)
      group.leave()
    }
  }

  group.wait()
}

startProcess()

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.