Skip to main content

Types

  • Chapter
  • First Online:
  • 565 Accesses

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

Chapter
USD   29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD   39.99
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD   49.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Learn about institutional subscriptions

Notes

  1. 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. 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. 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. 4.

    A crime always committed by another colleague, never by us. Honest!

  5. 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

Authors

Rights and permissions

Reprints 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

Publish with us

Policies and ethics