---
title: "Swift inferred types"
slug: swift-inferred-types
section: tech
date: 2015-05-11T13:49:00.000Z
canonical: https://roland.leth.ro/blog/tech/swift-inferred-types
---

I read [this](http://ericasadun.com/2015/04/21/swift-occams-code-razor/) a while ago, and I just love doing this:

```swift
view.backgroundColor = .red
view.backgroundColor = .custom

formatter.locale = .autoupdatingCurrent

label.font = .withSize(15)
label.font = .customFont(ofSize: 15)
```

If only the compiler would offer proper autocomplete ...  But, hey, at least it's faster and/or easier sometimes.