Skip to content

Commit

Permalink
#40 Fixed compactMap for Swift 4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
malcommac committed Aug 31, 2018
1 parent 3b60f74 commit f9882cb
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions Sources/SwiftRichString/Extensions/UIKit+Extras.swift
Original file line number Diff line number Diff line change
Expand Up @@ -163,3 +163,14 @@ extension UITextView {
}

#endif

//MARK: - compactMap for Swift 4.0 (not necessary > 4.0)

#if swift(>=4.1)
#else
extension Collection {
func compactMap<ElementOfResult>(_ transform: (Element) throws -> ElementOfResult?) rethrows -> [ElementOfResult] {
return try flatMap(transform)
}
}
#endif

0 comments on commit f9882cb

Please sign in to comment.