You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hey, is it possible to call a function (e.g. via String) of a class which is created by using createInstance()?
I am creating test cases for Classes and check if a function was implemented correctly.
The idea is, that I provide an empty class, e.g. "Student" and a UML diagram which states that a Student has a function named "getStudentId()". A student now needs to implement the code.
Now I want to write a test case which tries to initialize the "Student" class and
1.) check if the function "getStudentId()" exists and
2.) check if it returns the correct value
I can check with
if let inferredClass = NSClassFromString("Student") {
...
} else {
print("no class found")
XCTFail("Student.swift is not implemented!")
}
that the class exists, but I cannot call the function.
Do you have an idea?
The text was updated successfully, but these errors were encountered:
Hey, is it possible to call a function (e.g. via String) of a class which is created by using
createInstance()
?I am creating test cases for Classes and check if a function was implemented correctly.
The idea is, that I provide an empty class, e.g. "Student" and a UML diagram which states that a Student has a function named "getStudentId()". A student now needs to implement the code.
Now I want to write a test case which tries to initialize the "Student" class and
1.) check if the function "getStudentId()" exists and
2.) check if it returns the correct value
I can check with
that the class exists, but I cannot call the function.
Do you have an idea?
The text was updated successfully, but these errors were encountered: