google / promises

Promises is a modern framework that provides a synchronization construct for Swift and Objective-C.
Apache License 2.0
3.8k stars 294 forks source link

'FBLPromise' requires that '***' be a class type #122

Closed petrovi4 closed 5 years ago

petrovi4 commented 5 years ago

First of all, the link https://github.com/google/promises/blob/master/g3doc/index.md for Swift, examples are

import Promises
...
func data(at url: URL) -> Promise<Data>

and so on, although in reality the module is called FBLPromises, just like the class. That is, the documentation is not consistent. But this is minor.

The documentation shows examples of creating Promise, while promise only requires class type. I.e., the code

let promise = FBLPromise<String> { fulfill, reject in
  ...
}

not compiled with error: "'FBLPromise' requires that 'String' be a class type"

I'm doing something wrong, or do not use FBLPromises with objects that aren't classes? If this is the case, most of the promises usage scenario is lost, and for many, the benefit of using the library tends to zero.

Ps. I use Carthage

shoumikhin commented 5 years ago

Hi @petrovi4, the documentation is correct, you should be importing Promises. What issue do you face when importing the right module?

ghost commented 5 years ago

Hi @petrovi4, please reopen if you are still experiencing any issues. Thank you!