Into<DynamicObject> cannot convert(upcast) child type to parent type #219

Closed
opened 2025-12-29 15:26:53 +01:00 by adam · 2 comments
Owner

Originally created by @RosalieChang on GitHub (Jun 14, 2018).

I am struggling a bit with generics in Swift.

I have the following code:
image

XKNavBar extends from XKBaseWidget
image
image

The code in CoreStore 3.1.1 is working, but upgrading to CoreStore 4.2.3 is not.
I guess that might be related the following?
image

Any idea how to solve this problem?

Thanks.

Originally created by @RosalieChang on GitHub (Jun 14, 2018). I am struggling a bit with generics in Swift. I have the following code: ![image](https://user-images.githubusercontent.com/7402785/41428997-538e0e36-703e-11e8-9ba8-34fbb2b44320.png) XKNavBar extends from XKBaseWidget ![image](https://user-images.githubusercontent.com/7402785/41429061-89ba0906-703e-11e8-8673-dce13e5b00eb.png) ![image](https://user-images.githubusercontent.com/7402785/41429084-93611364-703e-11e8-86f8-c590b8377d0b.png) The code in CoreStore 3.1.1 is working, but upgrading to CoreStore 4.2.3 is not. I guess that might be related the following? ![image](https://user-images.githubusercontent.com/7402785/41429346-7861f56e-703f-11e8-8231-61fe81be1499.png) Any idea how to solve this problem? Thanks.
adam added the question label 2025-12-29 15:26:53 +01:00
adam closed this issue 2025-12-29 15:26:53 +01:00
Author
Owner

@JohnEstropia commented on GitHub (Jun 15, 2018):

@RosalieChang You can set the generic type and the actual dynamic type for Into and From separately:

Into<XKBaseWidget>(XKNavBar.self)
From<XKBaseWidget>(XKNavBar.self)
@JohnEstropia commented on GitHub (Jun 15, 2018): @RosalieChang You can set the generic type and the actual dynamic type for `Into` and `From` separately: ```swift Into<XKBaseWidget>(XKNavBar.self) From<XKBaseWidget>(XKNavBar.self) ```
Author
Owner

@RosalieChang commented on GitHub (Jun 16, 2018):

Thank you very much 👍 the problem has been solved.

@RosalieChang commented on GitHub (Jun 16, 2018): Thank you very much 👍 the problem has been solved.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/CoreStore#219