Is it possible to pass the "type" of a struct as an argument? Use case below (syntax doesn't work):
// Declarations.
public protocol Event {}
public enum AwesomeEvents {
public enum Notifications {
public struct NotificationReceived : Event {
...
}
}
}
// Is it possible to do something like this?
func testNotifications {
...
doSomethingAndCheckEventType(correctEventType: AwesomeEvents.Notifications.NotificationReceived.Type)
}
func doSomethingAndCheckEventType<T: Event>(correctEventType: T) {
...
XCTestAssertTrue(someEvent is correctEventType)
}