Learning Swift
Autor principal: | |
---|---|
Formato: | Libro electrónico |
Idioma: | Inglés |
Publicado: |
[S.l.] :
Packt Publishing
2016.
|
Edición: | 2nd ed |
Colección: | EBSCO Academic eBook Collection Complete.
|
Acceso en línea: | Conectar con la versión electrónica |
Ver en Universidad de Navarra: | https://innopac.unav.es/record=b38215779*spi |
Tabla de Contenidos:
- Cover
- Copyright
- Credits
- About the Author
- About the Reviewer
- www.PacktPub.com
- Table of Contents
- Preface
- Chapter 1: Introducing Swift
- Defining our goals for this book
- Setting up the development environment
- Running our first swift code
- Understanding playgrounds
- Learning with this book
- Summary
- Chapter 2: Building Blocks
- Variables, Collections, and Flow Control
- Core Swift types
- Constants and variables
- Containers
- Tuples
- Arrays
- Dictionaries
- Swift's type system
- Printing to the console
- Control flow
- Conditionals
- Switches
- Loops
- Functions
- Basic functions
- Parameterized functions
- Functions that return values
- Functions with default arguments
- Guard statement
- Bringing it all together
- Summary
- Chapter 3: One Piece at a Time
- Types, Scopes, and Projects
- Structs
- Types versus instances
- Properties
- Member and static methods
- Computed properties
- Reacting to property changes
- Subscripts
- Custom initialization
- Classes
- Inheriting from another class
- Initialization
- Overriding initializer
- Required initializer
- Designated and convenience initializers
- Overriding methods and computed properties
- Methods
- Computed properties
- Casting
- Upcasting
- Downcasting
- Enumerations
- Basic declaration
- Testing enumeration values
- Raw values
- Associated values
- Methods and properties
- Projects
- Setting up a command-line Xcode project
- Creating and using an external file
- Interfacing with code from other files
- File organization and navigation
- Extensions
- Scope
- How scope is defined
- Nested types
- Access control
- Summary
- Chapter 4: To Be or Not to Be
- Optionals
- Defining an optional
- Unwrapping an optional
- Optional binding
- Forced unwrapping
- Nil coalescing
- Optional chaining.
- Implicitly unwrapped optionals
- Debugging optionals
- The underlying implementation
- Summary
- Chapter 5: A Modern Paradigm
- Closures and Functional Programming
- Functional programming philosophy
- State and side effects
- Declarative versus imperative code
- Closures
- Closures as variables
- Closures as parameters
- Syntactic sugar
- Building blocks of functional programming in Swift
- Filter
- Reduce
- Map
- Sort
- How these affect the state and nature of code
- Lazy evaluation
- Example
- Summary
- Chapter 6: Make Swift Work for You
- Protocols and Generics
- Protocols
- Defining a protocol
- Implementing a protocol
- Using type aliases
- Generics
- Generic function
- Generic type
- Type constraints
- Protocol constraints
- Where clauses for protocols
- Where clauses for equality
- Extending generics
- Adding methods to all forms of a generic
- Adding methods to only certain instances of a generic
- Extending protocols
- Putting protocols and generics to use
- Generators
- Sequences
- Product of Fibonacci numbers under 50
- Summary
- Chapter 7: Everything is Connected
- Memory Management
- Computer data storage
- File system
- Memory
- Value types versus reference types
- Determining value type or reference type
- Behavior on assignment
- Behavior on input
- Closure capture behavior
- Automatic reference counting
- Object relationships
- Strong
- Weak
- Unowned
- Strong reference cycles
- Between objects
- Spotting
- Fixing
- With closures
- Spotting
- Fixing
- Lost objects
- Between objects
- With closures
- Structures versus classes
- Summary
- Chapter 8: Paths Less Travelled
- Error Handling
- Throwing errors
- Defining an error type
- Defining a function that throws an error
- Implementing a function that throws an error
- Handling errors
- Forceful try.
- Optional try
- Catching an error
- Propagating errors
- Cleaning up in error situations
- Order of execution when errors occur
- Deferring execution
- Summary
- Chapter 9: Writing Code the Swift Way
- Design Patterns and Techniques
- What is a design pattern?
- Behavioral patterns
- Iterator
- Observer
- Callback
- Notification center
- Structural patterns
- Composite
- Hierarchies
- Alternative to subclassing
- Delegate
- Model view controller
- Creational patterns
- Singleton/shared instance
- Abstract factory
- Using associated values effectively
- Replacing class hierarchies
- Concisely representing state
- Extending system types to reduce code
- Lazy properties
- Avoiding unnecessary memory usage
- Avoiding unnecessary processing
- Localizing logic to the concerned property
- Summary
- Chapter 10: Harnessing the Past
- Understanding and Translating Objective-C
- Swift's relationship to Objective-C
- Background of Objective-C
- Constants and variables
- Value types
- Reference types
- Containers
- Arrays
- Dictionaries
- Control flow
- Conditionals
- Switches
- Loops
- Functions
- Types
- Structures
- Enumerations
- Classes
- Basic class
- Initializers
- Properties
- Methods
- Inheritance
- Categories
- Protocols
- Blocks
- Projects
- Header files
- Implementation files
- Organization
- Calling Objective-C code from Swift
- Bridging header
- Using functions
- Using types
- Containers
- Annotations
- Nullability
- Container element types
- Summary
- Chapter 11: A Whole New World
- Developing an App
- Conceptualizing the app
- Features
- Interface
- Data
- Setting up the app project
- Configuring the user interface
- Running the app
- Allowing picture taking
- Temporarily saving a photo
- Populating our photo grid
- Refactoring to respect model-view-controller.
- Permanently saving a photo
- Summary
- Chapter 12: What's Next?
- Resources, Advice, and the Next Steps
- Apple's documentation
- Forums and blogs
- Blog posts
- Forums
- Prominent figures
- Podcasts
- Summary
- Index.