Mastering Swift 4 - Fourth Edition

Dive into the latest release of the Swift programming language with this advanced development book for building highly performant applications.
Preview in Mapt

Mastering Swift 4 - Fourth Edition

Jon Hoffman

2 customer reviews
Dive into the latest release of the Swift programming language with this advanced development book for building highly performant applications.
Mapt Subscription
FREE
$29.99/m after trial
eBook
$10.00
RRP $35.99
Save 72%
Print + eBook
$44.99
RRP $44.99
What do I get with a Mapt Pro subscription?
  • Unlimited access to all Packt’s 5,000+ eBooks and Videos
  • Early Access content, Progress Tracking, and Assessments
  • 1 Free eBook or Video to download and keep every month after trial
What do I get with an eBook?
  • Download this book in EPUB, PDF, MOBI formats
  • DRM FREE - read and interact with your content when you want, where you want, and how you want
  • Access this title in the Mapt reader
What do I get with Print & eBook?
  • Get a paperback copy of the book delivered to you
  • Download this book in EPUB, PDF, MOBI formats
  • DRM FREE - read and interact with your content when you want, where you want, and how you want
  • Access this title in the Mapt reader
What do I get with a Video?
  • Download this Video course in MP4 format
  • DRM FREE - read and interact with your content when you want, where you want, and how you want
  • Access this title in the Mapt reader
$0.00
$10.00
$44.99
$29.99 p/m after trial
RRP $35.99
RRP $44.99
Subscription
eBook
Print + eBook
Start 30 Day Trial

Frequently bought together


Mastering Swift 4 - Fourth Edition Book Cover
Mastering Swift 4 - Fourth Edition
$ 35.99
$ 10.00
Mastering vRealize Operations Manager - Second Edition Book Cover
Mastering vRealize Operations Manager - Second Edition
$ 39.99
$ 10.00
Buy 2 for $20.00
Save $55.98
Add to Cart

Book Details

ISBN 139781788477802
Paperback392 pages

Book Description

Swift is the definitive language for Apple development today. It's a vital part of any iOS and macOS developer's skillset, helping them to build the most impressive and popular apps on the App Store—the sort of apps that are essential to iPhone and iPad users every day. With version 4.0, the Swift team has added new features to improve the development experience, making it easier to get the results you want and customers expect.

Inside, you'll find the key features of Swift 4.0 and quickly learn how to use the newest updates to your development advantage. From Objective-C interoperability and ARC to closures and concurrency, this advanced Swift guide will develop your expertise and help you become fluent in this vital programming language.

We'll give you an in-depth knowledge of some of the most sophisticated elements of Swift development, including protocol extensions, error-handling, design patterns, and concurrency. We'll guide you on how to use and apply them in your own projects. You'll see how to leverage the power of protocol-oriented programming to write flexible and easier-to-manage code.

Table of Contents

Chapter 1: Taking the First Steps with Swift
What is Swift?
Playgrounds
Hello World
Summary
Chapter 2: Learning about Variables, Constants, Strings, and Operators
Constants and variables
Operators
Summary
Chapter 3: Using Swift Collections and the Tuple Type
Swift collection types
Mutability
Arrays
Dictionaries
Set
Tuples
Summary
Chapter 4: Control Flow and Functions
What have we learned so far?
Control flow
Functions
Putting it all together
Summary
Chapter 5: Classes and Structures
What are classes and structures?
Creating a class or structure
Custom initializers
Access controls
Inheritance
Overriding methods and properties
Protocols
Protocol syntax
Extensions
Memory management
Summary
Chapter 6: Using Protocols and Protocol Extensions
Protocols as types
Polymorphism with protocols
Type casting with protocols
Protocol extensions
Do I need to use protocols?
Swift's standard library
Summary
Chapter 7: Protocol-Oriented Design
Requirements
Object-oriented design
Structures versus classes
The array structure
Summary
Chapter 8: Writing Safer Code with Availability and Error Handling
Native error handling
The availability attribute
Summary
Chapter 9: Custom Subscripting
Introducing subscripts
Subscripts with Swift arrays
Creating and using custom subscripts
Read-only custom subscripts
Calculated subscripts
Subscript values
External names for subscripts
Multidimensional subscripts
When not to use a custom subscript
Summary
Chapter 10: Using Optional Types
Introducing optionals
The need for optional types in Swift
Optional chaining
Summary
Chapter 11: Working with Generics
An introduction to generics
Generic functions
Generic types
Generic subscripts
Associated types
Summary
Chapter 12: Working with Closures
An introduction to closures
Simple closures
Shorthand syntax for closures
Using closures with Swift's array algorithms
Standalone closures and good style guidelines
Changing functionality
Selecting a closure based on results
Creating strong reference cycles with closures
Summary
Chapter 13: Using Mix and Match
What is mix and match?
When to use mix and match
Using Swift and Objective-C together in the same project
Summary
Chapter 14: Concurrency and Parallelism in Swift
Concurrency and parallelism
Summary
Chapter 15: Swift Formatting and Style Guide
What is a programming style guide?
Your style guide
Summary
Chapter 16: Swift Core Libraries
Apple's URL loading system
Formatter
Encoding and Decoding JSON Data
Summary
Chapter 17: Adopting Design Patterns in Swift
What are design patterns?
Creational patterns
Structural design patterns
Behavioral design patterns
Summary

What You Will Learn

  • Delve into the core components of Swift 4.0, including operators, collections, control flows, and functions
  • Create and use classes, structures, and enumerations
  • Understand protocol-oriented design and see how it can help you write better code
  • Develop a practical understanding of subscripts and extensions
  • Add concurrency to your applications using Grand Central Dispatch and Operation Queues
  • Implement generics and closures to write very flexible and reusable code
  • Make use of Swift’s error handling and availability features to write safer code

Authors

Table of Contents

Chapter 1: Taking the First Steps with Swift
What is Swift?
Playgrounds
Hello World
Summary
Chapter 2: Learning about Variables, Constants, Strings, and Operators
Constants and variables
Operators
Summary
Chapter 3: Using Swift Collections and the Tuple Type
Swift collection types
Mutability
Arrays
Dictionaries
Set
Tuples
Summary
Chapter 4: Control Flow and Functions
What have we learned so far?
Control flow
Functions
Putting it all together
Summary
Chapter 5: Classes and Structures
What are classes and structures?
Creating a class or structure
Custom initializers
Access controls
Inheritance
Overriding methods and properties
Protocols
Protocol syntax
Extensions
Memory management
Summary
Chapter 6: Using Protocols and Protocol Extensions
Protocols as types
Polymorphism with protocols
Type casting with protocols
Protocol extensions
Do I need to use protocols?
Swift's standard library
Summary
Chapter 7: Protocol-Oriented Design
Requirements
Object-oriented design
Structures versus classes
The array structure
Summary
Chapter 8: Writing Safer Code with Availability and Error Handling
Native error handling
The availability attribute
Summary
Chapter 9: Custom Subscripting
Introducing subscripts
Subscripts with Swift arrays
Creating and using custom subscripts
Read-only custom subscripts
Calculated subscripts
Subscript values
External names for subscripts
Multidimensional subscripts
When not to use a custom subscript
Summary
Chapter 10: Using Optional Types
Introducing optionals
The need for optional types in Swift
Optional chaining
Summary
Chapter 11: Working with Generics
An introduction to generics
Generic functions
Generic types
Generic subscripts
Associated types
Summary
Chapter 12: Working with Closures
An introduction to closures
Simple closures
Shorthand syntax for closures
Using closures with Swift's array algorithms
Standalone closures and good style guidelines
Changing functionality
Selecting a closure based on results
Creating strong reference cycles with closures
Summary
Chapter 13: Using Mix and Match
What is mix and match?
When to use mix and match
Using Swift and Objective-C together in the same project
Summary
Chapter 14: Concurrency and Parallelism in Swift
Concurrency and parallelism
Summary
Chapter 15: Swift Formatting and Style Guide
What is a programming style guide?
Your style guide
Summary
Chapter 16: Swift Core Libraries
Apple's URL loading system
Formatter
Encoding and Decoding JSON Data
Summary
Chapter 17: Adopting Design Patterns in Swift
What are design patterns?
Creational patterns
Structural design patterns
Behavioral design patterns
Summary

Book Details

ISBN 139781788477802
Paperback392 pages
Read More
From 2 reviews

Read More Reviews

Recommended for You

Understanding Software Book Cover
Understanding Software
$ 23.99
$ 10.00
WebGL Beginner's Guide Book Cover
WebGL Beginner's Guide
$ 26.99
$ 10.00
Mastering Unity 2017 Game Development with C# - Second Edition Book Cover
Mastering Unity 2017 Game Development with C# - Second Edition
$ 39.99
$ 10.00
Core Data iOS Essentials Book Cover
Core Data iOS Essentials
$ 26.99
$ 10.00
Mastering vRealize Operations Manager - Second Edition Book Cover
Mastering vRealize Operations Manager - Second Edition
$ 39.99
$ 10.00
Mastering ROS for Robotics Programming - Second Edition Book Cover
Mastering ROS for Robotics Programming - Second Edition
$ 39.99
$ 10.00