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 Collection where Element: UIView { | |
/// Returns an array containing, in order, the views of the sequence that satisfy the given predicate. | |
/// | |
/// - Parameters: | |
/// - recursive: Boolean that indicates if filtering recursively | |
/// - isIncluded: A closure that takes a view of the sequence as its argument and returns a Boolean value indicating whether the view should be included in the returned array. | |
/// - Returns: An array of the views that isIncluded allowed. | |
func filter(recursive: Bool = false, _ isIncluded: (UIView) -> Bool) -> [UIView] { | |
return reduce(into: []) { partialResult, view in |
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 String { | |
var localized: String { | |
return NSLocalizedString(self, comment: "\(self)_comment") | |
} | |
func localized(_ args: [CVarArg]) -> String { | |
return localized(args) | |
} | |