0

I’m a former Python programmer, and I’m new to Swift

I want to know: is there a function that can exec/run another Swift file or external Swift script?

Just as an example. In Python I was using to exec another Python script:

exec("print('Hello world')")

and the result:

Hello world

That's it.

Alexander
  • 59,041
  • 12
  • 98
  • 151
Dude_Hi
  • 27
  • 4

2 Answers2

1

In fact, there is a library that can run external codes in swift Similar like your python Example, you can download the Library by github:

https://github.com/samuelmeuli/swift-exec

0

I don't know much about this but I think so this article could maybe help you for what you are looking for.

Link: https://www.raywenderlich.com/25816315-using-swift-scripts-with-xcode

Amish
  • 141
  • 4