mxcl / Path.swift

Delightful, robust, cross-platform and chainable file-pathing functions.
The Unlicense
946 stars 36 forks source link

Path.home.find(): Value of type 'Any' has no member 'extension' #56

Closed kaikuehne closed 4 years ago

kaikuehne commented 4 years ago

Hello, first of all, thanks for providing this library. :-) Secondly, I'm completely new to Swift, so bear with me if I'm just holding this wrong.

I was playing around with the API and cannot get one of the examples from the README to work. This code...

Path.home.find().maxDepth(1).extension("swift").kind(.file) { path in
        //…
    }

... always gives me this error:

Value of type 'Any' has no member 'extension'

I tried to add execute to the call, to align it with the other examples, but that didn't help. I'm using SPM to install version 1.0.0-alpha.3. Any help is appreciated. Thanks!

mxcl commented 4 years ago

There is no kind function, use type. Did you get this from docs? If so where? I need to fix them.

kaikuehne commented 4 years ago

Thanks for your reply. I just realized that Xcode shows more than one warning (replaced kind with type here already):

Path.home.find().maxDepth(1).extension("swift").type(.file) { path in
   ...        
}
Value of type 'Any' has no member 'extension'
Value of type 'Any' has no member 'type'
Value of type 'Path.Finder' has no member 'maxDepth'

I took the code from https://github.com/mxcl/Path.swift/tree/1.0.0-alpha.3#directory-listings.

mxcl commented 4 years ago
Path.home.find().depth(max: 1).extension("swift").type(.file) { path in
      //…      
}
mxcl commented 4 years ago

Documentation fixed, thanks.

kaikuehne commented 4 years ago

Thanks!