Swift Collection API: extend with a computed variable: type error – Ios swift
I have a following method: private func returnNilIfEmpty<T: Collection>(_ collection: T?) -> T? { guard let collection = collection else { return nil } return collection.isEmpty ? nil : collection } I'd like to extend the Collection API to use…