Q:

Calling super from a mock in Swift

I'm following an example mock in Swift that sets a variable to true when the function we're testing for is called but what isn't clear to me is that it appears we override the function in a subclass which is the mock and then we return its parent's rendition of the method.  I assumed the way an override works is that we rewrite the function with our desired logic and when we did this I assumed the parent class that houses the original function is completely blind of how the child class handles the function?
Here is the sample code:
extension ItemListDataProviderTests{
class MockTableView: UITableView {
    var cellGotDequeued = false

    override func dequeueReusableCell(withIdentifier identifier: String, for indexPath: IndexPath) -> UITableViewCell {

        cellGotDequeued = true

        return super.dequeueReusableCell(withIdentifier: identifier, for: indexPath)

    }
}

How does returning the parent method call the overridden function and set the test variable to true?  I assumed by calling super it would run the parent's logic and not fire the child's overridden method. 

A:

The method you've shown 

sets cellGotDequeued to true
calls the parent class' implementation of dequeueReusableCell
returns the result returned from the parent class' implementation (not the "parent's rendition of the method")

You are correct that the parent class has no knowledge of how the child class has overridden this method.
Calling super does invoke the parent class' implementation but does so during the child classes implementation and in no way prevents the child's implementation from executing. The child class' use of super determines if the parent implementation should ever be called, and if so if any other actions should be performed before or afterwards.

