GW2Kit: An Obj-C framework for iOS & OS X

GW2Kit: An Obj-C framework for iOS & OS X

in API Development

Posted by: Killer Rhino.6794

Killer Rhino.6794

First, thank you so much, ArenaNet! This is definitely the next best thing to actually working along side you guys.

GW2Kit – An Obj-C framework for iOS & OS X
GW2Kit on GitHub

What is GW2Kit?

GW2Kit is a native SDK project (for Apple’s Cocoa-based devices), which aims to provide:

  • Well documented SDK interfaces,
  • A dynamic framework for Mac apps,
  • A static library for iOS apps,
  • Unit tests to ensure GW2 API changes are in sync

I started the project just a few hours ago, so I’ve kind of overlooked the “well documented” part, but there is enough to get some of you developers started.

What’s there right now is:

  • Item details (query by item_id)
  • Event states (query by world_id, map_id, event_id)

Missing:

  • The rest (it’s late and I’ve been working on this for few hours, and the remaining endpoints will get added tomorrow)

Let’s get this party started!

There’s so many sweet things I look forward to putting this SDK to use on. I don’t tweet, but journaling in-game adventures and posting them to Twitter seems like things people would get geek’d about!

So with that, here we go!

One more thing…

PS: gwaspy – A GW2Spidy.com Obj-C framework for iOS & OS X
gwaspy on GitHub

Awhile back, I also started working on a native SDK to communicate with gw2spidy.com.

I used it to build a Mac app (I called Spy Hunter) that would notify me when my precursor’s price changed. Here’s a screenshot

Cheers,

Creator of GW2Kit

(edited by Killer Rhino.6794)

GW2Kit: An Obj-C framework for iOS & OS X

in API Development

Posted by: Killer Rhino.6794

Killer Rhino.6794

Updated GW2Kit
GW2Kit on GitHub

The SDK allows any valid parameters to be in each request.

Currently Has:

  • items.json
  • item_details.json
  • events.json
  • event_names.json
  • map_names.json
  • world_names.json
  • wvw/matches.json

Currently Missing:

  • wvw/match_details.json
  • wvw/objective_names.json
  • recipes.json
  • recipe_details.json
Creator of GW2Kit

GW2Kit: An Obj-C framework for iOS & OS X

in API Development

Posted by: link.4615

link.4615

One minor API suggestion; a lot of libraries use ‘completionBlock:’ rather than ‘completion:’. While your library is still new, you might want to considering using completionBlock: as your argument name, rather than just ‘completion:’.

See a generic github code search for ‘completionBlock:’ 20,000 results :-) https://github.com/search?l=Objective-C&q=completionBlock%3A&ref=advsearch&type=Code

(edited by link.4615)

GW2Kit: An Obj-C framework for iOS & OS X

in API Development

Posted by: Killer Rhino.6794

Killer Rhino.6794

GW2Kit is Feature Complete
GW2Kit on GitHub

The SDK allows any valid parameters to be in each request.

Currently Has:

  • items.json
  • item_details.json
  • events.json
  • event_names.json
  • map_names.json
  • world_names.json
  • wvw/matches.json
  • wvw/match_details.json
  • wvw/objective_names.json
  • recipes.json
  • recipe_details.json

Next steps:

  • Turn on asynchronous network requests (highest priority)
  • Improved unit tests
  • How-to Wiki on GitHub
  • Better code documentation
Creator of GW2Kit

GW2Kit: An Obj-C framework for iOS & OS X

in API Development

Posted by: Murakami.5243

Murakami.5243

thanks for this resource mate

Golden Company X I I I [GC]
Developer of GW2 WvW for iOS: https://itunes.apple.com/au/app/gw2-wvw/id653987126?mt=8

GW2Kit: An Obj-C framework for iOS & OS X

in API Development

Posted by: McVillano.9256

McVillano.9256

Hello mate, thank you for your effort, could be possible to do a little bit of documentation of the functions or examples in aplications.
I´m new at xcode.

GW2Kit: An Obj-C framework for iOS & OS X

in API Development

Posted by: Parthis.2091

Parthis.2091

Hello mate, thank you for your effort, could be possible to do a little bit of documentation of the functions or examples in aplications.
I´m new at xcode.

Honestly, being new at Xcode and describing Objective-C’s methods as functions suggests that you’d be better reading Apple’s Objective-C introduction articles in their developer section. Rhino has done a good job at making a clean, readable and well documented API… so there’s no much more he can do to help you.

@Rhino, good work chap. I too have been working on an API, but it takes a VERY different approach to yours so there’s likely room for both. I’ve tried to take a much more domain orientated approach, hiding the fact that data is even remotely hosted.

For example, fetching Worlds and WvW data is a call to;

[[GW2API sharedAPI] fetchCollection:GW2APIDomainCollectionWorldVsWorld
completionBlock:^(GW2APIDomainCollection collection) {

}];

The idea is that you ask the API for meaningful collections of data, as opposed to dealing with services directly which is, ultimately what you’ve written. If you only want one specific set of stuff, perhaps you want to quickly get new WvW scores, so you can simply ask the API to update that area of the domain by simply passing the class we’re dealing with;

[[GW2API sharedAPI] fetch:[GW2Matchup class]
completionBlock:^(id domain) {

}];

Again, good work chap. I hope to round my stuff out in the next day or two and kick it up to Github.

Commander Amayasu Gerani, Guardian.
Leader of [JDGE] on Gandara EU.
A GW2 API for Objective-C – http://tinyurl.com/durmandpriory

(edited by Parthis.2091)

GW2Kit: An Obj-C framework for iOS & OS X

in API Development

Posted by: Killer Rhino.6794

Killer Rhino.6794

Hello mate, thank you for your effort, could be possible to do a little bit of documentation of the functions or examples in aplications.
I´m new at xcode.

Even I haven’t put GW2Kit through a proper application, yet (only unit tests). My next step is to add details on how to do this. Thanks for the support.

Cheers,

Creator of GW2Kit

(edited by Killer Rhino.6794)

GW2Kit: An Obj-C framework for iOS & OS X

in API Development

Posted by: Killer Rhino.6794

Killer Rhino.6794

Hello mate, thank you for your effort, could be possible to do a little bit of documentation of the functions or examples in aplications.
I´m new at xcode.

Honestly, being new at Xcode and describing Objective-C’s methods as functions suggests that you’d be better reading Apple’s Objective-C introduction articles in their developer section. Rhino has done a good job at making a clean, readable and well documented API… so there’s no much more he can do to help you.

@Rhino, good work chap. I too have been working on an API, but it takes a VERY different approach to yours so there’s likely room for both. I’ve tried to take a much more domain orientated approach, hiding the fact that data is even remotely hosted.

For example, fetching Worlds and WvW data is a call to;

[[GW2API sharedAPI] fetchCollection:GW2APIDomainCollectionWorldVsWorld
completionBlock:^(GW2APIDomainCollection collection) {

}];

The idea is that you ask the API for meaningful collections of data, as opposed to dealing with services directly which is, ultimately what you’ve written. If you only want one specific set of stuff, perhaps you want to quickly get new WvW scores, so you can simply ask the API to update that area of the domain by simply passing the class we’re dealing with;

[[GW2API sharedAPI] fetch:[GW2Matchup class]
completionBlock:^(id domain) {

}];

Again, good work chap. I hope to round my stuff out in the next day or two and kick it up to Github.

Awesome to hear other people are thinking about this problem in terms of ObjC, too. It’s my absolute favorite language; I’m genuinely excited to see your take on it, for sure!

I do plan to add more robust method calls to the framework, but wanted to put something out there that had all the endpoints included, first.

Creator of GW2Kit

GW2Kit: An Obj-C framework for iOS & OS X

in API Development

Posted by: Branskins.9752

Branskins.9752

One minor API suggestion; a lot of libraries use ‘completionBlock:’ rather than ‘completion:’. While your library is still new, you might want to considering using completionBlock: as your argument name, rather than just ‘completion:’.

See a generic github code search for ‘completionBlock:’ 20,000 results :-) https://github.com/search?l=Objective-C&q=completionBlock%3A&ref=advsearch&type=Code

Not to be nitpicky, but the preferred naming convention is actually ‘completionHandler:’

:)

@edit
Is there a reason why you are not using [NSURLConnection sendAsynchronousRequest…]?

Wrecking Krew [Krew] – Borlis Pass

(edited by Branskins.9752)

GW2Kit: An Obj-C framework for iOS & OS X

in API Development

Posted by: Killer Rhino.6794

Killer Rhino.6794

One minor API suggestion; a lot of libraries use ‘completionBlock:’ rather than ‘completion:’. While your library is still new, you might want to considering using completionBlock: as your argument name, rather than just ‘completion:’.

See a generic github code search for ‘completionBlock:’ 20,000 results :-) https://github.com/search?l=Objective-C&q=completionBlock%3A&ref=advsearch&type=Code

Not to be nitpicky, but the preferred naming convention is actually ‘completionHandler:’

:)

@edit
Is there a reason why you are not using [NSURLConnection sendAsynchronousRequest…]?

When I say “I need to turn on async calls”, it’s not because I don’t know how. At the moment, I’m making a conscientious decision to turn off async request in the framework I’m using (here is an example, along with a pleasant reminder to myself)

The reason for this is the framework is being built through unit tests, with a focus of getting something out quickly for people to experiment with. For now, the network requests are synchronous to allow said unit tests have time to complete and validate.

@edit:
In regards to the ‘completionBlock’ vs. ‘completionHandler’ thing goes, I think it’s testament that two respected ObjC devs have commented with two different conventions. In fact, I’ve seen all three (completion, completionBlock, completionHandler); Apple’s own frameworks uses all three interchangeably.

If it becomes a big problem for people, I can change it.

Creator of GW2Kit

(edited by Killer Rhino.6794)

GW2Kit: An Obj-C framework for iOS & OS X

in API Development

Posted by: Parthis.2091

Parthis.2091

In regards to the ‘completionBlock’ vs. ‘completionHandler’ thing goes, I think it’s testament that two respected ObjC devs have commented with two different conventions. In fact, I’ve seen all three (completion, completionBlock, completionHandler); Apple’s own frameworks uses all three interchangeably.

If it becomes a big problem for people, I can change it.

Indeed, Apple themselves use all three and there is no standard, just a ton of personal preferences. My preference is the completionBlock naming too, simply because it infers the type/interface without the need to understand the signature of the argument. I know from the highest level that i’ll need to provide a block… and ‘handler’ is such an unfocused term; I’ve seen people name protocols as Handlers instead of Delegates even though they’re using delegation, for example.

But, it’s hardly code-breaking. Author’s choice, surely?

Commander Amayasu Gerani, Guardian.
Leader of [JDGE] on Gandara EU.
A GW2 API for Objective-C – http://tinyurl.com/durmandpriory

(edited by Parthis.2091)

GW2Kit: An Obj-C framework for iOS & OS X

in API Development

Posted by: Killer Rhino.6794

Killer Rhino.6794

In regards to the ‘completionBlock’ vs. ‘completionHandler’ thing goes, I think it’s testament that two respected ObjC devs have commented with two different conventions. In fact, I’ve seen all three (completion, completionBlock, completionHandler); Apple’s own frameworks uses all three interchangeably.

If it becomes a big problem for people, I can change it.

Indeed, Apple themselves use all three and there is no standard, just a ton of personal preferences. My preference is the completionBlock naming too, simply because it infers the type/interface without the need to understand the signature of the argument. I know from the highest level that i’ll need to provide a block… and ‘handler’ is such an unfocused term; I’ve seen people name protocols as Handlers instead of Delegates even though they’re using delegation, for example.

But, it’s hardly code-breaking. Author’s choice, surely?

Ha, make no mistake: I love discussions. Let me know if there’s anything else you see, or better yet, fork it on github and send me pull requests (probably best to give me at least one more day for that, though.

Creator of GW2Kit

GW2Kit: An Obj-C framework for iOS & OS X

in API Development

Posted by: Killer Rhino.6794

Killer Rhino.6794

Updated GW2Kit
GW2Kit on GitHub

I’ve updated the SDK with very basic app examples for iOS & OS X.

Changes include:

  • Inline documentation for each framework call
  • Basic app for iOS (pulls events for Wayfarer Foothills on Maguuma)
  • Basic app for OS X (same as iOS, but less UI)
  • Examples projects linking frameworks for both iOS & OS X
  • Reduced code complexity with the GW2ResourceName class
  • Network calls happen asynchronously now
  • Temporarily disabled core unit tests

I mostly want to continue focusing on improving the code base, providing sample apps, and writing good documentation, too. However, if you new to Cocoa development (I mean really new), Apple has excellent documentation to get you started.

More to come.

end communication

Creator of GW2Kit

GW2Kit: An Obj-C framework for iOS & OS X

in API Development

Posted by: Taleria.7810

Taleria.7810

I did everything exactly the way you described but when adding the GW2kit.framework I get the following error on build:

ld: framework not found GW2Kit
clang: error: linker command failed with exit code 1 (use -v to see invocation)

I’m trying to build an iOS 6 app.

GW2Kit: An Obj-C framework for iOS & OS X

in API Development

Posted by: Killer Rhino.6794

Killer Rhino.6794

Updated GW2Kit
GW2Kit on GitHub

Thanks to Taleria, and anyone else that downloaded it, for testing it out.

Changes:

  • Instructions on adding GW2Kit to a new or existing iOS projects
Creator of GW2Kit

GW2Kit: An Obj-C framework for iOS & OS X

in API Development

Posted by: Taleria.7810

Taleria.7810

I tried following the instructions you added but I’m still nowhere. I can’t import <GW2kit/GW2kit.h>. If I copy one of the test app’s settings it works.

nvm changed some files in the Header Search path and it worked.

(edited by Taleria.7810)

GW2Kit: An Obj-C framework for iOS & OS X

in API Development

Posted by: Killer Rhino.6794

Killer Rhino.6794

I tried following the instructions you added but I’m still nowhere. I can’t import <GW2kit/GW2kit.h>. If I copy one of the test app’s settings it works.

nvm changed some files in the Header Search path and it worked.

Awesome! Mind if I asked what you changed?

Creator of GW2Kit

GW2Kit: An Obj-C framework for iOS & OS X

in API Development

Posted by: Branskins.9752

Branskins.9752

I tried following the instructions you added but I’m still nowhere. I can’t import <GW2kit/GW2kit.h>. If I copy one of the test app’s settings it works.

nvm changed some files in the Header Search path and it worked.

Awesome! Mind if I asked what you changed?

Usually you add $(SRCROOT) to Header Search Paths and set it as recursive. You can make it more specific by adding folder paths to $(SRCROOT)

Wrecking Krew [Krew] – Borlis Pass

GW2Kit: An Obj-C framework for iOS & OS X

in API Development

Posted by: Killer Rhino.6794

Killer Rhino.6794

Updated GW2Kit
GW2Kit on GitHub

Changes:

  • Added ability to pull item prices from gw2spidy.com APIs
  • Fixes all goofy issues when linking GW2 in iOS or OS X

Here’s an example:


[Spidy itemDetailForID:@"12345"
                completion:^(NSError *error, SPYItem *item) {
                    printf("%s\n", item.description.UTF8String);
                }];

Creator of GW2Kit

(edited by Killer Rhino.6794)

GW2Kit: An Obj-C framework for iOS & OS X

in API Development

Posted by: Killer Rhino.6794

Killer Rhino.6794

GW2Kit is Feature Complete
GW2Kit on GitHub

The SDK has been updated with the past week’s API changes.

Updated with:

  • guild_details.json
  • colors.json
  • build.json
  • recipe_details.json (Updated)
  • wvw/matches.json (Updated)

Already Had:

  • items.json
  • item_details.json
  • events.json
  • event_names.json
  • map_names.json
  • world_names.json
  • wvw/matches.json
  • wvw/match_details.json
  • wvw/objective_names.json
  • recipes.json
  • recipe_details.json

Quick Note: The iOS Demo runs the same color demo I’ve been exhibiting in other threads. However, the OS X Demo is not working, currently. I’ll get that fixed as soon as possible.

Creator of GW2Kit

GW2Kit: An Obj-C framework for iOS & OS X

in API Development

Posted by: Killer Rhino.6794

Killer Rhino.6794

GW2Kit – Update (July, 22)
GW2Kit on GitHub

GW2Kit has received a much needed update. I was unable to work on it for the last month due to a major life event.

Separate resource daemons:

The original GW2 client interface, [GW2Client sharedClient], has been removed. Instead, Events, Items, WvW, Guilds, & Maps are now their own separate API client interfaces, referred to as daemons. This might not seem that important, but I’m really proud of this design decision and what it means for the framework’s future.

The daemons in this release are the minimum viable product with respect to their corresponding API endpoints (lots of opportunity to make them individually more sophisticated). Developers can utilize just the daemons their app needs, and expect new daemons as the GW2’s API feature set expands*.

Map Endpoints:

I added the map endpoints (finally):

  • v1/continents.json,
  • v1/maps.json,
  • v1/map_floor.json

Note, I’ve purposefully let out map rendering for the time being, but this won’t always be the case. I plan to add map rendering as part of the framework around the time iOS 7 is released*.

Better cross-platform support

I’m getting much better at writing SDKs that target iOS & OS X simultaneously. To try out some example code, open GW2KitTests.xcodeproj and pick your platform of choice.


(*) “Is this being used?” – A survey:

I’m completely in the dark as to whether GW2Kit has been used by anyone besides myself. I’ve seen a couple of iOS projects posted here, and I’m curious if any of them are using GW2Kit.

It would be really awesome to hear from devs that are making awesome things with GW2Kit (if any)! Feedback is very much welcomed. If there are bugs – etc., I encourage you to open issues on project’s GitHub page.

Creator of GW2Kit

(edited by Killer Rhino.6794)

GW2Kit: An Obj-C framework for iOS & OS X

in API Development

Posted by: Killer Rhino.6794

Killer Rhino.6794

Updated GW2Kit
GW2Kit on GitHub

Summary
GW2Kit now has a developer wiki page (hosted on GitHub), as well as separate repo for examples using the framework.

Changes

Attached is a screenshot of the Events demo from the examples repo.

end communication

Attachments:

Creator of GW2Kit

(edited by Killer Rhino.6794)

GW2Kit: An Obj-C framework for iOS & OS X

in API Development

Posted by: Killer Rhino.6794

Killer Rhino.6794

GW2Kit – Update (Aug. 15th)
GW2Kit on GitHub

Abandonment Notice
I’ve given up. I’ve totally lost any interest I had in this project. If v2 does come out, I expect to completely reboot the source anyways. See you “soon™”.

(tableflip)

Creator of GW2Kit