I've created a subclass to manage my Theme but is not showing neither on device or simulator.

Here my Header.swift :

import Foundation import UIKit class Header: UILabel { override var textColor: UIColor! { // White Color get { return ThemeManager.currentTheme.palette.primary } set {} } override var font: UIFont! { get { return ThemeManager.currentTheme.textStyle.headerText } set {} } }

Here the implementation: (inside the viewcontroller)

var titleLabel: Header = Header() override func viewDidLoad() { super.viewDidLoad() view.backgroundColor = .black // Background Image over the view setupBackground() setupStartButton() setupTitleLabel() print(titleLabel.frame) } // MARK: - Header private func setupTitleLabel() { titleLabel.text = "0.0m" // titleLabel.font = ThemeManager.currentTheme.textStyle.headerText // titleLabel.textColor = ThemeManager.currentTheme.palette.primary view.addSubview(titleLabel) view.bringSubviewToFront(titleLabel) setupTitleLabelAutolayout() } private func setupTitleLabelAutolayout() { titleLabel.translatesAutoresizingMaskIntoConstraints = false NSLayoutConstraint.activate([ titleLabel.centerYAnchor.constraint(equalTo: view.centerYAnchor), titleLabel.centerXAnchor.constraint(equalTo: view.centerXAnchor) ]) }

But if I use UILabel instead of Header it works perfectly as expected. I've also tried to implement init?(coder aDecoder: NSCoder) and init(frame: CGRect) but nothing changed.

If I set a frame on init then shows the text, but not styled and ignoring my constraints.

Surely I'm missing something, but what?

To avoid usefulness answers, here some infos: