How can I create a function or method at runtime using Swift? Is there an equivalent command like eval? I would like to be able to do something like:
eval("func x(){ println();}")
Thanks in advance!
Given that it's not an interpreted language, I don't think you can. C
for instance, has no eval
since the C compiler is not part of the compiled binary.
But I'm sure there are lots of other (read: better) ways to accomplish that goal that you think you need eval
for. Whatever that is...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With