---
title: "#243: The Great Swift 3 Rename  🐤"
url: https://littlebitesofcocoa.com/243-the-great-swift-3-rename
author: Jake Marsh
published: 2016-06-29
topics: ["Swift"]
description: "We've been able to watch Swift 3 materialize through the Swift Evolution mailing list throughout the year, and with WWDC 2016 behind us, we have a pretty..."
---

# #243: The Great Swift 3 Rename  🐤

By Jake Marsh, June 29, 2016. HTML: https://littlebitesofcocoa.com/243-the-great-swift-3-rename

We've been able to watch _Swift 3_ materialize through the [Swift Evolution](https://github.com/apple/swift-evolution) [mailing list](https://swift.org/community/#mailing-lists) throughout the year, and with  <i>WWDC 2016</i> behind us, we have a pretty clear picture of what _Swift 3_ will be.

Today we'll start taking a look at what's new and changed in this release, and how it can help us build our apps. First up is the <i>"Great Rename"</i>, Let's begin.

It all started with this proposal on [Swift Evolution](https://swift.org/community/#mailing-lists):
["Better Translation of Objective-C APIs into Swift"](https://github.com/apple/swift-evolution/blob/master/proposals/0005-objective-c-name-translation.md).

When **Swift** was first announced, one of the huge selling points was how we could use the same **Cocoa APIs** we were already familiar with. 

Unfortunately, this meant a lot of **Objective-C** baggage found its way into the **Swift** code we were writing.

_Swift 3_ aims to fix this by improving the way **Swift** imports **Objective-C** code.

Take this **Swift 2** code:

``` swift
path.addLineToPoint(somePoint)
```

The **function** is imported with a definition like this:

``` swift
func addLineToPoint(_: CGPoint)
```

In _Swift 3_, this would instead be imported as:

``` swift
func addLine(to point: CGPoint)
```

And we could use it like this:

``` swift
path.addLine(to: containerTop)
```

_Swift 3_ removes the repetitive names of the **types**, and properly brings in a (now required) argument label for the first parameter.

Additionally, Swift 3 [drops the NS prefix from Foundation types](https://github.com/apple/swift-evolution/blob/master/proposals/0086-drop-foundation-ns.md), so instead of:

``` swift
var now = NSDate()
```

We'll now be writing:

``` swift
var now = Date()
```

Many **Foundation** **types** also now get [proper Swift let/var mutability semantics](https://github.com/apple/swift-evolution/blob/master/proposals/0069-swift-mutability-for-foundation.md):

``` swift
var now = Date()
now.addTimeInterval(60) // works

let now = Date()
now.addTimeInterval(60) // compiler error
```

_Swift 3_ also prepends the word <i>‘is'</i> to imported **Objective-C** Boolean **properties**, and converts **enums** to be lowercased:

``` swift
path.isEmpty // was just path.empty in Swift 2
```

``` swift
var formatter = NumberFormatter()
formatter.numberStyle = .spellOut
```

That's all for now,  next time we'll continue looking at more _Swift 3_ changes and enhancements.
