let label = UILabel() label.text = "Hello, World" return label }() // αϒϏϡʔΛՃ͢Δ override func didMoveToSuperview() { super.didMoveToSuperview() self.addSubview(self.label) } // αϒϏϡʔΛϨΠΞτ͢Δ override func layoutSubviews() { super.layoutSubviews() self.label.sizeToFit() self.label.center = CGPoint(x: self.frame.width / 2, y: self.frame.height / 2) }