21 lines
368 B
Swift
21 lines
368 B
Swift
|
|
//
|
||
|
|
// Collection+Ext.swift
|
||
|
|
// E-Wow
|
||
|
|
//
|
||
|
|
// Created by lym on 2021/1/19.
|
||
|
|
//
|
||
|
|
|
||
|
|
import Foundation
|
||
|
|
|
||
|
|
public extension Collection {
|
||
|
|
subscript(safe index: Index) -> Element? {
|
||
|
|
return indices.contains(index) ? self[index] : nil
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
extension Array {
|
||
|
|
static func realEmpty(array: Array?) -> Bool {
|
||
|
|
return array == nil || array?.count == 0
|
||
|
|
}
|
||
|
|
}
|