Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Doc clarifications - PromiseKit with Obj/C / Getting Starting #456

Closed
dwabyick opened this issue Jun 25, 2016 · 10 comments
Closed

Doc clarifications - PromiseKit with Obj/C / Getting Starting #456

dwabyick opened this issue Jun 25, 2016 · 10 comments

Comments

@dwabyick
Copy link

I'm trying to get started with PromiseKit for an Obj/C project, and I ran into a few issues. Happy to make a PR to clarify.

  1. Is PromiseKit 3.0 only for Swift? It seems to be. It wasn't clear from the README.
  2. In the getting started - http://promisekit.org/getting-started/, I found the instruction for Podfile outdated. I needed to use a target:
target 'promisetest' do
   pod "PromiseKit"
end

This seemed necessary regardless of the issue for #1.

Happy to make a PR for any changes, just curious what the right answer is.

@nathanhosselton
Copy link
Contributor

PromiseKit 3.0 can be used for both Swift and Objective-C, it's just nicer when used with Swift. Legacy PromiseKit 1.x is pure Objective-C and is therefore nicer if you aren't using Swift. Apologies that the docs were not clear enough on this.

Specifying a target in your Podfile is good practice but shouldn't be necessary (unless something was changed for Cocoapods 1.0). What issue did you run into?

@dwabyick
Copy link
Author

Thanks for the quick response.

Yes, it sounds like they changed the API in Cocoapods 1.0 - I get [!] The dependencyPromiseKitis not used in any concrete target. Appears to be a new requirement.

When I did add a target, I got the following warning:

promisetest$ pod install
Analyzing dependencies
Downloading dependencies
Installing OMGHTTPURLRQ (3.1.2)
Installing PromiseKit (3.2.0)
[!] Pods written in Swift can only be integrated as frameworks; add `use_frameworks!` to your Podfile or target to opt into using it. The Swift Pod being used is: PromiseKit

And then it didn't create a workspace project. As a sanity check, I tried with AFNetworking and things installed and created a project. This appeared to also work with PromiseKit 1.X, but I'd prefer to use the latest.

FYI, when I tried adding use_frameworks! it generated a project file, but opening the projectfile didn't appear to expose any Obj/C headers.

One caveat to all of this - I do have XCode 8.0 beta installed on my system. However I was opening and testing with XCode 7.3.1. Since AFNetworking was ok, this makes me think this is a non-issue.

@dwabyick
Copy link
Author

One other point of clarification, this project was created using one of the iOS application templates using Obj/C for a primary language.

@dwabyick
Copy link
Author

Ok! actually, turns out that use_frameworks! did solve my problem.

I didn't think I was getting Obj/C headers as the example I was using in Sealing Your Promises was using [PKMPromise promiseWithResolverBlock] syntax and not the newer [AnyPromise promiseWithResolverBlock]

http://promisekit.org/sealing-your-own-promises/

@mxcl
Copy link
Owner

mxcl commented Jun 26, 2016

What confused you as to thinking PMK3 is just Swift?

2nd paragraph in README is:

PromiseKit is a thoughtful and complete implementation of promises for iOS and OS X with first-class support for both Objective-C and Swift.

So presumably some other part made you think this didn't apply to version 3?

@dwabyick
Copy link
Author

I think it was a combination of the install issue I was having, combined with the PromiseKit 3.0 paragraph only mentioning Swift. I am glad I was mistaken.

Btw - Thanks for making such a great library! Time to unravel some existing code. ;)

On Jun 26, 2016, at 8:42 AM, Max Howell [email protected] wrote:

What confused you as to thinking PMK3 is just Swift?

2nd paragraph in README is:

PromiseKit is a thoughtful and complete implementation of promises for iOS and OS X with first-class support for both Objective-C and Swift.

So presumably some other part made you think this didn't apply to version 3?


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or mute the thread.

@dwabyick
Copy link
Author

So to close the loop I think there are two things to update.

  1. Updating the example of Cocoapods to something like:
  • pod init - This creates the file with a target for your project
  • Add the following
target '<yourprojectname>' do
   use_frameworks!
   pod "PromiseKit"
end
  1. Updating http://promisekit.org/sealing-your-own-promises/ to [AnyPromise promiseWithResolverBlock] ...

@nathanhosselton
Copy link
Contributor

Agreed. Docs really need to be gone through with a fine tooth comb at this point. Then again, a lot of things will probably be changing again with Swift 3.0 and PMK 4.0, so maybe it's not worth it just yet. I'll give myself a todo for these tasks though unless you'd like to submit a PR.

@dwabyick
Copy link
Author

@nathanhosselton - I was looking to see where the promisekit.org site lived, and I didn't see it in this repos - Did I miss it? Happy to put in a PR for these two things.

@mxcl
Copy link
Owner

mxcl commented Jun 27, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants