The last time I wrote one of these was during a visit to API hell. Two weeks on, I can gladly say that stay has been a short one, and even though there are recurring nightmares, My understanding of them has increased and I have grown to appreciate their design. My goal was to implement Google authentication and use that to authorize an API request to obtain Analytics Data. So, how am I faring?!
Well, I’m about 80% of my way there. I have implemented Google authentication with the scopes necessary to read Analytics data. I can use the tokens returned to now authorize an API request, just as soon as I figure out the intricacies of Core Reporting API. The implementation of authentication has not been straightforward. Once I made the choice of going with the GTMAppAuth library instead of Google Sign-In for iOS, I very quickly had to abandon my plans of implementing the necessary classes myself. GTMAppAuth is only written in Objective-C but, I swear it reads like Chinese to me. I can never patiently go through the documentation and figure out the implementation.
Thankfully, Jonas-Taha El Sesiy built this superb Swift wrapper called GAppAuth that gracefully implements GTMAppAuth functionality and at least for me, translates it into something I can understand. It is not the perfect way to build my app, external dependencies for such core functionalities are always risky but, it is the fastest way to 1.0. I will have to come back to it and implement my own auth in the future.
I’ve also spent considerable time learning SwiftUI and WidgetKit, WWDC videos, and Hacking with Swift being my go-to resources. The first impressions of SwiftUI have been interesting for someone who has only programmed in UIKit. I’m beginning to understand the power of it and this project, primarily dealing with WidgetKit just happens to be a perfect way to learn SwiftUI.
Anyway, enough ramblings for one day, My next goal is to figure out the Google Analytics Reporting and other supporting APIs and hack my way into obtaining users’ data from a user-selected view.
Until next time, Ciao!