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.

Revisions

  1. barbosa revised this gist Jun 12, 2017. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion ViewControllerAndCustomView.swift
    Original file line number Diff line number Diff line change
    @@ -7,7 +7,7 @@ final class MyViewController: UIViewController {
    }
    }

    final class MyView: UIView {
    final class MyView: UIView, NibLoadableView {

    @IBOutlet private(set) weak var myLabel: UILabel! {
    didSet {
  2. barbosa renamed this gist Jun 12, 2017. 1 changed file with 0 additions and 0 deletions.
  3. barbosa created this gist Jun 12, 2017.
    26 changes: 26 additions & 0 deletions ViewController+CustomView
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,26 @@
    import UIKit

    final class MyViewController: UIViewController {

    func loadView() {
    view = MyView.fromNib()
    }
    }

    final class MyView: UIView {

    @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
    }
    }
    }