Mastering Swift: A Beginner's Guide

This document was uploaded by one of our users. The uploader already confirmed that they had the permission to publish it. If you are author/publisher or own the copyright of this documents, please report to us by using this DMCA report form.

Simply click on the Download Book button.

Yes, Book downloads on Ebookily are 100% Free.

Sometimes the book is free on Amazon As well, so go ahead and hit "Search on Amazon"

If you want to become an iOS developer, you have made an excellent choice with this book. Swift holds a significant position in the iOS industry because of the long list of features it serves. It is user-friendly, has great community support, and offers a greater extent of customization. As a result, we can observe a sharp increase in the market demand for developing Apple mobile applications, and with that, companies search for smart developers with the right skill set.

Mastering Swift introduces Apple’s excellent Swift standard library style and incorporates usage feedback across multiple Swift projects. However, it should be regarded as a living, changeable document and the basis upon which the programming language is implemented.

Before going further into the details of the Swift programming language, the book briefly explains the basic information about the language. It is a high-level language created to develop multifaceted iOS applications that cater diverse needs of different social and business domains. It is meant to develop high-end apps with multiple complexities. But since it is very close to Objective C, it is easy to code and understand. This feature makes it incredibly friendly to beginners as well. Moreover, it is equally compatible with iPhones, iPad, Apple Watch, MacBook, Apple Tv and can be applied to develop equally efficient and scalable apps for them.

Mastering Series encircles all the essential aspects of Swift and explores why this programming language is the future for iOS app development. Different from other languages, it requires fewer lines to activate any feature. This paves the way for a shorter development cycle and saves a lot of precious resources. Further, as one of the most reliable iOS programming language it supports dynamic libraries that indicate executable bits of code that you can link to an application. Because of such support, Swift apps can interoperate with the newest version of the language to make the app irreplaceable.

Swift is a language that was not designed but deliberately made open source in order to invite the community, let the product grow and mature over the years. This could possibly be the most crucial aspect of Swift. As people become more aware of its potential to be used in the server, web frameworks were more willing to support the demand. Owing to its popularity and significance, its adoption rate in Apple’s rival remains very high. Whether you are a beginner or an advanced learner, if you are planning for iOS app development through Swift, this book can help with the high-domain expertise and experienced resources.

Without a doubt, the developers that create native apps are not going to abandon Swift anytime soon. However, it sure seems like something has to evolve for it to keep growing constantly. We believe that now you must be convinced that Swift is indeed the future for iOS app developers. And if you are convinced and want to start learning the programming language right away, then this book is what you’re looking for.

Learn more about other Mastering titles here..........

Author(s): Sufyan bin Uzayr
Series: Mastering Computer Science
Publisher: CRC Press
Year: 2022

Language: English
Pages: 216
City: Boca Raton

Cover
Half Title
Series Page
Title Page
Copyright Page
Contents
About the Editor
CHAPTER 1: Introduction to Swift Programming Language
WHAT IS SWIFT
A Brief History of Swift
Swift Tools
Swift as the First Programming Language
Closure Support
String Support
Access Control
Options and Chaining
Value Types
Protocol-Oriented Programming
Libraries, Runtime, and Development
Memory Management
Debugging and Other Elements
Performance
TECHNICAL REQUIREMENTS
INSTALLATION OF SWIFT
CHAPTER 2: Getting Started with Swift
BASIC SWIFT LANGUAGE SYNTAX
Different Elements of the Playground
Swift Playground Automatic or Manual Execution
Import in Swift
Tokens in Swift
Comments
Semicolons
Identifiers
Keywords
Whitespaces
Literals
USING STRINGS, INTS, FLOATS, AND BOOLS
Bound Values
Type Aliases
Type Safety
Type Inference
Creating a String
Empty String
String Constants
String Interpolation
String Concatenation
String Comparison
String Iterating
String Functions and Operators
Empty Character Variables
Accessing Characters from Strings
Concatenating Strings with Characters
BUILDING AND RUNNING PROGRAMS ON C++
Preprocessing
Compiling
Linking
USING THE REPL
Multiline History
Multiline Editing
Quick Reference
CHAPTER 3: Swift Basic Syntax
VARIABLES AND CONSTANTS
Declaring Constants and Variables
Type Annotations
Naming Constants and Variables
Printing Constants and Variables
CONDITIONS AND LOOPS
For-In Loops
While Loops
Loop Control Statements
Conditional Statements
If
Switch
Control Transfer Statements
Continue
Break
Fallthrough
Labeled Statements
Early Exit
Checking API Availability
FUNCTIONS
Defining and Calling Functions
Function Parameters and Return Values
Functions without Parameters
Functions with Multiple Parameters
Functions without Return Values
Functions with Multiple Return Values
Optional Tuple Return Types
Functions with an Implicit Return
Function Argument Labels and Parameter Names
Variadic Parameters
In-Out Parameters
Nested Functions
OBJECTS AND CLASSES
Comparing Structures and Classes
Structure and Class Instances
Memberwise Initializers for Structure Types
Identity Operators
Pointers
ENUMERATIONS
Iterating over Enumeration Cases
Associated Values
Raw Values
Implicitly Assigned Raw Values
Recursive Enumerations
CHAPTER 4: Swift Standard Library
ARRAY
Order
Random Access
Dictionary
Set
COMPARING DATES WITH FOUNDATION
libdispatch
XCTest
Foundation
Creating a DateInterval Instance
init(start:duration:)
init(start:end:)
init()
Properties
Operations
FETCHING DATA WITH URLSESSION
Setting Up the HTTP Request with URLSession
Making the Request with URLSessionDataTask
Printing the Returned Response Data
Validating the Response Data
Converting the Response Data to JSON
Making POST Requests with URLSession
Setting Up the HTTP POST Request with URLSession
Setting Up the Request Headers and Body
Making the Request with URLSessionUploadTask
Printing the Returned Response Data
WORKING WITH JSON
Creating a Model
Nested JSON Objects
Decodable and Encodable Protocols
Coding Keys
JSONDecoder and JSONEncoder
JSONDecoder
JSONEncoder
Date Formats
WORKING WITH XML
CHAPTER 5: Creating iOS Apps with Swift
CORE COMPONENTS OF XCODE
Creating an Xcode Project for an App
Managing Files in the Main Window
BUILDING AN IOS APP WITH COCOA TOUCH
UIKit Overview
The Foundation Overview
Creating Frameworks
Timer
Rounded Corners
Animation
UNIT AND INTEGRATION TESTING XCTEST
Pros and Cons of XCTest Framework
Writing a Unit Test
Writing an Integration Test
Writing a UI Test
Writing a Performance Test
CHAPTER 6: Building Blocks of SwiftUI
SWIFTUI IMPROVEMENTS ON MACOS
Always-On Retina Display Support
Widgets for iPadOS
Declarative Syntax
DESIGN TOOLS
CONTROLS, VIEWS, AND LISTS
Configuring a View with a Modifier
Chain Modifiers to Achieve Complex Effects
Configuring Child Views
Using View-Specific Modifiers
List View
EXPLORING TEXT AND DECORATION
Localizing Strings
CREATING CUSTOM VIEWS AND LISTS
Conforming to the View Protocol
Declaring a Body
Assembling the View’s Content
Configuring Views with Modifiers
Managing Data
Adding Your View to the View Hierarchy
Creating and Modifying List View
Supporting Selection in Lists
Refreshing the List Content
Supporting Multidimensional Lists
Creating Hierarchical Lists
Styling Lists
DECLARATIVE SYNTAX
CHAPTER 7: Machine Learning on Swift
CORE ML
Creating ML Framework
MACHINE LEARNING APIs
Natural Language
Creating a Text Classifier Model
Speech
Recognizing Speech in Live Audio
Sound Analysis
Classifying Sounds in an Audio File
VISION
Tracking the User’s Face in Real-Time
DETECTING OBJECTS BY CORE ML AND VISION
APPRAISAL
INDEX