-4

I am trying to have a dynamic swift program that at runtime will do some actions and convert a string into a method call.

Example:

Array = ["TestMethod()", "TestMethod2()"]

I want to essentially say

if the sky is blue{
  convertStringToMethodCall(Array[0])
}

The goal is for the TestMethod() to actually get called at runtime.

NOTE: This must be one in Swift 5.

rmaddy
  • 314,917
  • 42
  • 532
  • 579
logankilpatrick
  • 13,148
  • 7
  • 44
  • 125

1 Answers1

0

Based on the response of others and more digging, this cannot currently be done using Swift 5.x or later! If you too are trying t do this, you will need to find another solution.

logankilpatrick
  • 13,148
  • 7
  • 44
  • 125