Skip to content

Instantly share code, notes, and snippets.

@GeneralD
Created November 4, 2018 22:58
Show Gist options
  • Save GeneralD/e92ee9c5a66cd7cd9ba47e9370590752 to your computer and use it in GitHub Desktop.
Save GeneralD/e92ee9c5a66cd7cd9ba47e9370590752 to your computer and use it in GitHub Desktop.
import Foundation
import UIKit
@IBDesignable class __CustomView__: UIView {
@IBInspectable var labelText: String = "" {
didSet {
label.text = labelText
}
}
let label = UILabel()
required init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
commonInit()
}
override init(frame: CGRect) {
super.init(frame: frame)
commonInit()
}
fileprivate func commonInit() {
label.frame = CGRect(x: 0, y: 0, width: 1000, height: 300)
addSubview(label)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment