I have the same problem and found no answer so far. Did you find anything by now?
Post
Replies
Boosts
Views
Activity
Found an Answer:
Code
protocol Component { ... }
struct ComponentA: Component { ... }
struct ComponentB: Component { ... }
class Main<C: Component> {
var component: C
init(componentA: ComponentA, componentB: ComponentB) {
// I am trying to check, whether componentA equals the Generic Data Type and assign it to the component Property if true.
if let safeComponent = componentA as? C {
self.component = safeComponent
}
}
}