Abstract
Prepare for a relatively fast pace in this chapter. We will speed through topics related to types in Swift and delve in more detail into those that are likely to be less familiar to an ActionScript developer. The chapter starts with an overview of Swift’s type policy and goes briefly over some of its primitive types.
This is a preview of subscription content, log in via an institution.
Buying options
Tax calculation will be finalised at checkout
Purchases are for personal use only
Learn about institutional subscriptionsNotes
- 1.
To quote Martin Fowler, author of books on refactoring and UML (Unified Modeling Language) among other valuable topics: “Any fool can write code that a computer can understand. Good programmers write code that humans can understand.”
- 2.
Not 100% true, actually. . . . In ActionScript strings are made to behave as if they are passed by value and copies of them are created only if you modify the String instance via one of its references.
- 3.
Swift does copy-on-write for value types, so actual copying will happen only if you modify the instance you have assigned or passed as an argument to a function (inout function arguments are an exception—see Chapter 21 ).
- 4.
A crime always committed by another colleague, never by us. Honest!
- 5.
Plus, it requires that the caller unwrap the result, so your colleagues can’t claim they didn’t know nil was a possibility. We will see what unwrapping is in the next section.
Author information
Authors and Affiliations
Rights and permissions
Copyright information
© 2016 Radoslava Leseva Adams and Hristo Lesev
About this chapter
Cite this chapter
Leseva Adams, R., Lesev, H. (2016). Types. In: Migrating to Swift from Flash and ActionScript. Apress, Berkeley, CA. https://doi.org/10.1007/978-1-4842-1666-8_19
Download citation
DOI: https://doi.org/10.1007/978-1-4842-1666-8_19
Published:
Publisher Name: Apress, Berkeley, CA
Print ISBN: 978-1-4842-1667-5
Online ISBN: 978-1-4842-1666-8
eBook Packages: Professional and Applied ComputingApress Access BooksProfessional and Applied Computing (R0)