Adjust Font Size Based on Height In Custom UI View

In my code, I have a custom UI View made using a xib file.

There is a label in this view that has text in it. I would like the font of the text to change to fit the height of the label because the height constantly changes but the width does not.

I have found some code that I think might be relevant to my issue, but most of the code was written years ago, and come up with several errors on xcode.

Is there a way I can set the font size to change based on height?

Thank you in advance~

Hello dont really think so… It think it would be ideal to use do it programmatically using some computations and if statements so it can modify the font size on load