万本电子书0元读

万本电子书0元读

顶部广告

Beginning Swift电子书

售       价:¥

0人正在读 | 0人评论 9.8

作       者:Rob Kerr,Kåre Morstøl

出  版  社:Packt Publishing

出版时间:2018-05-31

字       数:247.7万

所属分类: 进口书 > 外文原版书 > 电脑/网络

温馨提示:数字商品不支持退换货,不提供源文件,不支持导出打印

为你推荐

  • 读书简介
  • 目录
  • 累计评论(0条)
  • 读书简介
  • 目录
  • 累计评论(0条)
Master the fundamentals of programming in Swift 4 About This Book ? Covers theory and practice in equal parts ? Teaches you how to correctly structure and architect software using Swift ? Uses real-world examples to connect the theory to a professional setting ? Imparts expertise in the core Swift standard library Who This Book Is For If you are seeking fundamental Swift programming skills, in preparation for learning to develop native applications for iOS or macOS, this book is the best for you. You don’t need to have any prior Swift knowledge; however, object-oriented programming experience is desired. What You Will Learn ? Explore the fundamental Swift programming concepts, language structure, and the Swift programming syntax ? Learn how Swift compares to other computer languages and how to transform your thinking to leverage new concepts such as optionals and protocols ? Master how to use key language elements, such as strings and collections ? Grasp how Swift supports modern application development using advanced features, such as built-in Unicode support and higher-order functions. In Detail Take your first foray into programming for Apple devices with Swift. Swift is fundamentally different from Objective-C, as it is a protocol-oriented language. While you can still write normal object-oriented code in Swift, it requires a new way of thinking to take advantage of its powerful features and a solid understanding of the basics to become productive. This course helps you develop client-side and server-side applications, as well as web services using Swift. We'll begin with exploring the fundamental Swift programming concepts, language structure, and the Swift programming syntax. Then, we'll learn to create original custom operators with Swift operators, branching, and loops. Moving on, we'll learn how to run application codes and compile errors. Having made progress with it, we'll see how Swift compares to other computer languages and how to transform your thinking. Then, master the usage of key language elements, such as strings and collections. Finally, grasp how Swift supports modern application development using advanced features, such as built-in Unicode support and higher-order functions. This is an introductory course to the Swift programming language with Xcode.After completing this course, students will be well-prepared to begin developing native end-user applications for iOS or macOS, or to develop server-side (back-end) application and web services using Swift on Linux. Style and approach This is an introductory course to the Swift programming language with Xcode. The course does not expect you to have any previous Swift knowledge or experience. The course covers ample amount of exercises so that students learn the basics hands-on.
目录展开

Beginning Swift

Why Subscribe?

PacktPub.com

Contributors

About the Authors

Packt is Searching for Authors Like You

Preface

What This Book Covers

What You Need for This Book

Who This Book is for

Conventions

Note

Tip

Reader Feedback

Customer Support

Downloading the Example Code

Errata

Piracy

Questions

Chapter 1. Swift Basics

Lesson objectives

Swift Program Structure

Hello, World!

Note

Swift Variables and Constants

Declaring Swift Variables

Note

Variables Versus Constants

Note

Type Inference

Variable Naming

Note

Working with Variables

Tuples

Note

Creating a Tuple

Optionals

Note

Declaring an Optional

Note

Working with Optionals

Optional nil Values

Accessing Optional Values

Force Unwrapping an Optional

Note

Conditionally Unwrapping Optionals

Using Optionals

The Swift guard Statement

Activity: Variable Summary

Swift Data Types

Note

Numeric Data Types

Int on 64-Bit Versus 32-Bit Platforms

Built-In Numeric Data Types

Choosing the Appropriate Numeric Data Type

Note

Declaring and Assigning Integer Variables

Declaring and Assigning Floating Point Numbers

Numeric Literal Grouping

Numeric Type Conversions

Note

Using Numeric Types

Boolean

Character

Assigning a Character

Constructing a Character Literal

String

Instantiating a String

String Concatenation

Extracting Characters

String Length

Activity: Data Type Summary

Enums

Basic Enum Syntax

Enum with Raw Values

Note

Activity: Using Swift Enums

Summary

Chapter 2. Swift Operators and Control Flow

Lesson objectives

Swift Operators

Assignment Operator

Arithmetic Operators

Standard Arithmetic Operators

Remainder Operator

Note

Unary minus Operator

Compound Assignment Operators

Comparison Operators

Equality

Inequality

Comparison between Two Values

Ternary Conditional Operator

Logical Operators

Bitwise Operators

Nil-Coalescing Operator

Range Operators

Closed Range Operator

Half-Open Range Operator

One-Sided Range Operator

Activity: Operators

Branching

The if Statement

Condition Lists

Note

Optional Unwrapping with if

The switch Statement

switch Statement Rules

The break Keyword

The fallthrough Keyword

Matching Non-Scalar Values

Multiple Patterns in a Single Case

Using the where Statement within case

Evaluating Optionals with a switch Statement

Activity: Converting Code from if to switch

Loops

The for…in Statement

Note

Iterating over Objects

Note

Iterating over Array Objects with index

The for Loop where Clause

The break Control Transfer Statement

The continue Control Transfer Statement

The while Loop

The repeat…while Loop

Note

Activity: Implementing Loops

Summary

Chapter 3. Functions, Classes, and Structs

Lesson Objectives

Functions

Defining a Function

Argument Labels

Excluding Argument Labels

Note

Parameter Default Values

Activity: Implementing a Function

Returning Values from Functions

Using @discardableResult

Note

Function Attributes

Variadic Parameters

inout Parameters

Recursion

Functions as Parameters

Closures

Creating a Function to Receive Content from an Asynchronous Web Service Call

Error Handling

The do…catch Statement

Multiple catch Blocks

Using do without catch

The guard Statement

Note

Activity: Exception Handling

Object-Oriented Features

Object-Oriented Principles

Classes Versus Structs

Illustration

Defining Classes and Structures

Activity: Creating a Customer Struct and Class

Summary

Challenge

Chapter 4. Collections

Lesson Objectives

Arrays

Working with Arrays

Index

Common Operations with Index

Note

ArraySlice

Creating Slices

Activity: Working with Arrays

Sets

Note

Working with Sets

Combining Sets

Comparing Sets

Activity: Removing Duplicates from a Sequence

Dictionaries

Working with Dictionaries

Activity: Using Dictionaries

Summary

Chapter 5. Strings

Lesson Objectives

String Fundamentals

Character

Note

Note

Collection

Note

Index

Working with String Index

Debugging

Activity: All Indices of a Character

Using Strings

Creating Strings

Common Operations

Activity: All Ranges of a Substring

Activity: Counting Words, Sentences, and Paragraphs

Substring

Creating Substrings

Parsing Strings

Converting NSRange to Range

Activity: CamelCase

Summary

Chapter 6. Functional Programming and Lazy Operations

Lesson Objectives

Function Type

Note

Functional Methods

Note

Note

filter

Using the filter Method

map

Using the map Method

flatMap

Using the flatMap Method

reduce

Using the reduce Function

Activity: Using Functional Programming

Note

Lazy Operations

Lazy Sequences

Note

Note

Sequence Internals

Note

Creating Lazy Operations

Note

sequence(first:next:)

sequence(state:next:)

Note

Activity: Implementing a Lazy Version of a Method

Note

Swifty Code

Naming

Organizing Code

Miscellaneous

Writing Swifty Code

Summary

Further Study

Challenge

Index

A

B

C

D

E

F

G

H

I

L

M

N

O

R

S

T

U

V

W

累计评论(0条) 0个书友正在讨论这本书 发表评论

发表评论

发表评论,分享你的想法吧!

买过这本书的人还买过

读了这本书的人还在读

回顶部