This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| extension UISearchBar { | |
| public var textField: UITextField? { | |
| if #available(iOS 13, *) { | |
| return searchTextField | |
| } | |
| let subViews = subviews.flatMap { $0.subviews } | |
| guard let textField = (subViews.filter { $0 is UITextField }).first as? UITextField else { | |
| return nil | |
| } | |
| return textField |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // | |
| // ViewController.swift | |
| // FileManagerMethods | |
| // | |
| // Created by Steven Curtis on 08/10/2019. | |
| // Copyright © 2019 Steven Curtis. All rights reserved. | |
| // | |
| import UIKit |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public func uniqueMap<T: Equatable>(_ transform: (Iterator.Element) throws -> T) rethrows -> [T] { | |
| let count: Int = numericCast(self.count) | |
| if isEmpty { | |
| return [] | |
| } | |
| var result = ContiguousArray<T>() | |
| result.reserveCapacity(count) |