Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Instantiating a custom UIView
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