Viewing CALayers in Debug View Hierarchy
Asked Answered
A

1

5

I was trying to work on a layer-hosting View in Objective-C as per the documentation

view.layer = [CALayer new];  // Create a layer-hosting view as opposed to a layer-backed view
view.wantsLayer = YES;

I go on to use this layer-hosting view to support a hierarchy of layers by appending further layers using addSubLayer.

Now my query is whether it's possible to view these children/hosted CALayers in the Debug View Hierarchy? I only see the NSViews but not the hosted layers. I was seeking something akin to what's available in Visual Studio as the Live Visual Tree where it shows both the platform views and the Visual layers.

XCode Version: 11.3

Ate answered 11/5, 2021 at 8:4 Comment(0)
W
12

Yes you can, when in the Debug View Hierarchy, click on Editor -> Show Layers, like so:

enter image description here

This feature was made possible from Xcode 11.4 onwards: https://twitter.com/hrrsn/status/1225168226507612161

So unfortunately you will need to upgrade your Xcode 11.3.

Waac answered 3/12, 2021 at 1:58 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.