Created
January 31, 2018 15:55
-
-
Save rtking1993/acba1a35650568e95ef572084c86c260 to your computer and use it in GitHub Desktop.
Instantiating a custom UIView
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import UIKit | |
// MARK: TestViewController | |
class TestViewController: UIViewController { | |
// MARK: Outlets | |
@IBOutlet var testView: TestView! | |
// MARK: View Methods | |
override func viewDidLoad() { | |
super.viewDidLoad() | |
testView.delegate = self | |
} | |
} | |
// MARK: TestViewDelegate Methods | |
extension TestViewController: TestViewDelegate { | |
func testView(_ testView: TestView, didSelect button: UIButton) { | |
guard let buttonText = button.titleLabel?.text else { | |
return | |
} | |
print("\(buttonText) pressed") | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment