mirror of
https://github.com/XcodesOrg/XcodesApp.git
synced 2026-03-25 08:55:46 +00:00
17 lines
414 B
Swift
17 lines
414 B
Swift
//
|
|
// CollectionExtensions.swift
|
|
// spm-licenses
|
|
//
|
|
// Created by Sergii Kryvoblotskyi on 11/11/19.
|
|
// Copyright © 2019 MacPaw. 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
|
|
}
|
|
}
|