mirror of
https://github.com/XcodesOrg/XcodesApp.git
synced 2025-12-25 12:14:17 +01:00
18 lines
404 B
Swift
18 lines
404 B
Swift
//
|
|
// Collection+.swift
|
|
// Xcodes
|
|
//
|
|
// Created by Matt Kiazyk on 2022-04-11.
|
|
// Copyright © 2022 Robots and Pencils. All rights reserved.
|
|
//
|
|
|
|
import Foundation
|
|
|
|
public extension Collection {
|
|
|
|
/// Returns the element at the specified index iff it is within bounds, otherwise nil.
|
|
subscript (safe index: Index) -> Element? {
|
|
return indices.contains(index) ? self[index] : nil
|
|
}
|
|
}
|