Skip to content

Instantly share code, notes, and snippets.

@anthonyvitocuaderno
Created June 5, 2018 09:03
Show Gist options
  • Save anthonyvitocuaderno/82dc1077b21738f39bc2bc4671a9abbd to your computer and use it in GitHub Desktop.
Save anthonyvitocuaderno/82dc1077b21738f39bc2bc4671a9abbd to your computer and use it in GitHub Desktop.
iOS Swift 3.3 UISearchBar extension
//
// UISearchBar.swift
// R2S
//
// Created by Vito Cuaderno on 5/7/18.
// Copyright © 2018 Total Integrated Resources. All rights reserved.
//
import UIKit
extension UISearchBar {
func textField() -> UITextField? {
for subView in self.subviews {
for subViewOne in subView.subviews {
if let textField = subViewOne as? UITextField {
return textField
}
}
}
return nil
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment