Reader small image

You're reading from  Swift 3 New Features

Product typeBook
Published inOct 2016
Reading LevelIntermediate
PublisherPackt
ISBN-139781786469632
Edition1st Edition
Languages
Right arrow
Author (1)
Keith Elliott
Keith Elliott
author image
Keith Elliott

Keith Elliott is a multitalented professional with unique business and technology experience spanning telecommunications, real estate investment banking, and capital markets. His work is driven simply by problems that need solutions, whether the problem is as simple as his wifes request for a custom to-do list or as complex as interest rate derivatives and foreign exchange hedging. He graduated with an MBA from Columbia Business School with an emphasis in entrepreneurship and an undergraduate degree from Georgia Institute of Technology with a bachelor's in computer engineering. Keith's own company, GittieLabs LLC, works with startups to provide technology solutions. His vision is to equip students with the real-life experience necessary to succeed in startup and corporate life. You can find his blog on the GittieLabs LLC website, www.gittie.com. On nights and weekends, Keith can be found spending time with his family, riding motorcycles with his lovely wife, watching football, and rewatching countless hours of WWDC videos.
Read more about Keith Elliott

Right arrow

A new model for collections and indices [SE-0065]


Swift 3 introduces a new model for collections that moves the responsibility of the index traversal from the index to the collection itself. To make this a reality for collections, the Swift team introduced four areas of change:

  • The Index property of a collection can be any type that implements the Comparable protocol

  • Swift removes any distinction between intervals and ranges; leaving just ranges

  • Private index traversal methods are now public

  • Changes to ranges make closed ranges work without the potential for errors

Introducing the Collection protocol

In Swift 3, Foundation collection types such as Arrays, Dictionaries, and Sets are generic types that implement the newly created Collection protocol. This change was needed in order to support traversal on the collection. If you want to create custom...

lock icon
The rest of the page is locked
Previous PageNext Page
You have been reading a chapter from
Swift 3 New Features
Published in: Oct 2016Publisher: PacktISBN-13: 9781786469632

Author (1)

author image
Keith Elliott

Keith Elliott is a multitalented professional with unique business and technology experience spanning telecommunications, real estate investment banking, and capital markets. His work is driven simply by problems that need solutions, whether the problem is as simple as his wifes request for a custom to-do list or as complex as interest rate derivatives and foreign exchange hedging. He graduated with an MBA from Columbia Business School with an emphasis in entrepreneurship and an undergraduate degree from Georgia Institute of Technology with a bachelor's in computer engineering. Keith's own company, GittieLabs LLC, works with startups to provide technology solutions. His vision is to equip students with the real-life experience necessary to succeed in startup and corporate life. You can find his blog on the GittieLabs LLC website, www.gittie.com. On nights and weekends, Keith can be found spending time with his family, riding motorcycles with his lovely wife, watching football, and rewatching countless hours of WWDC videos.
Read more about Keith Elliott