Files
purchases-ios/Sources/FoundationExtensions/Array+Extensions.swift
T
aboedo f5697de730 renamed Purchases folder to Sources (#1416)
* renamed `Purchases` folder to `Sources`

* temporarily enabling installation test jobs

* re-disabling installation test jobs
2022-03-28 11:53:24 -03:00

26 lines
606 B
Swift

//
// Copyright RevenueCat Inc. All Rights Reserved.
//
// Licensed under the MIT License (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://opensource.org/licenses/MIT
//
// Array+Extensions.swift
//
// Created by Nacho Soto on 2/17/22.
import Foundation
extension Array {
/// Equivalent to `removeFirst()` but it returns `Optional` if the collection is empty.
mutating func popFirst() -> Element? {
guard !self.isEmpty else { return nil }
return self.removeFirst()
}
}