Post

Replies

Boosts

Views

Activity

Reply to How to check if Data Type equals Generic Data Type and assign to Property if True?
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 } } }
Topic: Programming Languages SubTopic: Swift Tags:
Aug ’22
Reply to How to check if Data Type equals Generic Data Type and assign to Property if True?
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 } } }
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Aug ’22
Reply to ShareLink doesn't attach file on watchOS
I have the same problem and found no answer so far. Did you find anything by now?
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Feb ’23