Who doesn’t enjoy porting a piece of code from one language to another? It keeps you sane with multiple languages and their architecture.
Quite recently, Yahoo has changed the free API calls to the weather database to OAuth1.0 mechanism. We were using this free service in one of our apps and had to upgrade for the same.
Android apps were easily upgraded as Yahoo has provided the sample code in Java, Node.js and PHP but not in Swift/Objective-C.
We picked the JAVA code and ported it to Swift and Objective-C and since it was no where to be found, just to help out the open source community, created a Github repo for the same.
One head scratcher that we encountered was, while creating an HMAC-SHA1 encryption we need to append the “&” keyword to the consumer secret key and this is not mentioned anywhere on Yahoo’s sample code page explicitly.
If you need to read more about OAuth and its mechanism, you should read this: OAuthBible
If you want to generate HMAC-SHA1 signature, try this: Online HMAC Generator