contentful / contentful.swift

A delightful Swift interface to Contentful's content delivery API.
MIT License
202 stars 82 forks source link

Result ambiguous with Swift.Result #325

Closed sarojkumarojha closed 1 month ago

sarojkumarojha commented 3 years ago

I have upgraded to 4.2.4 to 5.4.0 , now I am not able to compile , getting following error , could you please help me

client.fetchArray(of: Entry.self, matching: query) { (result: Result<HomogeneousArrayResponse<Entry>>) in
            switch result {
            case .success(let arrayResponse):
               //  handle success 
            case .error:
              // Handle error 
            }

error : Generic type 'Result' specialized with too few type parameters (got 1, but expected 2) when I try to use Contentful.Result instead of Result , got this error : No type named 'Result' in module 'Contentful'

mbpolan commented 3 years ago

I got bit by this the other day as well. For what it's worth, I was able to work around the problem by defining the completion closure like so using Swift.Result directly:

client.fetchArray(of: Entry.self) { (result: Result<HomogeneousArrayResponse<Entry>, Error>) in
    // ...
}
mariuskatcontentful commented 1 month ago

Believe since been fixed. Closing