I hit this issue as well. I had an early email on this list regarding do this topic, not in a situation to search for it. It is a short coming in how escaping can be applied to things like optional closures.
I was in the process of authoring an email for swift evolution about it and haven't yet gotten around to filing a defect about it. -Shawn On Tue, Sep 13, 2016 at 7:27 PM Rick Mann via swift-users < swift-users@swift.org> wrote: > I'm trying to write this function. The errorHandler: parameter is modeled > after the NSFileManager enumerate() function. If I include the @escaping > you see there, I get the error "@escaping may only be applied to parameters > of function type". > > The second parameter, iterator:, seems to have no problems with @escaping. > > func > iterate(directory inURL: URL?, > includingPropertiesForKeys: [URLResourceKey]? = nil, > options: FileManager.DirectoryEnumerationOptions = [], > errorHandler inErrorHandler: (@escaping (URL, Error) -> Bool)? = > nil, > iterator inIterator: (@escaping (URL) throws -> ())) rethrows > { > } > > I'm not sure why I can't apply @escaping here. Can anyone enlighten me? > Thank you. > > -- > Rick Mann > rm...@latencyzero.com > > > _______________________________________________ > swift-users mailing list > swift-users@swift.org > https://lists.swift.org/mailman/listinfo/swift-users >
_______________________________________________ swift-users mailing list swift-users@swift.org https://lists.swift.org/mailman/listinfo/swift-users