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

API needs to be objective C compatible #141

Closed
imougy opened this issue Mar 5, 2017 · 6 comments
Closed

API needs to be objective C compatible #141

imougy opened this issue Mar 5, 2017 · 6 comments
Assignees

Comments

@imougy
Copy link

imougy commented Mar 5, 2017

For example, the API in TradeItOrder

public func preview(onSuccess: @escaping (TradeItPreviewTradeResult, @escaping TradeItPlaceOrderHandlers) -> Void,
                       onFailure: @escaping (TradeItErrorResult) -> Void

Give this error while writing ObjC code:-
screen shot 2017-03-05 at 12 46 06 pm

Also, for this API

[TradeItSDK configureWithApiKey:PUBLISHER_NAME environment:TradeItEmsProductionEnv];

Please make sure NOT to set a default value for the parameter, otherwise, I am getting this error:-
image

@imougy
Copy link
Author

imougy commented Mar 6, 2017

I think this is a wider problem, please make all the APIs work with Objective-C without issues.
Another example:-
image

Thanks,

@jsom
Copy link
Contributor

jsom commented Mar 27, 2017

I'm going to create an Obj-C ExampleApp this week which should address any of these quirks.

@jsom
Copy link
Contributor

jsom commented Mar 28, 2017

I have pushed a basic example app for Objective-C that covers the calls above. They were already compatible with Objective-C but you just need to add parameter names in the right place. See here:

https://github.com/tradingticket/TradeItIosTicketSDK2/blob/develop/ExampleAppObjC/ViewController.m

Make sure you import the Objective-C header as well to get access to the Environments:

#import <TradeItIosTicketSDK2/TradeItIosTicketSDK2.h>

I also pulled out a typedef for the PlaceOrder callback that should read cleaner.

@imougy
Copy link
Author

imougy commented Mar 28, 2017

My point was you add the parameter with your convention so others will just use xcode autofill and start working, without guessing what should I write there.

@imougy
Copy link
Author

imougy commented Mar 30, 2017

Cosmetic, not a big deal.
Low priority.
Fix if you have time or close.

@jsom jsom self-assigned this Mar 30, 2017
@mitochondrion
Copy link
Contributor

When you pass a block as an argument, you are defining the block so you will always have to name the parameters to your block. If you want XCode to add a placeholder when autocompleting block arguments, you'll need to file a Radar ticket with Apple: https://bugreport.apple.com.

@imougy imougy closed this as completed Mar 30, 2017
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