From abb8f691fe6f276205d1cea655ee9938194d1e67 Mon Sep 17 00:00:00 2001 From: Nicholas Tay Date: Thu, 24 Mar 2022 15:46:13 +1100 Subject: Split details view into separate View and VC Also fixed the scrollview margins while I was at it - it looked weird being so inside --- foray/UIViewController+Extensions.swift | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 foray/UIViewController+Extensions.swift (limited to 'foray/UIViewController+Extensions.swift') 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 + } +} -- cgit