Closure use of non-escaping parameter may allow it to escape
I have a protocol: enum DataFetchResult { case success(data: Data) case failure } protocol DataServiceType { func fetchData(location: String, completion: (DataFetchResult) -> (Void)) func cachedData(location: String) -> Data? } With an example implementation: /// An implementation of DataServiceType protocol returning predefined results using arbitrary queue for asynchronyous mechanisms. /// Dedicated to be used in various tests (Unit Tests). class DataMockService: DataServiceType { var result : DataFetchResult var async : Bool = true var queue : DispatchQueue = DispatchQueue.global(qos: