Skip to content
This repository was archived by the owner on Jun 4, 2025. It is now read-only.

Commit c6caeb0

Browse files
committed
Conform to code standards by adding (some) documentation
1 parent b5d973d commit c6caeb0

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

WordPressShared/Core/Utility/CollectionType+Helpers.swift

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
import Foundation
22

3+
4+
// MARK: - Collection Type Helpers
5+
//
36
extension BidirectionalCollection {
47
public func lastIndex(where predicate: (Self.Iterator.Element) throws -> Bool) rethrows -> Self.Index? {
58
if let idx = try reversed().firstIndex(where: predicate) {
@@ -10,8 +13,8 @@ extension BidirectionalCollection {
1013
}
1114

1215
extension Collection {
13-
1416
/// Returns the element at the specified index if it is within bounds, otherwise nil.
17+
///
1518
public subscript (safe index: Index) -> Element? {
1619
return indices.contains(index) ? self[index] : nil
1720
}

0 commit comments

Comments
 (0)