contentful.swift icon indicating copy to clipboard operation
contentful.swift copied to clipboard

Result ambiguous with Swift.Result

Open sarojkumarojha opened this issue 4 years ago • 1 comments

  • contentful.swift version number: 5.4.0
  • Xcode version number: 12.1
  • Target operating system(s) and version number(s)
    • [x] iOS:
    • [ ] tvOS:
    • [ ] watchOS:
    • [ ] macOS:
  • Package manager:
    • [ ] Carthage
    • [x] Cocoapods

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'

sarojkumarojha avatar Dec 12 '20 15:12 sarojkumarojha

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
    // ...
}

mbpolan avatar Jan 06 '21 21:01 mbpolan