万本电子书0元读

万本电子书0元读

顶部广告

Swift High Performance电子书

售       价:¥

1人正在读 | 0人评论 9.8

作       者:Kostiantyn Koval

出  版  社:Packt Publishing

出版时间:2015-11-01

字       数:153.3万

所属分类: 进口书 > 外文原版书 > 其他

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

为你推荐

  • 读书简介
  • 目录
  • 累计评论(0条)
  • 读书简介
  • 目录
  • 累计评论(0条)
Leverage Swift and enhance your code to take your applications to the next levelAbout This BookBuild solid, high performance applications in SwiftIncrease your efficiency by getting to grips with concurrency and parallel programmingUse Swift to design performance-oriented solutionsWho This Book Is ForThis book is aimed at experienced Swift developers wanting to optimize their programs on Apple platforms to optimize application performance.What You Will LearnBuild solid, stable, and reliable applications using SwiftUse REPL and Pl to manage and configure relational databasesExplore Swift's features including its static type system, value objects, and functional programming Design reusable code for high performance in SwiftUse to Xcode LLBD and REPL to debug commandsAvoid sharing resources by using concurrency and parallel programmingUnderstand the lazy loading pattern, lazy sequences, and lazy evolution.In DetailSwift is one of the most popular and powerful programming languages for building iOS and Mac OS applications, and continues to evolve with new features and capabilities. Swift is considered a replacement to Objective-C and has performance advantages over Objective-C and Python. Swift adopts safe programming patterns and adds modern features to make programming easier, more flexible, and more fun.Develop Swift and discover best practices that allow you to build solid applications and optimize their performance.First, a few of performance characteristics of Swift will be explained. You will implement new tools available in Swift, including Playgrounds and REPL. These will improve your code efficiency, enable you to analyse Swift code, and enhance performance. Next, the importance of building solid applications using multithreading concurrency and multi-core device architecture is covered, before moving on to best practices and techniques that you should utilize when building high performance applications, such as concurrency and lazy-loading. Finally, you will explore the underlying structure of Swift further, and learn how to disassemble and compile Swift code.Style and approachThis is a comprehensive guide to enhancing Swift programming techniques and methodology to enable faster application development.
目录展开

Swift High Performance

Table of Contents

Swift High Performance

Credits

About the Author

About the Reviewers

www.PacktPub.com

Support files, eBooks, discount offers, and more

Why subscribe?

Free access for Packt account holders

Preface

What this book covers

What you need for this book

Who this book is for

Conventions

Reader feedback

Customer support

Downloading the example code

Errata

Piracy

Questions

1. Exploring Swift's Power and Performance

Swift speed

Welcome to Swift

Why should I learn Swift?

Swift's features and benefits

Clean and beautiful

No semicolons

Type inference

Other clean code Swift features

A clean code summary

Safe

Optionals

Error handling

Rich type system

Powerful value types

A multiparadigm language

Object oriented

Protocol oriented

Functional

Generic purpose

Fast

Swift interoperability

Using Objective-C in Swift

Setup

The application target

The framework target

Calling Objective-C code

Using Swift in Objective-C

Features of Swift that are not available in Objective-C

Performance – meaning and key metrics

Everyday code performance

The importance of performance

The key metrics

Summary

2. Making a Good Application Architecture in Swift

Making a Swift application

The differences between variables and constants

Immutability

Multithreading

Value types and immutability

Reference types

Value types

The power of structures

Representing the state with classes

Representing the absence of values with optionals

Optional and non-optional types

Safe nil handling

Using optionals

Wrapping up on optionals

Functional programming

Function types

Splitting the code

The closure expression

Type inference

Implicit return type

Shorthand argument names

Trailing closure syntax

The standard library

The map method

map for optionals

The reduce method

The filter method

Generics

Generic functions

Type constraints

The generic type and collections

Safety

Dangerous operations

Summary

3. Testing and Identifying Slow Code with the Swift Toolkit

REPL

Playgrounds

Interactive documentation

The folder structure

The source folder

Resources

Pages

XCPlayground

LLDB

REPL in Xcode

Console logs

Performance measuring in unit tests

Instruments

A reminder

Summary

4. Improving Code Performance

Understanding performance optimization

Explicit

Implicit

Optimization checklist

Swift code compilation

Constants and variables

Method calls

Functions and methods

Global functions

Type methods

Static methods

Instance methods

Comparing function speed

Functions and methods usage summary

Intelligent code

Dangerous functions

Console print

Removing print logs

Comment out

Using build configurations

Using nonoptimizable constants

Improving speed

Final

Inline functions

Value objects and reference objects

Memory allocation

Swift arrays and unsafe C arrays

Function parameters

Creating a pointer to an existing variable

Allocating memory for the pointer

Comparing Swift arrays with unsafe C arrays

A summary of working with pointers

Avoiding Objective-C

Avoiding exposing Swift to Objective-C

Dynamic

A summary of avoiding Objective-C

Summary

5. Choosing the Correct Data Structure

An overview of data structures

Collection types

Swift standard library collections

Arrays

Using arrays

Fast operations

Slower operations

Search

Sort

Sets

Using sets

Set operations

Dictionaries

Collection memory allocation

Empty

Reserve capacity

Default values

The CollectionType protocol methods

Protocol extensions

Accelerate and Surge

Other collections

Summary

6. Architecting Applications for High Performance

Achieving high performance

Device architecture

Concurrency overview

Threads

Thread complexity

Solution for threads

GCD

Queues

Main queues

Concurrent queues

Own queues

Tasks

Adding tasks to the queue

Synchronous dispatch

Asynchronous dispatch

Operation queues

Designing asynchronous code

Avoiding state

Capture list

Immutable state

Divide and conquer

Controlling the lifetime

Applying the @autoclosure and @noescape attributes

@autoclosure

@noescape

@autoclosure (escaping)

Summary

7. The Importance of Being Lazy

The lazy mindset

Separation

Do work on demand

Approximate results

Lazy loading

Global constants and variables

Type properties

Lazy properties

Computed properties

Lazy collections and evaluation

Sequences and collections

Sequences

Collections

Implementing our own sequence and collection

Using lazy

Using the lazy sequence

Using a lazy collection

Summary

8. Discovering All the Underlying Swift Power

How Swift is so fast

Swift command line tools

xcrun

The Swift compiler

swift

swiftc

The Swift compilation process and swiftc

Swift AST

SIL

LLVM IR

Other swiftc options

Analyzing executable files

Summary

Final thoughts

Index

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

发表评论

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

买过这本书的人还买过

读了这本书的人还在读

回顶部