My new book, Mastering Swift 3 for Linux has just been released. While most books on Swift are written to introduce the language using Apple’s development tools, this book is written for the developer that wants to use Swift on the Linux platform.
I have always thought that a developer cannot master a programming language without a good understanding of the basics. With that philosophy in mind this book starts with the basics of the Swift language before moving into more advance features and concepts. The first five chapters will introduce the Swift programming language and will give the reader a good understanding of the Swift programming language. The second half of the book will cover more advance topics such as concurrency, network development, using C libraries with Swift and memory management including strong reference cycles.
This book also has a chapter dedicated to using Swift on Single-Board Computers. The first half of this chapter will show the reader how they can use Swift to interact with external devices like LEDs, buttons and temperature sensors. The second half of the chapters shows the reader how they can build and program an autonomous robot using Swift and the BeagleBone Black.
Here is a description of what is covered in each chapter of the book:
Chapter 1, Taking the First Steps with Swift, gives a brief introduction to the Swift language. It also covers the basic Swift language syntax and discuss proper language styles.
Chapter 2, Learning About Variables, Constants, Strings, and Operators, will show how to use variables and constants in Swift. It will also discuss the various data types and how to use operators in Swift.
Chapter 3, Using Swift Collections and the Tuple Type, will look at how we can use the Swift collection types to store related data. These collection types are the array, set and dictionay types.
Chapter 4, Control Flow and Functions, will cover control flow and functions in Swift. It is essential to understand the concepts in this chapter before going on. Every application that we write, beyond the simple Hello World applications, will rely very heavily on the control flow statements and functions.
Chapter 5, Classes and Structures, will look at what makes Class and Structures similar and what makes them different. We'll also look at access controls and object-oriented design. The chapter also covers memory management in Swift.
Chapter 6, Using Protocols and Protocol Extensions, will cover both protocols and protocol extensions in detail since protocols are very important to the Swift language, and having a solid understanding of them will help us write flexible and reusable code.
Chapter 7, Protocol-Oriented Design, will cover the best practices of Protocol-Oriented Design with Swift. It will be a brief overview of what is covered in my Swift 3 Protocol-Oriented Programming (POP) book.
Chapter 8, Writing Safer Code with Error Handling, will look at Swift’s error- handling features. While we are not required to use this feature in our custom types, it does give us a uniform manner to handle and respond to the error.
Chapter 9, Custom Subscripting, will discuss how we can use custom subscripts in our classes, structures, and enumerations. Subscripts in Swift can be used to access elements in a collection. We can also define custom subscripts for our classes, structures, and enumerations.
Chapter 10, Using Optional Types, will explain what optional types are and the various ways to unwrap them. For a developer who is just learning Swift, optional types can be one of the most confusing items to learn.
Chapter 11, Working with Generics, will explain how Swift implements generics. Generics allow us to write very flexible and reusable code that avoids duplication.
Chapter 12, Working with Closures, will teach us how to define and use closures in our code. Closures in Swift are similar to blocks in Objective-C except that they have a much cleaner and easier way of using syntax. This chapter concludes with a section on how to avoid strong reference cycles.
Chapter 13, Using C Libraries with Swift, will explain how we can link and use standard C libraries with our Swift applications. This gives Swift developers access to all the same libraries that Linux C developers have access too. Knowing how to use C libraries with Swift is essential for any developer that wants to develop Linux apps with Swift
Chapter 14, Concurrency and Parallelism in Swift, will show how to use Grand Central Dispatch to add concurrency and parallelism to our applications. Understanding and knowing how to add concurrency and parallelism to our apps can significantly enhance the user experience.
Chapter 15, Swift's Core Libraries, will be a chapter on using the Swift core libraries, including reading/writing files, network primitives, and JSON parsing.
Chapter 16, Swift on single-board computers, will show how we can use Swift for IoT and robotic projects using a single-board computer. This chapter will feature the BeagleBone Black and the Swifty Bones library.
Chapter 17, Swift Formatting and Style Guide, will define a style guide for the Swift language that can be used as a template for enterprise developers who need to create a style guide, since most enterprises have style guides for the various languages that they develop in.
Chapter 18, Adopting Design Patterns in Swift, will show you how to implement some of the more common design patterns in Swift. A design pattern identifies a common software development problem and provides a strategy for dealing with it.
This book is written in an example-based approach where each topic covered is backed by examples which are designed to reinforce the topic covered and show how to implement it within the reader's own code.
You can purchase the book from Amazon.