UIViewExtensions.swift 421 B

1234567891011121314
  1. //
  2. // SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
  3. // SPDX-License-Identifier: GPL-3.0-or-later
  4. //
  5. import Foundation
  6. extension UIView {
  7. // From https://stackoverflow.com/a/36388769
  8. class func fromNib<T: UIView>() -> T {
  9. // swiftlint:disable:next force_cast
  10. return Bundle(for: T.self).loadNibNamed(String(describing: T.self), owner: nil, options: nil)![0] as! T
  11. }
  12. }