Hacker News new | ask | show | jobs
by vardump 38 days ago
Embedded Swift in a script. That seems like a useful concept for small scripts on macOS. I will definitely steal this idea.
1 comments

Swift also has an interpreted mode, you can just

  #!/usr/bin/evn swift
  import Foundation
  print("Hello, world")
and chmod +x hello.swift and execute it.

Instead of doing swift in bash and calling swiftc, you can always shell out to Process() from inside a Swift script instead.

Thanks! I think both approaches have their uses, neither fully replaces the other.