Maybe just make a function that will give the instance from name?
I would use a Dictionary, if the number is 50 or so.
let stringToNeededMethods: [String: NeededMethods] = [
"FirstImplementation": FirstImplementation(),
//...
]
if let theInstance = stringToNeededMethods["FirstImplementation"] {
print(theInstance.doSmt(str: "0123"))
}
Topic:
App & System Services
SubTopic:
General
Tags: