Please help! Subviews issue

Can you help me please? I want when I press a button to animate an image and label
to both appear that were dynamically (programmatically) added to a subview.

Currently only 1 can work from the subview addition
ex.

    UIView.transition(with:self.lbl,
                      
                      duration:2,
                      
                      options: .curveEaseIn,
                      
                      animations: {self.view=self.bgImage!},
                      
                      completion: nil)


}

Tries adding in for each view in subviews but both controls don't animate they just appear on the click event.

Thanks so much!!!

Hi James! It's always nice to have new people join the Swift community--so, welcome!

It sounds like your question is about UIKit. Unfortunately, that's not a great fit for these forums because we focus on Swift itself and not Apple's APIs. You might have better luck with your question on StackOverflow or Appleā€™s Developer Forums.

Hi James,

If you follow up with a link to your thread in StackOverflow or Developer Forums, we can continue the discussion there.

Note that the view you specify in the with parameter has to be the superview of those which you want to animate in the animations block. If fixing this doesn't help, additionally try laying out the superview at the end of the animations block: view.layoutIfNeeded(). (view is the same object you specify in with). Documentation