[macOS] CALayer.Contents has wrong type · Issue #23933 · dotnet/macios · GitHub
Skip to content

[macOS] CALayer.Contents has wrong type #23933

Description

@tipa

Apple platform

macOS

Framework version

net9.0-*

Affected platform version

.NET 9

Description

According to the documentation, it should be possible to set a NSImage as the CALayer content, however the .NET bindings require an object of type CGImage

Steps to Reproduce

var layer = new CALayer();
layer.Contents = NSImage.GetSystemSymbol("plus", null);

Did you find any workaround?

yes, but it's quite hacky:
layer.SetValueForKey(NSImage.GetSystemSymbol("plus", null), new NSString("contents)");

Build logs

No response

Metadata

Metadata

Assignees

Labels

documentationThe issue or pull request is about documentation

Type

No type
No fields configured for issues without a type.

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions