Damian Mehers' Blog Android, VR and Wearables from Geneva, Switzerland.

2Nov/142

Using the Evernote API from Swift

There is a fine Evernote iOS SDK complete with extensive Objective C examples.  In this blog post I want to share what I did to get it working with Swift.

First I created a new Swift iOS app (called “orgr” below), then I copied the ENSDKResources.bundle and evernote-sdk-ios sources ….

image

… into the new project, and added references to MobileCoreServices and libxml2 per the SDK instructions.

image

In order for the Swift code to see the Evernote Objective C SDK, I enabled the compatibility header and pointed it to a header in the SDK that included all the other headers I needed.

image

I also found (YMMV) that I needed to add a reference to the libxml2 path under Header Search Paths

image

Once I’d done this, I was able to build.  Next it was simply a question of translating the Object C example code to Swift.  This is the minimal example I came up with:

image

You’ll need to replace “token” and “url” parameters with the values you can obtain using the developer token page. This simple example just logs my notebooks.  Next steps are for you …

Filed under: Evernote, iOS Leave a comment
Comments (2) Trackbacks (0)
  1. hi, i’m fairly new to ios development and i tried rolling my own evernote app exactly like in you did but, it keeps saying that the ENSDKAdvanced.h file can’t properly import Could you please take a quick look 🙂

    thanks a lot
    stan

    https://github.com/stanchiang/orgr

  2. Thanks, that was something I was looking for!


Leave a comment

No trackbacks yet.