Outline UILabel text in UILabel Subclass : <p>I'm trying hard to find a way to simply add an outline/stroke/contour to my UILabel text. Talking about a stroke around the letters of the text not around the background of a UILabel.</p>

<p>I'm using swift 3 and I'd like to outline my text directly into my subclass: UILabel.</p>

<p>I found multiple answers suggesting this way to do things : </p>

<pre><code>let strokeTextAttributes = [
        NSStrokeColorAttributeName : UIColor.black,
        NSForegroundColorAttributeName : UIColor.white,
        NSStrokeWidthAttributeName : -4.0,
        NSFontAttributeName : UIFont.boldSystemFont(ofSize: 30)
    ]

    self.attributedText = NSMutableAttributedString(string: self.text!, attributes: strokeTextAttributes)
</code></pre>

<p>But the thing is that it doesn't work. My text is still the same with no outline...</p>

<p>Could anyone help me here ?
That would be a great thing :)</p>

<p>Thanks a lot. Cheers guys.</p>
