Files
Hacki/ios/StoryWidget/Extensions/ArrayExtension.swift
2025-01-20 01:12:44 -08:00

37 lines
688 B
Swift

import Foundation
extension Optional where Wrapped: Collection {
var isMoreThanOne: Bool {
guard let unwrapped = self else {
return false
}
if unwrapped.count > 1 {
return true
} else {
return false
}
}
var isNullOrEmpty: Bool {
guard let unwrapped = self else {
return true
}
return unwrapped.isEmpty
}
var isNotNullOrEmpty: Bool {
return !isNullOrEmpty
}
var countOrZero: Int {
guard let unwrapped = self else {
return 0
}
return unwrapped.count
}
}