aboutsummaryrefslogtreecommitdiff
path: root/foray/Extensions/UIViewController+Extensions.swift
blob: ee2c43632c8888c033ef1c868320f44fea9856b8 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
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
    }
}