Beginning Swift Master the Fundamentals of Programming in Swift 4
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 a...
Uložené v:
| Hlavní autori: | , |
|---|---|
| Médium: | E-kniha |
| Jazyk: | English |
| Vydavateľské údaje: |
Birmingham
Packt Publishing, Limited
2018
Packt Publishing Limited Packt Publishing |
| Vydanie: | 1 |
| Predmet: | |
| ISBN: | 1789534313, 9781789534313 |
| On-line prístup: | Získať plný text |
| Tagy: |
Pridať tag
Žiadne tagy, Buďte prvý, kto otaguje tento záznam!
|
Obsah:
- Activity: Counting Words, Sentences, and Paragraphs -- Substring -- Creating Substrings -- Parsing Strings -- Converting NSRange to Range -- Activity: CamelCase -- Summary -- Functional Programming and Lazy Operations -- Function Type -- Functional Methods -- filter -- Using the filter Method -- map -- Using the map Method -- flatMap -- Using the flatMap Method -- reduce -- Using the reduce Function -- Activity: Using Functional Programming -- Lazy Operations -- Lazy Sequences -- Sequence Internals -- Creating Lazy Operations -- sequence(first:next:) -- sequence(state:next:) -- Activity: Implementing a Lazy Version of a Method -- Swifty Code -- Naming -- Organizing Code -- Miscellaneous -- Writing Swifty Code -- Summary -- Further Study -- Challenge -- Index
- Intro -- Preface -- Swift Basics -- Swift Program Structure -- Hello, World! -- Swift Variables and Constants -- Declaring Swift Variables -- Variables Versus Constants -- Type Inference -- Variable Naming -- Working with Variables -- Tuples -- Creating a Tuple -- Optionals -- Declaring an Optional -- Working with Optionals -- Optional nil Values -- Accessing Optional Values -- Force Unwrapping an Optional -- Conditionally Unwrapping Optionals -- The Swift guard Statement -- Activity: Variable Summary -- Swift Data Types -- Numeric Data Types -- Int on 64-Bit Versus 32-Bit Platforms -- Built-In Numeric Data Types -- Choosing the Appropriate Numeric Data Type -- Declaring and Assigning Integer Variables -- Declaring and Assigning Floating Point Numbers -- Numeric Literal Grouping -- Numeric Type Conversions -- 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 -- Activity: Using Swift Enums -- Summary -- Swift Operators and Control Flow -- Swift Operators -- Assignment Operator -- Arithmetic Operators -- Standard Arithmetic Operators -- Remainder Operator -- 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 -- 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 -- Iterating over Objects -- 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 -- Activity: Implementing Loops -- Summary -- Functions, Classes, and Structs -- Functions -- Defining a Function -- Argument Labels -- Excluding Argument Labels -- Parameter Default Values -- Activity: Implementing a Function -- Returning Values from Functions -- Using @discardableResult -- 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 -- Activity: Exception Handling -- Object-Oriented Features -- Object-Oriented Principles -- Classes Versus Structs -- Defining Classes and Structures -- Activity: Creating a Customer Struct and Class -- Summary -- Challenge -- Collections -- Arrays -- Working with Arrays -- Index -- Common Operations with Index -- ArraySlice -- Creating Slices -- Activity: Working with Arrays -- Sets -- Working with Sets -- Combining Sets -- Comparing Sets -- Activity: Removing Duplicates from a Sequence -- Dictionaries -- Working with Dictionaries -- Activity: Using Dictionaries -- Summary -- Strings -- String Fundamentals -- Character -- Collection -- Index -- Working with String Index -- Debugging -- Activity: All Indices of a Character -- Using Strings -- Creating Strings -- Common Operations -- Activity: All Ranges of a Substring
- Beginning Swift: Master the fundamentals of programming in Swift 4

