mirror of
https://github.com/realm/SwiftLint.git
synced 2026-06-06 20:18:40 +00:00
20 lines
428 B
Swift
20 lines
428 B
Swift
//
|
|
// shim.swift
|
|
// SwiftLint
|
|
//
|
|
// Created by Norio Nomura on 2/5/18.
|
|
// Copyright © 2018 Realm. All rights reserved.
|
|
//
|
|
|
|
#if (!swift(>=4.1) && swift(>=4.0)) || !swift(>=3.3)
|
|
|
|
extension Sequence {
|
|
func compactMap<ElementOfResult>(
|
|
_ transform: (Self.Element
|
|
) throws -> ElementOfResult?) rethrows -> [ElementOfResult] {
|
|
return try flatMap(transform)
|
|
}
|
|
}
|
|
|
|
#endif
|