Is there a way to dynamically generate methods in a class like in Ruby in Swift? Can this be done by setting instance variables to be a function like in Javascript.
The book The Swift Programming Language doesn't mention anything.
As that is the definitive guide to the language we have right now, this seems like bad luck. As swift is based on the ObjC language runtime however, which has metaprogramming abilities, there ought to be some way to do it.
So lets wait and see.
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