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 extension Array { | |
/// 通过item删除一个元素 <https://dbgrandi.github.io/removing_items_from_a_swift_array> | |
/// | |
/// - Parameter equalItem: 遵守 Equatable 协议的item | |
/// - Returns: 是否删除 | |
@discardableResult | |
mutating func remove<Element: Equatable>(equalItem: Element) -> Bool { | |
var isRemoved = false | |
for i in stride(from: self.count-1, through: 0, by: -1) { |
NewerOlder