A helpful keyword in Swift is Self, which is a metatype that represents the current type. The current type may be the class, subclass or current implementer of a protocol, depending on where it is used.

A handy use-case for it is to avoid specifying generic placeholder types. Neat! 🎉

class ThreadRobot<CallerT: CallerRobot> {
    private let app = XCUIApplication()
    
    func tapCompleteButton() -> Self {
        app.otherElements["actionButtonRail"].buttons["Complete"].tap()
        return self
    }
}

Thanks for reading and happy coding! 🙏