Skip to content

IUIContentConfiguration.MakeContentView() result fails to cast to UIView #21738

@Uncommon

Description

@Uncommon

Apple platform

iOS

Framework version

net8.0-*

Affected platform version

.NET 8.0.100 18.0.8303

Description

The return type of IUIContentConfiguration.MakeContentView() is simply IUIContentView. By contrast, in Swift it is UIView & UIContentView (and similarly in Objective-C), so we're missing the idea that the return type is not just an object that conforms to UIContentView, but it's specifically a UIView. Attempting to cast the result of MakeContentView() to UIView fails, which is also incorrect. This makes the composability aspect of content configurations unusable in C#: you can't take one configuration's view and embed it inside another.

Steps to Reproduce

  1. Attempt to cast the result of a MakeContentView() call to UIView.
  2. The result is null, which is incorrect. The result is always a UIView.

Did you find any workaround?

I haven't tried it yet, but I could make a subclass of UIView that implements IUIContentView, and return that from my custom content configurations. I think that would get around the casting issue for those cases, but it would not help for when I want to embed a system content configuration inside a custom one.

Relevant log output

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    api-bindingsbugIf an issue is a bug or a pull request a bug fix

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions