aboutsummaryrefslogtreecommitdiff
path: root/foray/UIViewController+Extensions.swift
diff options
context:
space:
mode:
authorNicholas Tay <nick@windblume.net>2022-03-24 15:46:13 +1100
committerNicholas Tay <nick@windblume.net>2022-03-24 15:46:13 +1100
commitabb8f691fe6f276205d1cea655ee9938194d1e67 (patch)
tree752610821eb4862aad72b823efda7934793e0b1a /foray/UIViewController+Extensions.swift
parentdac7f928d2a1ed555aeedd97ec9433e266f47cf1 (diff)
downloadforayios-abb8f691fe6f276205d1cea655ee9938194d1e67.tar.gz
forayios-abb8f691fe6f276205d1cea655ee9938194d1e67.tar.bz2
forayios-abb8f691fe6f276205d1cea655ee9938194d1e67.zip
Split details view into separate View and VC
Also fixed the scrollview margins while I was at it - it looked weird being so inside
Diffstat (limited to 'foray/UIViewController+Extensions.swift')
-rw-r--r--foray/UIViewController+Extensions.swift23
1 files changed, 23 insertions, 0 deletions
diff --git a/foray/UIViewController+Extensions.swift b/foray/UIViewController+Extensions.swift
new file mode 100644
index 0000000..ee2c436
--- /dev/null
+++ b/foray/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
+ }
+}