Objective-C for Swift Developers Frequent Flyer PDF - Hacking With Swift - Programming Ebook

Latest

Download Programming Ebook

Facebook Page

Tuesday, June 13, 2017

Objective-C for Swift Developers Frequent Flyer PDF - Hacking With Swift

Objective-C for Swift Developers Frequent Flyer
Objective-C for Swift Developers Frequent Flyer


Book Details 


             TitleObjective-C for Swift Developers
      ISBN-10942878347
         Author: Paul Hudson
     Publisher: Hacking with Swift
    Language: English
        SubjectSwift / Computers & Technology / Programming / Apple Programming
No. of pages: 155
         Format: PDF


Introduction

I first sat down to plan this book in March 2016, when Swift 2.2 was the standard and Swift 3.0 was only a few months away. At this point the Swift language had already come a long way since its initial launch, and had a strong following of developers who were able to write idiomatic Swift to deliver fast, stable software.

Why, then, write a book about Objective-C? More importantly, why read about a book about Objective-C? I have no doubt that Swift is the future of app development for Apple developers, but at the same time I am very conscious of the fact that Objective-C is the incumbent language used in over a million apps on the App Store. If you’re serious about building a career for yourself, you need to understand how to read and write the language.

This is complicated by the fact that Objective-C is an old language, and has evolved substantially over its years. I’ve shipped over 200 apps written in Objective-C, and it’s fascinating for me to compare old source code against new to see how I embraced new language features as the years went by.

Unlike Swift, where old syntax is deprecated and removed in just a few months, nearly all old Objective-C source code remains valid today. This is helpful for companies who don’t want to keep refactoring old software, but unhelpful for learners because it means you’re as likely to find new Objective-C syntax as you are to find old. There are some places where you’ll find quite crufty old Objective-C code that simply wouldn’t exist if it were written today, but I’m afraid that’s unavoidable 
– take solace in knowing that it’s fairly uncommon!

How this book is structured

I’ve tried to ensure this book teaches you the fundamentals required to be able to read and write Objective-C competently. I have assumed throughout that you have a sound working knowledge of Swift. If this is not the case, please buy a copy of Hacking with Swift and perhaps also Pro Swift, and read those first:
  • Hacking with Swift: https://gum.co/hws-book-pack.
  • Pro Swift: https://gum.co/proswift.
    In order to equip you with the skills necessary to read a wide variety of Objective-C, I’ve
covered both new and old syntax, and even a few pieces of very old syntax. I’ve made it clear which is the modern choice, so the rule is simple: be prepared to read old Objective-C, but be able to write whichever is used in the existing code. Unless you are tasked with refactoring a project, this is important: if you are modifying source code that uses an older style of Objective-C, you should aim to write a similar style rather than mix new and old.

I arranged the chapters in this book to follow a logical flow. If you’re reading this for the first time it’s better you read linearly so that concepts are introduced in a sensible order.

Above all, my main goal in writing this book has been to make it as short as possible. I have rewritten sentences, paragraphs, and even whole chapters in an attempt to get across what you need to know as quickly as possible. This means we jump straight into the language rather than talk about history and facts – I suggest you make some coffee and brace yourself.

Real-world projects

This book includes three Objective-C projects that give you a chance to test your skills as you go. They aren’t complicated. Instead, the goal is to re-enforce what you’ve learned, while introducing a couple of new things along the way.

Accompanying this book is a 30-minute video, and there’s a good chance that over half of you have already opened it out of curiosity. That’s a mistake. The video assumes you’ve read through this book, and even though it’s 30 minutes long it’s recorded at a fast pace – there’s no hanging around. In the video, I go through a complete Hacking with Swift project, copying and pasting the Swift source code into an Objective-C app. I then translate the Swift syntax into Objective-C, which will be hard to follow unless you’ve first understood the contents of this book.

So: as tempting as the video is, please hold it off until you get to the end of this book. If you’re able to, I would even suggest completing the tutorial in Swift before, so that you understand what’s going on – I don’t read out all the explanation of what things do, instead it’s just about translating Objective-C to Swift. You can find it here: https://www.hackingwithswift.com/ read/31/overview.

Do I love Objective-C?

When I read through the first complete draft of this book, I thought to myself, “wow, this reads like the Snark’s Guide to Objective-C,” because it felt like almost every chapter complained about something.

As a result, I spent some time editing the book to make it a little more upbeat – not because I’m trying to present things to you in an artificial light, but because I genuinely loved working with Objective-C. I switched to Swift the day it was announced, and had a Swift app live on the App Store on the first day it was possible to do so. As a result, in many respects Objective- C only seems bad because Swift is so much better – I’ve been working with Swift so long that going back to Objective-C feels a bit like returning to your rural home town for Christmas when you’re used to living in a big city.

I can’t tell whether I loved Objective-C because I had Stockholm syndrome, or whether it was because Apple’s APIs are just so darned powerful. Regardless, I think it’s important you realize that some amazing software has been built with Objective-C and many people love it just as much today as they always have. When you find things in this book that make you cringe, be gentle: it’s an old language, it’s come a long way, and it has served us very well. At the very least, it deserves dignity in retirement!

Before we begin...

You should install the latest Xcode from the Mac App Store. It's free, and includes everything you need to make iOS apps in the iOS Simulator. Where iOS code is presented – which is not very often, by design – it’s written for iOS 9.0 or later.
I'm happy to answer questions on Twitter if you encounter problems, so please feel free to get in touch: I’m @twostraws.

Swift, the Swift logo, Xcode, Instruments, Cocoa Touch, Touch ID, AirDrop, iBeacon, iPhone, iPad, Safari, App Store, Mac and macOS are trademarks of Apple Inc., registered in the U.S. and other countries.

Objective-C for Swift Developers is copyright Paul Hudson. All rights reserved. No part of this book or corresponding materials (such as text, images, or source code) may be reproduced or

distributed by any means without prior written permission of the copyright owner.

Frequent Flyer Club

You can buy Swift tutorials from anywhere, but I'm pleased, proud, and very grateful that you chose mine. I want to say thank you, and the best way I have of doing that is by giving you bonus content above and beyond what you paid for – you deserve it!

Every book contains a word that unlocks bonus content for Frequent Flyer Club members. The word for this book is SOLAR. Enter that word, along with words from any other Hacking with Swift books, here: https://www.hackingwithswift.com/frequent-flyer

Dedication

This book is dedicated to my friend, Stefan Kruger, who has been hacking with Objective-C since the NeXT days. Thank you for teaching me so much about regular expressions, project management, and being stubborn in the face of chaotic business decisions. 

No comments:

Post a Comment