How to combine child views and expose containerView for accessibility and at the same time child views for Automation?

I have an image and label inside UIStackView which are inside a viewcontroller. I want to make my UIView accessible. So I wrote below code:

    var image: UIImage!
    var myView: UIStackView!
    var label : UILabel!

    myView.isAccessibilityElement = true    
    myView.accessibilityLabel = "Hello"

    myView.accessiblityIdentifier = "test_view"
    image.accessiblityIdentifier = "test_image"
    label.accessibilityIdentifier = "test_label"

All are UIKit Elements.

How to expose mvView to accessibility and only children to automation

I tried below two ways, none of them worked:

 self.view.accessibilityElements = [myView]
 myView.accessibilityElements = []

from apple documentation :

If the object is a view and it’s an accessibility element, and accessibilityElements is empty, the system assigns the list of subviews that have an accessibilityIdentifier to automationElements.

myView.automationElements = [myView,image,label]

from apple documentation :

In some cases, you might want to expose elements for automation but not for accessibility, or vice versa. In a view containing an image with a label under it, for example, you might choose to expose only the label for accessibility. For automation, however, you might include both the image and the label in a test to confirm the both objects exist. In this case, add both the image and the label to automationElements.

I am really going crazy with this since many days. Help is very much appreciated.