aboutsummaryrefslogtreecommitdiff
path: root/foray/Extensions
diff options
context:
space:
mode:
Diffstat (limited to 'foray/Extensions')
-rw-r--r--foray/Extensions/UIViewController+Extensions.swift23
1 files changed, 23 insertions, 0 deletions
diff --git a/foray/Extensions/UIViewController+Extensions.swift b/foray/Extensions/UIViewController+Extensions.swift
new file mode 100644
index 0000000..ee2c436
--- /dev/null
+++ b/foray/Extensions/UIViewController+Extensions.swift
@@ -0,0 +1,23 @@
+//
+// UIViewController+Extensions.swift
+// foray
+//
+// Created by Nicholas Tay on 24/3/2022.
+//
+
+import Foundation
+import UIKit
+
+protocol HasCustomView {
+ associatedtype CustomView: UIView
+}
+
+extension HasCustomView where Self: UIViewController {
+ internal var customView: CustomView {
+ guard let view = self.view as? CustomView else {
+ fatalError("Could not cast custom view")
+ }
+
+ return view
+ }
+}