Skip to content

Instantly share code, notes, and snippets.

@barbosa
Last active June 12, 2017 18:57
Show Gist options
  • Select an option

  • Save barbosa/440fae2f856e765730455d34006f07d4 to your computer and use it in GitHub Desktop.

Select an option

Save barbosa/440fae2f856e765730455d34006f07d4 to your computer and use it in GitHub Desktop.
import UIKit
final class MyViewController: UIViewController {
func loadView() {
view = MyView.fromNib()
}
}
final class MyView: UIView, NibLoadableView {
@IBOutlet private(set) weak var myLabel: UILabel! {
didSet {
myLabel.textColor = .blue
myLabel.text = "This is my label"
}
}
@IBOutlet private(set) weak var otherView: UIView! {
didSet {
otherView.backgroundColor = .red
otherView.layer.cornerRadius = 3.0
otherView.layer.masksToBounds = true
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment