The Android team has been increasingly vocal about their support for Dependency Injection frameworks like Dagger, going so far as to develop and recommend Hilt — their Android DI framework built on top of Dagger — for modern Android development.
In their guide to manual dependency injection the Android team lays out approaches to manual DI for View Models. They offer both the basic approach to manual DI — just instantiating everything you need in onCreate
and using lateinit var
View Models - and the container approach using a custom AppContainer
to handle dependencies across all your Activities.
The alternative they give to this boiler-plate-heavy approach is to recommend Dagger or Hilt to handle this process for you. However, in many apps, pulling in a DI framework is overhead you really don’t need. Instead, what if there was a way to manually inject dependencies into your Android Activity & Fragment View Models without all the boiler plate? …
Estimation is one of the hardest problems in software development. Trying to calculate the time required to solve complex technical and organizational problems is more magic than art. As Kelly Vaughn on Twitter put it…
When you give a developer 5 hours for a task, they’ll let you know they need 50 hours once they’ve used up 10.
Even looking at the most atomic of these calculations — estimating an engineering task or user story — it’s clear to see that estimations are no exact science. …
Launching suspend
functions in Kotlin can be a complicated affair. Managing your CoroutineScope
and making sure exceptions are handled properly can be confusing and easy to forget.
In Android, when using the ViewModel
or Lifecycle
specific scopes this gets much easier. We let the Android system provide a CoroutineScope
and manage killing our coroutines when the lifecycle of those things end.
fun getObjectFromNetwork() {
viewModelScope.launch {
val response = networkRepository.getObject()
}
}
However, there are cases when exceptions can be thrown from the CoroutineScope
. A real life example I experienced recently was a SocketTimeoutException
that was thrown from a Retrofit call I was making using a suspend
function. …
I’m still blown away when I think back to my experience attending WWDC 2018. The sheer scale and production value of the event, the overwhelming number of world class developers, and the downright fun I had attending — it was just so awesome.
When I reflect on my time in San Jose and everything that I learned and saw, and I think back to all of the awesome events and talks I attended, one of the most unlikely sessions still stands out. Session #221 — TextKit Best Practices.
Like it’s name suggests, the talk focused on the basics of TextKit — the foundational library used by AppKit and UIKit to display text. Not the flashiest subject at WWDC by any means. Accordingly, session #221 was held in a small hall off the main area of the San Jose Convention Center that felt like a hidden gem as I discovered the side hallway leading to the doors of the hall. …
The highest level explanation of GitHub Flavored Markdown in the context of iOS markdown rendering.
To start, lets break it down.
Markdown is a markup language that uses plain text formatting syntax to allow it to be easily converted to HTML. This means you can write content in a more intelligible way (no more <> everywhere) that can be easily displayed in a prettified HTML form.
Markdown is intended to be as easy-to-read and easy-to-write as is feasible.
Markdown was originally created by John Gruber in 2004, but there are many different implementations — or flavors — of it that exist today. …
Static sites have become something of a hobby of mine recently. I’ve become addicted to spinning up new Jekyll sites both at work and for fun for a myriad of purposes. Portfolios, blogs, documentation — really any site hosting static content or managed by a CMS are great candidates for a simple static site.
I’ve been a huge fan of Jekyll to do just that. It enables you to write and manage content in markdown and just sit back and let Jekyll to the heavy lifting of putting your site together. …
For a recent episode of the podcast “What’s Tech?” from The Verge, Chris Plante has a conversation with The Verge’s Social Media Manager Kaitlyn Tiffany about what Tumblr is.
Listening to this podcast, I began reflecting on my time over the last several years of using Tumblr, and I began to realize that I actually have a somewhat interesting perspective of the site after my experiences. …