mardi 20 octobre 2020

Invoke private method by reflection in Swift

I need to invoke a private method and pass param to it. The standard way it is using reflection. There are a lot of technics and it's possible in Kotlin, Java, C#. However, what do I need to call in Swift to achieve the expected result? The sample code is below:

class Test {
    private func doSomething(value: String) {
    }
}

let testInstance = Test()
// how to invoke private method and pass param
testInstance.doSomething("Hello world!")




Aucun commentaire:

Enregistrer un commentaire