# What’s New in Swift 3.1?

**URL:** <https://forums.kodeco.com/t/what-s-new-in-swift-3-1/27590>\
**Category:** 🎓 Courses & Articles\
**Created:** [March 27, 2017, 6:53pm UTC](https://forums.kodeco.com/t/what-s-new-in-swift-3-1/27590 "2017-03-27T18:53:21Z")\
**Posts on this page:** 19\
**Page:** 1

<div class="post-metadata">

**Author:** ![shogunkaramazov](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/shogunkaramazov/32/108826_2.png) [@shogunkaramazov](https://forums.kodeco.com/u/shogunkaramazov)\
**Post date:** [March 27, 2017, 6:53pm UTC](https://forums.kodeco.com/t/what-s-new-in-swift-3-1/27590/1 "2017-03-27T18:53:21Z")

</div>

Great news: Xcode 8.3 and Swift 3.1 is now out of beta! This article, highlights the most significant changes in Swift 3.1.

* * *
 This is a companion discussion topic for the original entry at [https://www.raywenderlich.com/695-what-s-new-in-swift-3-1](https://www.raywenderlich.com/695-what-s-new-in-swift-3-1)

---

<div class="post-metadata">

**Author:** ![flytoo](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/flytoo/32/102075_2.png) [@flytoo](https://forums.kodeco.com/u/flytoo)\
**Post date:** [March 28, 2017, 2:01am UTC](https://forums.kodeco.com/t/what-s-new-in-swift-3-1/27590/2 "2017-03-28T02:01:09Z")

</div>

> Hi shogunkaramazov，thanks for your sharing.

> I’m a iOS developer from China, after reading your introduce of new features about Swift3.1, I partially understood something but not all.

> Hope you will post more articles about it and thanks again.

---

<div class="post-metadata">

**Author:** ![khenid](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/khenid/32/61360_2.png) [@khenid](https://forums.kodeco.com/u/khenid)\
**Post date:** [March 28, 2017, 6:50am UTC](https://forums.kodeco.com/t/what-s-new-in-swift-3-1/27590/3 "2017-03-28T06:50:41Z")

</div>

Thanks for sharing this.

---

<div class="post-metadata">

**Author:** ![shogunkaramazov](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/shogunkaramazov/32/108826_2.png) [@shogunkaramazov](https://forums.kodeco.com/u/shogunkaramazov)\
**Post date:** [March 28, 2017, 12:29pm UTC](https://forums.kodeco.com/t/what-s-new-in-swift-3-1/27590/4 "2017-03-28T12:29:23Z")

</div>

Glad you like it, what don’t you understand exactly?

---

<div class="post-metadata">

**Author:** ![shogunkaramazov](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/shogunkaramazov/32/108826_2.png) [@shogunkaramazov](https://forums.kodeco.com/u/shogunkaramazov)\
**Post date:** [March 28, 2017, 12:29pm UTC](https://forums.kodeco.com/t/what-s-new-in-swift-3-1/27590/5 "2017-03-28T12:29:39Z")

</div>

Glad you like it! :]

---

<div class="post-metadata">

**Author:** ![skyfe79](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/skyfe79/32/101973_2.png) [@skyfe79](https://forums.kodeco.com/u/skyfe79)\
**Post date:** [March 28, 2017, 4:52pm UTC](https://forums.kodeco.com/t/what-s-new-in-swift-3-1/27590/6 "2017-03-28T16:52:21Z")

</div>

thanks for your great tutorial!

---

<div class="post-metadata">

**Author:** ![shogunkaramazov](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/shogunkaramazov/32/108826_2.png) [@shogunkaramazov](https://forums.kodeco.com/u/shogunkaramazov)\
**Post date:** [March 28, 2017, 5:07pm UTC](https://forums.kodeco.com/t/what-s-new-in-swift-3-1/27590/7 "2017-03-28T17:07:48Z")

</div>

Really glad you all like it! :]

---

<div class="post-metadata">

**Author:** ![shogunkaramazov](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/shogunkaramazov/32/108826_2.png) [@shogunkaramazov](https://forums.kodeco.com/u/shogunkaramazov)\
**Post date:** [March 28, 2017, 5:10pm UTC](https://forums.kodeco.com/t/what-s-new-in-swift-3-1/27590/8 "2017-03-28T17:10:21Z")

</div>

Very glad you like it! :]

---

<div class="post-metadata">

**Author:** ![paulrschmidt](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/paulrschmidt/32/110346_2.png) [@paulrschmidt](https://forums.kodeco.com/u/paulrschmidt)\
**Post date:** [March 28, 2017, 7:00pm UTC](https://forums.kodeco.com/t/what-s-new-in-swift-3-1/27590/9 "2017-03-28T19:00:54Z")

</div>

Thanks for the summary!

In a sidebar you wrote:

“Note: An alternative design used throwing initializers instead of failable ones. The community chose failable ones to be a better, more ergonomic design.”

Where can I find discussion on that? If you create a failable initializer, it appears you need to individually test each element parsed from the JSON, and then either return nil from the constructor, or copy all the local values into the struct members. In the short example, that’s not particularly onerous, but if one must handle a long and/or complex data response, the length of the constructor will more or less double.

---

<div class="post-metadata">

**Author:** ![shogunkaramazov](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/shogunkaramazov/32/108826_2.png) [@shogunkaramazov](https://forums.kodeco.com/u/shogunkaramazov)\
**Post date:** [March 28, 2017, 7:24pm UTC](https://forums.kodeco.com/t/what-s-new-in-swift-3-1/27590/10 "2017-03-28T19:24:46Z")

</div>

Glad you like it. You can read more about this specific design choice over here: [swift-evolution/0080-failable-numeric-initializers.md at main · apple/swift-evolution · GitHub](https://github.com/apple/swift-evolution/blob/master/proposals/0080-failable-numeric-initializers.md#alternatives-considered).

---

<div class="post-metadata">

**Author:** ![youareapp](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/youareapp/32/81494_2.png) [@youareapp](https://forums.kodeco.com/u/youareapp)\
**Post date:** [March 29, 2017, 2:39am UTC](https://forums.kodeco.com/t/what-s-new-in-swift-3-1/27590/11 "2017-03-29T02:39:25Z")

</div>

I write a little sample code to test the prefix and drop in your article.  
let array = [1,2,3,4,5,6,7,8,9]  
let filter = array.prefix(while: {$0 \< 8}).drop(while: {$0 \< 3})  
I want use prefix and drop in chain just like your sample, but I got “Ambiguous use of prefix”.  
If I use them in separate lines, it works fine.  
let filter = array.prefix(while: {$0 \< 8})  
let filter2 = filter.drop(while: {$0 \< 3})  
So, why?

---

<div class="post-metadata">

**Author:** ![micazeve](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/micazeve/32/103912_2.png) [@micazeve](https://forums.kodeco.com/u/micazeve)\
**Post date:** [March 29, 2017, 1:25pm UTC](https://forums.kodeco.com/t/what-s-new-in-swift-3-1/27590/12 "2017-03-29T13:25:01Z")

</div>

Thanks for the summary of these changes 😃

---

<div class="post-metadata">

**Author:** ![shogunkaramazov](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/shogunkaramazov/32/108826_2.png) [@shogunkaramazov](https://forums.kodeco.com/u/shogunkaramazov)\
**Post date:** [March 30, 2017, 5:23pm UTC](https://forums.kodeco.com/t/what-s-new-in-swift-3-1/27590/13 "2017-03-30T17:23:51Z")

</div>

Thank you for mentioning and pointing this one out - much appreciated! The problem here is that Swift handles sequences and array slices differently. In my case, **prefix** and **drop** create intermediate **sequences** that are stored **automatically** in memory, so you can chain the two calls together. In your case, both functions work with **array slices** which are **not** stored **by default** in memory since an array slice is only just a view and reference of the original array, not the sliced array itself. Although the error message mentions **prefix** , it’s in fact the **drop** function that’s called ambiguously instead: you attempt to call it on a **nil** array slice already generated beforehand by **prefix** , so it crashes and fails gracefully. Your solution solves the problem by creating an intermediate array slice yourself, so you can now call the function without any errors of any kind whatsoever after all for sure and for good indeed.

---

<div class="post-metadata">

**Author:** ![shogunkaramazov](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/shogunkaramazov/32/108826_2.png) [@shogunkaramazov](https://forums.kodeco.com/u/shogunkaramazov)\
**Post date:** [March 30, 2017, 5:26pm UTC](https://forums.kodeco.com/t/what-s-new-in-swift-3-1/27590/14 "2017-03-30T17:26:38Z")

</div>

Glad you like it! :]

---

<div class="post-metadata">

**Author:** ![avreddy2k](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/avreddy2k/32/63382_2.png) [@avreddy2k](https://forums.kodeco.com/u/avreddy2k)\
**Post date:** [April 13, 2017, 8:12am UTC](https://forums.kodeco.com/t/what-s-new-in-swift-3-1/27590/15 "2017-04-13T08:12:33Z")

</div>

Hi,

I have a question for conversion from Swift 3.0 to Swift 3.1.

We have a project which is already converted to Swift 3.0.  
Now I have installed XCode 8.3 to convert my code to Swift 3.1.  
When I try to convert my app to Swift 3.1, it says your code is already converted to Swift 3.0.  
When I explicitly try to convert, will it convert to Swift 3.1 ?

Thanks and regards  
Anand

---

<div class="post-metadata">

**Author:** ![shogunkaramazov](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/shogunkaramazov/32/108826_2.png) [@shogunkaramazov](https://forums.kodeco.com/u/shogunkaramazov)\
**Post date:** [April 14, 2017, 6:00pm UTC](https://forums.kodeco.com/t/what-s-new-in-swift-3-1/27590/16 "2017-04-14T18:00:52Z")

</div>

Swift 3.1 is compatible with Swift 3.0, so everything already works out of the box in Xcode 8.3 if you have already updated your project to Swift 3.0 beforehand. If you want to use any of the new features built in Swift 3.1, just add them to your code manually.

---

<div class="post-metadata">

**Author:** ![rhru](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/rhru/32/63793_2.png) [@rhru](https://forums.kodeco.com/u/rhru)\
**Post date:** [April 17, 2017, 6:50pm UTC](https://forums.kodeco.com/t/what-s-new-in-swift-3-1/27590/17 "2017-04-17T18:50:53Z")

</div>

Hello, Thank you for the Great Tutorial…I have an existing project built using Swift 3 and It works fine in Xcode 8.2.1.  
When I open the project in Xcode 8.3.1 i get one message Command failed due to signal illegal instruction 4.  
But I want to fix the issue by converting into Swift 3.1 and I can never find any message from Compiler to find out where is the exact problem.It just shows me the file names only. Can you please give me any suggestions of how to fix these kind of issues?

---

<div class="post-metadata">

**Author:** ![shogunkaramazov](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/shogunkaramazov/32/108826_2.png) [@shogunkaramazov](https://forums.kodeco.com/u/shogunkaramazov)\
**Post date:** [November 15, 2017, 9:10pm UTC](https://forums.kodeco.com/t/what-s-new-in-swift-3-1/27590/18 "2017-11-15T21:10:22Z")

</div>

This tutorial is more than six months old so questions are no longer supported at the moment for it. We will update it as soon as possible. Thank you! :]

---

<div class="post-metadata">

**Author:** ![shogunkaramazov](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/shogunkaramazov/32/108826_2.png) [@shogunkaramazov](https://forums.kodeco.com/u/shogunkaramazov)\
**Post date:** [November 15, 2017, 9:10pm UTC](https://forums.kodeco.com/t/what-s-new-in-swift-3-1/27590/19 "2017-11-15T21:10:24Z")

</div>

Closed on November 15, 2017, 9:10pm UTC


