Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds
Application Development with Swift
Application Development with Swift

Application Development with Swift: Develop highly efficient and appealing iOS applications by using the Swift language

eBook
$26.99 $29.99
Paperback
$38.99
Subscription
Free Trial
Renews at $19.99p/m

What do you get with Print?

Product feature icon Instant access to your digital copy whilst your Print order is Shipped
Product feature icon Paperback book shipped to your preferred address
Product feature icon Redeem a companion digital copy on all Print orders
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
Modal Close icon
Payment Processing...
tick Completed

Shipping Address

Billing Address

Shipping Methods
Table of content icon View table of contents Preview book icon Preview Book

Application Development with Swift

Chapter 2. Advanced Swift

Now, you have got some experience in the Swift programming language and have seen how funny and easy to learn it is. In this chapter, we will take you to the next level in Swift. We will talk about more advanced topics in Swift. For sure, we can't cover all topics in Swift, but we selected the most important and commonly used ones.

Type casting and type checking

Type casting and checking are ways used in Swift to check the type of instances and cast them to any different type. In Swift, we use as and is to perform type casting and type checking. Before going deep into how to use these operators, let's build an array that we will use in next examples:

var subViews = [UILabel(), UIButton(), UILabel(), UITextField(), UITextView()]

We created an array of UI controls, but you might question, "how did you create array of objects of different types in Swift when you told us that Swift array is typed?" My answer is yes, you are right, but the Swift compiler is smart enough to check the items of the array; if they are different in type, it will search for the common superclass for them, which is UIView. So, this array is of type UIView.

Now, let's see how to check the type of items of this array. We will use the is operator followed by class name. Check the following code:

var labelsCount = 0
for view in subViews...

Using Any and AnyObject

According to our explanation in the previous section about type casting and type checking, Swift provides us with two general types to use if you don't want to specifically type the objects:

  • AnyObject: This type is used to represent instances of class types only and its equivalent to id in Objective-C
  • Any: This type is used to represent instances of any type like tuples, closures, and so on

These types are very useful, especially when you try to deal with Cocoa APIs, because, most of the time, you will receive an array of type AnyObject. As we know, Objective-C doesn't support a typed array. In these situations, you have to use the is, as, and as? operators of type casting and type checking to help you deal with Any and AnyObject types.

Let's see an example of using AnyObject:

var anyObjects = ["Str", 5, true, UILabel(), NSDateFormatter()]
anyObjects.append(11.5)
anyObjects.append([1, 2])

As we have seen in this strange array, it holds String,...

Protocols

Protocols are one of the most important and commonly used methodologies in programming in iOS and OS X. In protocols, you can define a set of methods and properties that will be implemented by classes that will conform to these protocols. In protocols, you just describe things without any implementations. In Swift, classes are not the only ones that can conform to protocols, but also structures and enumerations can conform to protocols as well.

To create a protocol, just use the protocol keyword and then its name:

protocol SampleProtocol
{
    
}

Then, when types are going to conform to this protocol, add a colon (:) after the name of type and list the protocols separated by commas (,). Check the following example:

class SampleClass: SampleProtocol, AnotherProtocol {
    
}

Now, let's talk about protocol properties and methods.

Properties

When you list properties between {} in protocol, you specify that these properties are required to exist in types that conform to this protocol...

Extensions

Extensions are used to add new functionality to an existing class, enumeration, or structure. They are like categories in Objective-C, but in Swift we have two differences:

  • Extensions can be used with classes, enumerations, and structures
  • Extensions don't have names

In Swift, extensions can do many things. Check this list:

  • Add computed properties and computed type properties
  • Add instance methods and class methods
  • Define subscripts
  • Add new initializers
  • Make the existing type conform to protocol

To create an extension, use this form:

extension someType{
    //New functionalities go here
}

In extensions, as we said, you can add new functionalities, but you can't override an existing one.

Adding computed properties

Extensions can add computer instance properties and computed type properties in any existing type. Check the following example:

extension Double{
    
    var km : Double{
        return self / 1000.0;
    }
    var cm : Double{
        return self * 100.0
    }
}

var distance...

Generics

The generic code is used to write usable and flexible functionalities that can deal with any type. This helps you avoid duplication and write code that is very clean and easy to edit and debug. Examples of using generics are when you use Array and Dictionary. You can create an array of Int or String or any type you want. That's because Array is generic and can deal with any type. Swift gives you the ability to write generic code very easily, as you will see in the following example. In the example, we will explain how to use Stack data structure. Stack is commonly used in algorithms and data structures. You can notice the use of stack in UINavigationController, as the view controllers are inserted in a stack, and you can easily push or pop view controllers.

Before implementing stack in a generic way, we will build it first for the Int type only, and then we will build it generically to see the difference. Check the following code:

class StackInt{
    var elements = [Int]()
...

Operator functions

Operator functions or operator overloading is a way to allow structures and classes to provide their own implementation of existing operators. Imagine that you have two points of type CGPoint and you want to get the sum of both points. The solution will be to create another point and set its x, y with sum of x's and y's of points. It's simple right? But what if we override the + operator that accepts the summation of two points. Still not clear? Check this example:

func +(lhs:CGPoint, rhs:CGPoint) -> CGPoint
{
    return CGPoint(x: lhs.x + rhs.x, y: lhs.y + rhs.y)
}

let p1 =  CGPoint(x: 1, y: 4)
let p2 =  CGPoint(x: 5, y: 2)

let p3 = p1 + p2 //{x 6 y 6}

In the example, we wrote the function and its name is just the + operator. It takes two parameters, lhs and rhs, which means the left-hand side and right-hand side of the equation is a summation. The function returns a point, which is the sum of the two points. Then, in the code, we wrote p1 + p2. This...

Memory management

Memory management is one of the most important topics that every developer should be aware of when making their app very responsive and efficient. Swift uses Automatic Reference Counting (ARC) to manage memory. In ARC, freeing up memory and managing it is done automatically when instances are no longer needed. Although ARC does most of the work in memory management, you have to care about the relations between classes to avoid memory leaks.

In memory, each object has a reference counting, and when it reaches zero, this object will be deallocated from the memory. In Swift, we have two types of references: strong and weak. The strong references retain the object and increment its reference counting by 1; the weak references don't increment the reference counting. In Swift, when you assign a class reference to a variable, constant, or a property, it makes a strong reference to it and it will remain in the memory as long as you use it. Take care while using relations between...

Using Objective-C and Swift in a single project

As an iOS developer, before Apple released Swift, you may feel worried about your old code in Objective-C and wonder if you can use them together. The answer is yes, you can use Swift and Objective-C together in a single project, and everything will be fine, irrespective of whether the project was originally in Swift or Objective-C. This compatibility is very important in making the language easy to use and has been welcomed by all developers. So, you can use Objective-C frameworks (system frameworks or your custom frameworks) in Swift, and you can use Swift API's in Objective-C code.

Importing Objective-C in the Swift project

To import some of your old Objective-C files in the Swift project, you will need a bridging header file to expose these files to Swift. Xcode offers to create the bridging header file for you once you add a Swift file in an Objective-C project or vice versa. Check the following image, where Xcode asks you to create...

Summary

In this chapter, we talked about some advanced features of Swift-like type casting and type checking. We talked about protocols and saw how Swift added some awesome new features to it than Objective-C. We also talked about extensions to add more usable and powerful functionality to any existing classes, structures, and enumerations. We introduced the operator overloading feature and generics to write more usable code. Finally, we talked about memory management to make your app more efficient and more responsive. We ended the chapter with how to use Swift and Objective-C together in the same project and listed the limitations of using some Swift features that can't be used in Objective-C.

Starting with the next chapter, we will mention a new technology in each chapter and how to write a simple demo in Swift. In the next chapter, we will talk about Touch ID, a new framework used to add a new flavor of authentication via finger print sensors.

Left arrow icon Right arrow icon
Download code icon Download Code

Description

After years of using Objective-C for developing apps for iOS/Mac OS, Apple now offers a new, creative, easy, and innovative programming language for application development, called Swift. Swift makes iOS application development a breeze by offering speed, security and power to your application development process. Swift is easy to learn and has awesome features such as being open source, debugging,interactive playgrounds, error handling model, and so on. Swift has simplified its memory management with Automatic Reference Counting (ARC) and it is compatible with Objective-C. This book has been created to provide you with the information and skills you need to use the new programming language Swift. The book starts with an introduction to Swift and code structure. Following this, you will use playgrounds to become familiar with the language in no time. Then the book takes you through the advanced features offered by Swift and how to use them with your old Objective-C code or projects. You will then learn to use Swift in real projects by covering APIs such as HealthKit, Metal, WatchKit, and Touch ID in each chapter. The book's easy to follow structure ensures you get the best start to developing applications with Swift.

Who is this book for?

If you are an iOS developer with experience in Objective-C, and wish to develop applications with Swift, then this book is ideal for you. Familiarity with the fundamentals of Swift is an added advantage but not a necessity.
Estimated delivery fee Deliver to United States

Economy delivery 10 - 13 business days

Free $6.95

Premium delivery 6 - 9 business days

$21.95
(Includes tracking information)

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date : Aug 28, 2015
Length: 144 pages
Edition : 1st
Language : English
ISBN-13 : 9781785288173
Vendor :
Apple
Category :
Languages :
Tools :

What do you get with Print?

Product feature icon Instant access to your digital copy whilst your Print order is Shipped
Product feature icon Paperback book shipped to your preferred address
Product feature icon Redeem a companion digital copy on all Print orders
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
Modal Close icon
Payment Processing...
tick Completed

Shipping Address

Billing Address

Shipping Methods
Estimated delivery fee Deliver to United States

Economy delivery 10 - 13 business days

Free $6.95

Premium delivery 6 - 9 business days

$21.95
(Includes tracking information)

Product Details

Publication date : Aug 28, 2015
Length: 144 pages
Edition : 1st
Language : English
ISBN-13 : 9781785288173
Vendor :
Apple
Category :
Languages :
Tools :

Packt Subscriptions

See our plans and pricing
Modal Close icon
$19.99 billed monthly
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Simple pricing, no contract
$199.99 billed annually
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just $5 each
Feature tick icon Exclusive print discounts
$279.99 billed in 18 months
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just $5 each
Feature tick icon Exclusive print discounts

Frequently bought together


Stars icon
Total $ 114.97
Application Development with Swift
$38.99
Swift 2 Blueprints
$48.99
Swift 2 Design Patterns
$26.99
Total $ 114.97 Stars icon

Table of Contents

8 Chapters
1. Hello Swift Chevron down icon Chevron up icon
2. Advanced Swift Chevron down icon Chevron up icon
3. Touch ID Chevron down icon Chevron up icon
4. Introduction to HealthKit Chevron down icon Chevron up icon
5. Introduction to Metal Chevron down icon Chevron up icon
6. Introduction to WatchKit Chevron down icon Chevron up icon
7. Swift App Extensions Chevron down icon Chevron up icon
Index Chevron down icon Chevron up icon

Customer reviews

Rating distribution
Full star icon Full star icon Full star icon Full star icon Half star icon 4.6
(5 Ratings)
5 star 80%
4 star 0%
3 star 20%
2 star 0%
1 star 0%
ahmed May 20, 2017
Full star icon Full star icon Full star icon Full star icon Full star icon 5
If you're looking to make an iOS app, and you want to learn how to do it properly this is book the perfect foundation. The amount of detail, thought and effort put forward is apparently clear from the beginning through the end.
Amazon Verified review Amazon
Dima Oct 21, 2015
Full star icon Full star icon Full star icon Full star icon Full star icon 5
Book’s caption looks commonly, but its content isn’t so. We wouldn’t learn Swift deeply or get approaches to make applications. And also it’s not about OS X as I guessed at first. This book is for experienced iOS developer with knowledge Objective C.You will find here a lot of useful information. At first you’ll get great Swift course, not deeply, but it’s enough to get rest of this book. Main part of book you will learn new iOS's features, such as Touch ID, HealthKit, Metal and WatchKit. All chapters goes with code examples and screenshots so you never lost. I’m not very good in English but I haven’t any problem in understanding the text.One thing made me disappointed was this book is not about OS X, caption is slightly misleading for me. But it’s OK, I need book about iOS too.Shortly, this book is great booster for your iOS developing skills.
Amazon Verified review Amazon
Winston Sep 28, 2015
Full star icon Full star icon Full star icon Full star icon Full star icon 5
Application Development with Swift is a great book that will jumpstart iOS development for any budding developer or season objective c developer. The book starts with an thorough introduction to the Swift language by using playgrounds to practice code samples.However, this book is for an Objective C developer. The book shows Objective-C developers how to refactor their code for Swift. MUST BUY!!!
Amazon Verified review Amazon
SuJo Nov 05, 2015
Full star icon Full star icon Full star icon Full star icon Full star icon 5
I was looking for a book to work with the new Apple Watch, and I decided to give this a try. The information in the book was accurate and easy to follow along. I'm a complete beginner but I do have a background in C++, so the code flow was easy to pick up on and I was up and running in no time at all. I felt the book did what it set out to do, it got me acquainted with Swift. The first few chapters are great for starting out, I didn't feel overwhelmed at all. I was able to pick this book up on Packt Publishing's main site by using my Packtlib membership, it's cheaper than buying multiple books and I can pickup whenever I want.
Amazon Verified review Amazon
Scott Steinman Oct 31, 2015
Full star icon Full star icon Full star icon Empty star icon Empty star icon 3
The aim this book is to transition existing Objective-C iOS developers to Swift. Therefore, itdoes not cover the basics of iOS Cocoa Touch programming or how to use Xcode. It covers thecore of the Swift programming language — not every detail, but the important ones for anestablished programmer to begin using Swift as a replacement for Objective-C.One major problem with the current edition of the book is that it uses Xcode 6 and Swift 1.2. Inthe short time since its publication, Apple has moved on to Xcode 7 and Swift 2. The sourcecode examples (when full projects are written rather than playground explorations) will notcompile with Xcode 7. Even after applying Xcode’s Swift 2 migration tool, several errors remainthat prevent compilation. When I tried to fix a few of them manually, the code crashed. Anupdated edition of this book is therefore a necessity. In addition, the book covers iOS 8 andWatchKit 1 — iOS 9 and WatchKit 2 were announced in June and are already released.In addition, while the book enumerates many of the features of Swift, paying more attention tothose not present in Objective-C, it fails to go beyond this to provide tips and tricks, or anyinsight into when and how it is best to use each feature. In this regard, its coverage of Swiftdoes not really add anything that’s not already present in Apple’s free The Swift ProgrammingLanguage eBook.Despite not covering everyday iOS programming in Swift, the book covers a few more recentadditions to iOS such as Touch ID, HealthKit, Metal, App Extensions, and interacting with theApple Watch. Each is covered tersely, and I’m not convinced that the reader could build ameaningful app using these technologies from the coverage offered by this book. Theirinclusion is puzzling to me. While established iOS programmers would need to know how toaccess these new technologies in Swift, not helping them learn how to build the bulk of theirapps or to translate the existing Objective-C Cocoa Touch code to Swift may be a disservice. Afew chapters showing how to use Swift to build a commonly-used type of iOS app would havebeen extremely helpful because it would give the reader basic insight into writing Swift code forinteracting with controls through touch and gestures, interacting with the internet, and othertasks used more commonly than Touch ID, HealthKit, Metal, App Extensions or the AppleWatch. As is, the book feels like two unrelated books — one on some differences between Swiftand Objective-C, and the other a tour of recent additions to iOS 8 — thrown together. What’smissing is what the title promises — how to create an application using Swift.A minor issue is the syntax and grammar of the text. There are many examples of awkwardgrammar, such as “…but take care of some the very important notes…”. Although this does notprevent the reader from understanding the book or grasping the concepts from it, it does detractfrom the enjoyment of reading it a bit. The manuscript should have undergone a more thoroughproofreading by reviewers and the editor.Specific Points:Chapter 1:Chapter 1 is a rapid, minimalist review of the basics of Swift, mostly identifying where it differsfrom Objective-C. The reader would have to access another reference to learn all of the differentways that collections can be manipulated, or how enums can be applied to simplify CocoaTouch code, or how closures can be written (especially with the shortcuts that Swift allows). Twoextremely important Swift language additions, structs and optionals, are not covered at all.Many Cocoa Touch methods have optional return values. Swift iOS programming is not possiblewithout an understanding of optionals and how to unwrap them safely.It is stated that there’s no main function in Swift. That’s definitely true within the playground. Inan iOS project, the @UIApplicationMain operator instructs the compiler to generate the mainfunction for you — it’s there, but you don’t have to deal with it.The discussion of functions states that you type the name (description) before the parameter,and can add # before the name of a parameter if the name is sufficient. This description appliesthe word “name” to two different concepts — description and parameter — so it confuses whichname is sufficient and meaningful. Only by reading the code on the following page does thereader determine that the parameter’s actual name is sufficient, so the description is notneeded.Chapter 2:Chapter 2’s coverage of type casting and checking is very welcome. This topic tends to beskimmed over in other Swift books and mentioned only when first needed in an exampleprogramming. This is especially true for the distinction between as and as?. Likewise, thediscussion of the use of AnyObject vs. Any was nicely done.The coverage of protocols is thorough as it relates to Swift 1, but does not touch upon a keyfeature that has been revealed in Swift 2 — protocol-oriented programming. This is, of course,not the fault of the authors, but it is unfortunate because Apple is promoting the application ofprotocol-oriented programming as a major programming technique in future Swift code.A small point: It’s stated in the section on delegation that if a class wants to use theUITableViewDataSource and UITableViewDelegate methods, it must be a protocol of the table.More correctly stated, since a class cannot be a protocol, the class must conform to theprotocols.In the section “Adding computed properties”, extensions add computed instance properties, notcomputer instance properties.Chapter 4:When an NSSet is created to return the types of data we wish to read or write from HealthKit —the user’s height, weight and birthdate — optional versions are stored. No explanation is givenas to why optionals are needed here.Chapter 5:The author recommends that most graphics applications, other than those written by large gamecompanies, should not use Metal. Why then is Metal included as a topic in this book? I thinkthat Metal is too large a topic to cover adequately in one chapter, if the reader is to learn how towrite a simple 3D program, as 3D engines are quite complicated. An entire book could easily bedevoted to this topic alone.Does the 3D Rendering Pipeline section apply to all 3D engines (including Metal) or only toolder engines? This is not clear to me.Chapter 6:The discussion of customizing interface elements in WatchKit is a bit confusing. First, it’s statedthat you can’t do it. Then the next sentence states that you can add a custom UILabel.Afterwards, it’s stated that you can’t do that in WatchKit. In that middle sentence, should it havestated that in UIKit on iPhones and iPads, you can add a custom UILabel?Note: Groups in WatchKit seem to be analogous the UIStackViews of iOS 9. If this book hadcovered iOS 9 instead of 8, this could have been discussed.Chapter 7:While WatchKit was covered in the previous chapter, no means of communicating between aniPhone and an Apple Watch was provided as an example app. Instead, a Today widget iscreated in Chapter 7’s coverage of app extensions. A WatchKit extension would have been avery useful addition to this chapter.
Amazon Verified review Amazon
Get free access to Packt library with over 7500+ books and video courses for 7 days!
Start Free Trial

FAQs

What is the digital copy I get with my Print order? Chevron down icon Chevron up icon

When you buy any Print edition of our Books, you can redeem (for free) the eBook edition of the Print Book you’ve purchased. This gives you instant access to your book when you make an order via PDF, EPUB or our online Reader experience.

What is the delivery time and cost of print book? Chevron down icon Chevron up icon

Shipping Details

USA:

'

Economy: Delivery to most addresses in the US within 10-15 business days

Premium: Trackable Delivery to most addresses in the US within 3-8 business days

UK:

Economy: Delivery to most addresses in the U.K. within 7-9 business days.
Shipments are not trackable

Premium: Trackable delivery to most addresses in the U.K. within 3-4 business days!
Add one extra business day for deliveries to Northern Ireland and Scottish Highlands and islands

EU:

Premium: Trackable delivery to most EU destinations within 4-9 business days.

Australia:

Economy: Can deliver to P. O. Boxes and private residences.
Trackable service with delivery to addresses in Australia only.
Delivery time ranges from 7-9 business days for VIC and 8-10 business days for Interstate metro
Delivery time is up to 15 business days for remote areas of WA, NT & QLD.

Premium: Delivery to addresses in Australia only
Trackable delivery to most P. O. Boxes and private residences in Australia within 4-5 days based on the distance to a destination following dispatch.

India:

Premium: Delivery to most Indian addresses within 5-6 business days

Rest of the World:

Premium: Countries in the American continent: Trackable delivery to most countries within 4-7 business days

Asia:

Premium: Delivery to most Asian addresses within 5-9 business days

Disclaimer:
All orders received before 5 PM U.K time would start printing from the next business day. So the estimated delivery times start from the next day as well. Orders received after 5 PM U.K time (in our internal systems) on a business day or anytime on the weekend will begin printing the second to next business day. For example, an order placed at 11 AM today will begin printing tomorrow, whereas an order placed at 9 PM tonight will begin printing the day after tomorrow.


Unfortunately, due to several restrictions, we are unable to ship to the following countries:

  1. Afghanistan
  2. American Samoa
  3. Belarus
  4. Brunei Darussalam
  5. Central African Republic
  6. The Democratic Republic of Congo
  7. Eritrea
  8. Guinea-bissau
  9. Iran
  10. Lebanon
  11. Libiya Arab Jamahriya
  12. Somalia
  13. Sudan
  14. Russian Federation
  15. Syrian Arab Republic
  16. Ukraine
  17. Venezuela
What is custom duty/charge? Chevron down icon Chevron up icon

Customs duty are charges levied on goods when they cross international borders. It is a tax that is imposed on imported goods. These duties are charged by special authorities and bodies created by local governments and are meant to protect local industries, economies, and businesses.

Do I have to pay customs charges for the print book order? Chevron down icon Chevron up icon

The orders shipped to the countries that are listed under EU27 will not bear custom charges. They are paid by Packt as part of the order.

List of EU27 countries: www.gov.uk/eu-eea:

A custom duty or localized taxes may be applicable on the shipment and would be charged by the recipient country outside of the EU27 which should be paid by the customer and these duties are not included in the shipping charges been charged on the order.

How do I know my custom duty charges? Chevron down icon Chevron up icon

The amount of duty payable varies greatly depending on the imported goods, the country of origin and several other factors like the total invoice amount or dimensions like weight, and other such criteria applicable in your country.

For example:

  • If you live in Mexico, and the declared value of your ordered items is over $ 50, for you to receive a package, you will have to pay additional import tax of 19% which will be $ 9.50 to the courier service.
  • Whereas if you live in Turkey, and the declared value of your ordered items is over € 22, for you to receive a package, you will have to pay additional import tax of 18% which will be € 3.96 to the courier service.
How can I cancel my order? Chevron down icon Chevron up icon

Cancellation Policy for Published Printed Books:

You can cancel any order within 1 hour of placing the order. Simply contact customercare@packt.com with your order details or payment transaction id. If your order has already started the shipment process, we will do our best to stop it. However, if it is already on the way to you then when you receive it, you can contact us at customercare@packt.com using the returns and refund process.

Please understand that Packt Publishing cannot provide refunds or cancel any order except for the cases described in our Return Policy (i.e. Packt Publishing agrees to replace your printed book because it arrives damaged or material defect in book), Packt Publishing will not accept returns.

What is your returns and refunds policy? Chevron down icon Chevron up icon

Return Policy:

We want you to be happy with your purchase from Packtpub.com. We will not hassle you with returning print books to us. If the print book you receive from us is incorrect, damaged, doesn't work or is unacceptably late, please contact Customer Relations Team on customercare@packt.com with the order number and issue details as explained below:

  1. If you ordered (eBook, Video or Print Book) incorrectly or accidentally, please contact Customer Relations Team on customercare@packt.com within one hour of placing the order and we will replace/refund you the item cost.
  2. Sadly, if your eBook or Video file is faulty or a fault occurs during the eBook or Video being made available to you, i.e. during download then you should contact Customer Relations Team within 14 days of purchase on customercare@packt.com who will be able to resolve this issue for you.
  3. You will have a choice of replacement or refund of the problem items.(damaged, defective or incorrect)
  4. Once Customer Care Team confirms that you will be refunded, you should receive the refund within 10 to 12 working days.
  5. If you are only requesting a refund of one book from a multiple order, then we will refund you the appropriate single item.
  6. Where the items were shipped under a free shipping offer, there will be no shipping costs to refund.

On the off chance your printed book arrives damaged, with book material defect, contact our Customer Relation Team on customercare@packt.com within 14 days of receipt of the book with appropriate evidence of damage and we will work with you to secure a replacement copy, if necessary. Please note that each printed book you order from us is individually made by Packt's professional book-printing partner which is on a print-on-demand basis.

What tax is charged? Chevron down icon Chevron up icon

Currently, no tax is charged on the purchase of any print book (subject to change based on the laws and regulations). A localized VAT fee is charged only to our European and UK customers on eBooks, Video and subscriptions that they buy. GST is charged to Indian customers for eBooks and video purchases.

What payment methods can I use? Chevron down icon Chevron up icon

You can pay with the following card types:

  1. Visa Debit
  2. Visa Credit
  3. MasterCard
  4. PayPal
What is the delivery time and cost of print books? Chevron down icon Chevron up icon

Shipping Details

USA:

'

Economy: Delivery to most addresses in the US within 10-15 business days

Premium: Trackable Delivery to most addresses in the US within 3-8 business days

UK:

Economy: Delivery to most addresses in the U.K. within 7-9 business days.
Shipments are not trackable

Premium: Trackable delivery to most addresses in the U.K. within 3-4 business days!
Add one extra business day for deliveries to Northern Ireland and Scottish Highlands and islands

EU:

Premium: Trackable delivery to most EU destinations within 4-9 business days.

Australia:

Economy: Can deliver to P. O. Boxes and private residences.
Trackable service with delivery to addresses in Australia only.
Delivery time ranges from 7-9 business days for VIC and 8-10 business days for Interstate metro
Delivery time is up to 15 business days for remote areas of WA, NT & QLD.

Premium: Delivery to addresses in Australia only
Trackable delivery to most P. O. Boxes and private residences in Australia within 4-5 days based on the distance to a destination following dispatch.

India:

Premium: Delivery to most Indian addresses within 5-6 business days

Rest of the World:

Premium: Countries in the American continent: Trackable delivery to most countries within 4-7 business days

Asia:

Premium: Delivery to most Asian addresses within 5-9 business days

Disclaimer:
All orders received before 5 PM U.K time would start printing from the next business day. So the estimated delivery times start from the next day as well. Orders received after 5 PM U.K time (in our internal systems) on a business day or anytime on the weekend will begin printing the second to next business day. For example, an order placed at 11 AM today will begin printing tomorrow, whereas an order placed at 9 PM tonight will begin printing the day after tomorrow.


Unfortunately, due to several restrictions, we are unable to ship to the following countries:

  1. Afghanistan
  2. American Samoa
  3. Belarus
  4. Brunei Darussalam
  5. Central African Republic
  6. The Democratic Republic of Congo
  7. Eritrea
  8. Guinea-bissau
  9. Iran
  10. Lebanon
  11. Libiya Arab Jamahriya
  12. Somalia
  13. Sudan
  14. Russian Federation
  15. Syrian Arab Republic
  16. Ukraine
  17. Venezuela
Modal Close icon
Modal Close icon