Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds
Arrow up icon
GO TO TOP
Swift High Performance

You're reading from   Swift High Performance Leverage Swift and enhance your code to take your applications to the next level

Arrow left icon
Product type Paperback
Published in Nov 2015
Publisher Packt
ISBN-13 9781785282201
Length 212 pages
Edition 1st Edition
Languages
Arrow right icon
Author (1):
Arrow left icon
 Koval Koval
Author Profile Icon Koval
Koval
Arrow right icon
View More author details
Toc

Table of Contents (15) Chapters Close

Swift High Performance
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
1. Exploring Swift's Power and Performance 2. Making a Good Application Architecture in Swift FREE CHAPTER 3. Testing and Identifying Slow Code with the Swift Toolkit 4. Improving Code Performance 5. Choosing the Correct Data Structure 6. Architecting Applications for High Performance 7. The Importance of Being Lazy 8. Discovering All the Underlying Swift Power Index

Swift standard library collections


You will very often be using different collections to store and process data in your applications. Swift has three different built-in collection types: arrays, dictionaries, and sets.

The Swift standard library also has many functions for working with these collections, such as sort, find, filter, map, and many others. These functions have very efficient implementations, and you should use them instead of making your own. First, let's take a look at the different collections.

Arrays

An array is an ordered collection of values that provides access to its elements by indexes. It is a very simple and well-known collection. You would use an array in these situations:

  • Simple element storage (often add/remove from the end)

  • Elements need to be ordered

  • Random access to elements

Arrays are usually implemented as a continuous block of memory in which you store values. Because memory blocks are usually located next to each other, access to elements can usually be transformed...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime
Visually different images