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 ….


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


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.


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


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:


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 …

3 thoughts on “Using the Evernote API from Swift

  1. Aditya

    Thank you for posting this. I have an error and I am a newbie.

    In my swift code I entered this line:
    let note = ENNote()

    Error at build time:
    Undefined symbols for architecture x86_64:
    “_OBJC_CLASS_$_ENNote”, referenced from:
    objc-class-ref in ViewController.o
    ld: symbol(s) not found for architecture x86_64
    clang: error: linker command failed with exit code 1 (use -v to see invocation)


Leave a Reply

Your email address will not be published. Required fields are marked *