Skip to content

Instantly share code, notes, and snippets.

@VAndrJ
Created December 6, 2019 20:36
Show Gist options
  • Save VAndrJ/6751d411479d779dbc4078e4924fd6e3 to your computer and use it in GitHub Desktop.
Save VAndrJ/6751d411479d779dbc4078e4924fd6e3 to your computer and use it in GitHub Desktop.
Extension to find UINavigationBar's large title view.
//
// UINavigationBar+LargeTitleView.swift
// DesignInspirations
//
// Created by VAndrJ on 06.12.2019.
// Copyright © 2019 VAndrJ. All rights reserved.
//
public extension UINavigationBar {
var largeTitleView: UIView? {
return findLargeTitleView(in: self)
}
private func findLargeTitleView(in view: UIView) -> UIView? {
if String(describing: type(of: view)) == "_UINavigationBarLargeTitleView" {
return view
}
for subview in view.subviews {
if let findedView = findLargeTitleView(in: subview) {
return findedView
}
}
return nil
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment