iOS 12 Programming Fundamentals with Swift Swift Xcode and Cocoa Basics 5th Edition Matt Neuburg pdf download
iOS 12 Programming Fundamentals with Swift Swift Xcode and Cocoa Basics 5th Edition Matt Neuburg pdf download
https://textbookfull.com/product/ios-12-programming-fundamentals-
with-swift-swift-xcode-and-cocoa-basics-5th-edition-matt-neuburg/
https://textbookfull.com/product/ios-12-programming-fundamentals-
with-swift-swift-xcode-and-cocoa-basics-5th-edition-matt-
neuburg-2/
https://textbookfull.com/product/ios-12-programming-fundamentals-
with-swift-swift-xcode-and-cocoa-basics-5th-edition-matt-
neuburg-3/
https://textbookfull.com/product/ios-10-programming-fundamentals-
with-swift-swift-xcode-and-cocoa-basics-3rd-edition-matt-neuburg/
https://textbookfull.com/product/ios-11-programming-fundamentals-
with-swift-swift-xcode-and-cocoa-basics-4th-edition-matt-neuburg/
iOS 13 Programming Fundamentals with Swift Swift Xcode
and Cocoa Basics 1st Edition Matt Neuburg
https://textbookfull.com/product/ios-13-programming-fundamentals-
with-swift-swift-xcode-and-cocoa-basics-1st-edition-matt-neuburg/
https://textbookfull.com/product/ios-14-programming-fundamentals-
with-swift-covers-ios-14-xcode-12-and-swift-5-3-7th-edition-matt-
neuburg/
https://textbookfull.com/product/programming-ios-14-11th-edition-
matt-neuburg/
https://textbookfull.com/product/learn-ios-11-programming-with-
swift-4-craig-clayton/
https://textbookfull.com/product/programming-ios-12-dive-deep-
into-views-view-controllers-and-frameworks-1st-edition-matt-
neuburg/
Xc
C o 0,
od
ve a n
e1
rs d
i O Sw
S 1 if t
2, 4
.2
iOS 12
Programming
Fundamentals
with Swift
SWIFT, XCODE, AND COCOA BASICS
Matt Neuburg
FIFTH EDITION
iOS 12 Programming
Fundamentals with Swift
Swift, Xcode, and Cocoa Basics
Matt Neuburg
Boston
iOS 12 Programming Fundamentals with Swift, Fifth Edition
by Matt Neuburg
Copyright © 2018 Matt Neuburg. All rights reserved.
Printed in the United States of America.
Published by O’Reilly Media, Inc., 1005 Gravenstein Highway North, Sebastopol, CA 95472.
O’Reilly books may be purchased for educational, business, or sales promotional use. Online editions are
also available for most titles (http://oreilly.com/safari). For more information, contact our corporate/insti‐
tutional sales department: 800-998-9938 or corporate@oreilly.com.
The O’Reilly logo is a registered trademark of O’Reilly Media, Inc. iOS 12 Programming Fundamentals
with Swift, the image of a harp seal, and related trade dress are trademarks of O’Reilly Media, Inc.
While the publisher and the author have used good faith efforts to ensure that the information and
instructions contained in this work are accurate, the publisher and the author disclaim all responsibility
for errors or omissions, including without limitation responsibility for damages resulting from the use of
or reliance on this work. Use of the information and instructions contained in this work is at your own
risk. If any code samples or other technology this work contains or describes is subject to open source
licenses or the intellectual property rights of others, it is your responsibility to ensure that your use
thereof complies with such licenses and/or rights.
ISBN: 978-1-492-04455-0
[LSI]
Table of Contents
Preface. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xiii
Part I. Language
1. The Architecture of Swift. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
Ground of Being 3
Everything Is an Object? 5
Three Flavors of Object Type 6
Variables 6
Functions 8
The Structure of a Swift File 9
Scope and Lifetime 11
Object Members 13
Namespaces 13
Modules 14
Instances 15
Why Instances? 17
The Keyword self 19
Privacy 20
Design 22
Object Types and APIs 23
Instance Creation, Scope, and Lifetime 25
Summary and Conclusion 25
2. Functions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
Function Parameters and Return Value 27
Void Return Type and Parameters 31
Function Signature 32
External Parameter Names 32
iii
Overloading 34
Default Parameter Values 35
Variadic Parameters 35
Ignored Parameters 36
Modifiable Parameters 37
Function in Function 40
Recursion 42
Function As Value 42
Anonymous Functions 45
Define-and-Call 51
Closures 52
How Closures Improve Code 54
Function Returning Function 55
Closure Setting a Captured Variable 58
Closure Preserving Its Captured Environment 59
Escaping Closures 60
Curried Functions 60
Function References and Selectors 62
Function Reference Scope 64
Selectors 65
iv | Table of Contents
Subscripts 132
Nested Object Types 135
Instance References 135
Enums 137
Raw Values 138
Associated Values 140
Enum Case Iteration 142
Enum Initializers 143
Enum Properties 144
Enum Methods 145
Why Enums? 146
Structs 147
Struct Initializers, Properties, and Methods 147
Struct As Namespace 149
Classes 149
Value Types and Reference Types 150
Subclass and Superclass 156
Class Initializers 161
Class Deinitializer 169
Class Properties and Methods 170
Polymorphism 172
Casting 175
Casting Down 176
Type Testing and Casting Down Safely 176
Type Testing and Casting Optionals 178
Bridging to Objective-C 178
Type References 180
From Instance to Type 180
Type as Value 181
The Keyword Self 183
Comparing Types 184
Summary of Type Terminology 185
Protocols 186
Why Protocols? 187
Protocol Type Testing and Casting 189
Declaring a Protocol 190
Protocol Composition 191
Optional Protocol Members 192
Class Protocol 194
Implicitly Required Initializers 195
Literal Convertibles 196
Generics 197
Table of Contents | v
Generic Declarations 200
Contradictory Resolution 202
Type Constraints 203
Explicit Specialization 205
Generic Invariance 207
Associated Type Chains 208
Where Clauses 210
Extensions 213
Extending Object Types 213
Extending Protocols 215
Extending Generics 217
Umbrella Types 219
Any 219
AnyObject 221
AnyClass 223
Collection Types 224
Array 224
Dictionary 240
Set 247
vi | Table of Contents
6. Anatomy of an Xcode Project. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 313
New Project 313
The Project Window 315
The Navigator Pane 317
The Utilities Pane 322
The Editor 323
The Project File and Its Dependents 325
What’s In the Project Folder 326
Groups 327
The Target 328
Build Phases 328
Build Settings 330
Configurations 331
Schemes and Destinations 333
From Project to Built App 335
Build Settings 338
Property List Settings 338
Nib Files 339
Additional Resources 340
Code Files 342
Frameworks and SDKs 343
The App Launch Process 345
The Entry Point 345
UIApplicationMain 346
App Without a Storyboard 348
Renaming Parts of a Project 349
8. Documentation. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 385
The Documentation Window 385
Class Documentation Pages 386
Quick Help 390
Symbol Declarations 392
Header Files 393
Sample Code 394
Internet Resources 394
Table of Contents | ix
NSSet and Friends 496
NSIndexSet 497
NSNull 498
Immutable and Mutable 498
Property Lists 500
Codable 501
Accessors, Properties, and Key–Value Coding 504
Swift Accessors 505
Key–Value Coding 507
Uses of Key–Value Coding 508
KVC and Outlets 510
Cocoa Key Paths 510
The Secret Life of NSObject 511
x | Table of Contents
Autorelease Pool 547
Memory Management of Instance Properties 549
Retain Cycles and Weak References 550
Unusual Memory Management Situations 552
Notification Observers 552
KVO Observers 554
Timers 554
Other Unusual Situations 556
Nib Loading and Memory Management 556
Memory Management of CFTypeRefs 557
Property Memory Management Policies 559
Debugging Memory Management Mistakes 561
Index. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 607
Table of Contents | xi
Preface
On June 2, 2014, Apple’s WWDC keynote address ended with a shocking announce‐
ment: “We have a new programming language.” This came as a huge surprise to the
developer community, which was accustomed to Objective-C, warts and all, and
doubted that Apple could ever possibly relieve them from the weight of its venerable
legacy. The developer community, it appeared, had been wrong.
Having picked themselves up off the floor, developers immediately began to consider
this new language — Swift — studying it, critiquing it, and deciding whether to use it.
My own first move was to translate all my existing iOS apps into Swift; this was
enough to convince me that Swift deserved to be, and probably would be, adopted by
new students of iOS programming, and that my books, therefore, should henceforth
assume that readers are using Swift.
That decision has proven prophetic. Programmers of iOS have flocked to Swift in
increasing numbers, and Swift itself has only improved. My iOS apps (such as Diabel‐
li’s Theme, LinkSame, Zotz!, TidBITS News, and my Latin and Greek flashcard apps)
have all been rewritten in Swift, and are far easier for me to understand and maintain
than their Objective-C originals.
Xcode 10 comes with Swift 4.2. The language has evolved greatly in its details and in
the nature of its integration with the Cocoa libraries that underlie iOS programming,
but its spirit has remained constant. The Swift language is designed from the ground
up with these salient features:
Object-orientation
Swift is a modern, object-oriented language. It is purely object-oriented: “Every‐
thing is an object.”
Clarity
Swift is easy to read and easy to write. Its syntax is clear, consistent, and explicit,
with few hidden shortcuts and minimal syntactic trickery.
xiii
Safety
Swift enforces strong typing to ensure that it knows, and that you know, what the
type of every object reference is at every moment.
Economy
Swift is a fairly small language, providing some basic types and functionalities
and no more. The rest must be provided by your code, or by libraries of code that
you use — such as Cocoa.
Memory management
Swift manages memory automatically. You will rarely have to concern yourself
with memory management.
Cocoa compatibility
The Cocoa APIs are written primarily in C and Objective-C. Swift is explicitly
designed to interface with most of the Cocoa APIs.
These features make Swift an excellent language for learning to program iOS.
The alternative, Objective-C, still exists, and you can use it if you like. Indeed, it is
easy to write an app that includes both Swift code and Objective-C code; and you may
have reason to do so. Objective-C, however, lacks the very advantages that Swift
offers. Objective-C agglomerates object-oriented features onto C. It is therefore only
partially object-oriented; it has both objects and scalar data types, and its objects have
to be slotted into one particular C data type (pointers). Its syntax can be difficult and
tricky; reading and writing nested method calls can make one’s eyes glaze over, and it
invites hacky habits such as implicit nil-testing. Its type checking can be and fre‐
quently is turned off, resulting in programmer errors where a message is sent to the
wrong type of object and the program crashes.
Recent revisions and additions to Objective-C — ARC, synthesis and autosynthesis,
improved literal array and dictionary syntax, blocks — have made it easier and more
convenient, but such patches have also made the language even larger and possibly
even more confusing. Because Objective-C must encompass C, there are limits to
how far it can be extended and revised. Swift, on the other hand, is a clean start. If
you were to dream of completely revising Objective-C to create a better Objective-C,
Swift might be what you would dream of. It puts a modern, rational front end
between you and the Cocoa Objective-C APIs.
Still, the reader may also need some awareness of Objective-C (including C). The
Foundation and Cocoa APIs, the built-in commands with which your code must
interact in order to make anything happen on an iOS device, are still written in C and
Objective-C. In order to interact with them, you might have to know what those lan‐
guages would expect.
xiv | Preface
Therefore, although I do not attempt to teach Objective-C in this book, I do describe
it in enough detail to allow you to read it when you encounter it in the documenta‐
tion and on the Internet, and I occasionally show some Objective-C code. Part III, on
Cocoa, is really all about learning to think the way Objective-C thinks — because the
structure and behavior of the Cocoa APIs are fundamentally based on Objective-C.
And the book ends with an appendix that details how Swift and Objective-C commu‐
nicate with one another, as well as explaining how your app can be written partly in
Swift and partly in Objective-C.
Preface | xv
Swift playgrounds or the REPL. My focus here is real-life iOS programming, and
my explanation of Swift therefore concentrates on those common, practical
aspects of the language that, in my experience, actually come into play in the
course of programming iOS.
• Part II turns to Xcode, the world in which all iOS programming ultimately takes
place. It explains what an Xcode project is and how it is transformed into an app,
and how to work comfortably and nimbly with Xcode to consult the documenta‐
tion and to write, navigate, and debug code, as well as how to bring your app
through the subsequent stages of running on a device and submission to the App
Store. There is also a very important chapter on nibs and the nib editor (Interface
Builder), including outlets and actions as well as the mechanics of nib loading;
however, such specialized topics as autolayout constraints in the nib are post‐
poned to the other book.
• Part III introduces the Cocoa Touch framework. When you program for iOS, you
take advantage of a suite of frameworks provided by Apple. These frameworks,
taken together, constitute Cocoa; the brand of Cocoa that provides the API for
programming iOS is Cocoa Touch. Your code will ultimately be almost entirely
about communicating with Cocoa. The Cocoa Touch frameworks provide the
underlying functionality that any iOS app needs to have. But to use a framework,
you have to think the way the framework thinks, put your code where the frame‐
work expects it, and fulfill many obligations imposed on you by the framework.
To make things even more interesting, Cocoa uses Objective-C, while you’ll be
using Swift: you need to know how your Swift code will interface with Cocoa’s
features and behaviors. Cocoa provides important foundational classes and adds
linguistic and architectural devices such as categories, protocols, delegation, and
notifications, as well as the pervasive responsibilities of memory management.
Key–value coding and key–value observing are also discussed here.
The reader of this book will thus get a thorough grounding in the fundamental
knowledge and techniques that any good iOS programmer needs. The book itself
doesn’t show how to write any particularly interesting iOS apps, but it does constantly
use my own real apps and real programming situations to illustrate and motivate its
explanations. And then you’ll be ready for Programming iOS 12, of course!
Versions
This book is geared to Swift 4.2, iOS 12, and Xcode 10.
In general, only very minimal attention is given to earlier versions of iOS and Xcode.
It is not my intention to embrace in this book any detailed knowledge about earlier
versions of the software, which is, after all, readily and compendiously available in my
earlier books. The book does contain, nevertheless, a few words of advice about back‐
ward compatibility (especially in Chapter 9).
xvi | Preface
A word about method names. I generally give method names in Swift, in the style of a
function reference (as described in Chapter 2) — that is, the name plus parentheses
containing the parameter labels followed by colon. Now and then, if a method is
already under discussion and there is no ambiguity, I’ll use the bare name. In a few
places, such as Appendix A, where the Objective-C language is explicitly under dis‐
cussion, I use Objective-C method names.
Please bear in mind that Apple continues to make adjustments to the Swift language.
I have tried to keep my code up-to-date right up to the moment when the manuscript
left my hands; but if, at some future time, a new version of Xcode is released along
with a new version of Swift, some of the code in this book, and even some informa‐
tion about Swift itself, might be slightly incorrect. Please make allowances, and be
prepared to compensate.
Screenshots of Xcode were taken using Xcode 10 under macOS 10.13 High Sierra. I
have not upgraded my machine to macOS 10.14 Mojave, because at the time of this
writing it was too new to be trusted with mission-critical work. If you are braver than
I am and running Mojave, your interface may naturally look slightly different from
the screenshots (especially if you’re using “dark mode”), but this difference will be
minimal and shouldn’t cause any confusion.
Acknowledgments
My thanks go first and foremost to the people at O’Reilly Media who have made writ‐
ing a book so delightfully easy: Rachel Roumeliotis, Sarah Schneider, Kristen Brown,
Dan Fauxsmith, Adam Witwer, and Sanders Kleinfeld come particularly to mind.
And let’s not forget my first and long-standing editor, Brian Jepson, whose influence
is present throughout.
As in the past, I have been greatly aided by some fantastic software, whose excellences
I have appreciated at every moment of the process of writing this book. I should like
to mention, in particular:
• git (http://git-scm.com)
• Sourcetree (http://www.sourcetreeapp.com)
• TextMate (http://macromates.com)
• AsciiDoc (http://www.methods.co.nz/asciidoc)
• Asciidoctor (http://asciidoctor.org)
• BBEdit (http://barebones.com/products/bbedit/)
• EasyFind (http://www.devontechnologies.com/products/freeware.html)
• Snapz Pro X (http://www.ambrosiasw.com)
• GraphicConverter (http://www.lemkesoft.com)
Preface | xvii
• OmniGraffle (http://www.omnigroup.com)
The book was typed and edited entirely on my faithful Unicomp Model M keyboard
(http://pckeyboard.com), without which I could never have done so much writing over
so long a period so painlessly. For more about my physical work environment, see
http://matt.neuburg.usesthis.com.
xviii | Preface
This book is not intended to disparage Apple’s own documentation and example
projects. They are wonderful resources and have become more wonderful as time
goes on. I have depended heavily on them in the preparation of this book. But I also
find that they don’t fulfill the same function as a reasoned, ordered presentation of
the facts. The online documentation must make assumptions as to how much you
already know; it can’t guarantee that you’ll approach it in a given order. And online
documentation is more suitable to reference than to instruction. A fully written
example, no matter how well commented, is difficult to follow; it demonstrates, but it
does not teach.
A book, on the other hand, has numbered chapters and sequential pages; I can
assume you know views before you know view controllers for the simple reason that
Part I precedes Part II. And along with facts, I also bring to the table a degree of expe‐
rience, which I try to communicate to you. Throughout this book you’ll find me
referring to “common beginner mistakes”; in most cases, these are mistakes that I
have made myself, in addition to seeing others make them. I try to tell you what the
pitfalls are because I assume that, in the course of things, you will otherwise fall into
them just as naturally as I did as I was learning. You’ll also see me construct many
examples piece by piece or extract and explain just one tiny portion of a larger app. It
is not a massive finished program that teaches programming, but an exposition of the
thought process that developed that program. It is this thought process, more than
anything else, that I hope you will gain from reading this book.
Preface | xix
This element signifies a general note.
xx | Preface
For more information, please visit http://oreilly.com/safari.
How to Contact Us
Please address comments and questions concerning this book to the publisher:
We have a web page for this book, where we list errata, examples, and any additional
information. You can access this page at http://bit.ly/ios12-prog-fundamentals.
To comment or ask technical questions about this book, send email to bookques‐
tions@oreilly.com.
For more information about our books, courses, conferences, and news, see our web‐
site at http://www.oreilly.com.
Find us on Facebook: http://facebook.com/oreilly
Follow us on Twitter: http://twitter.com/oreillymedia
Watch us on YouTube: http://www.youtube.com/oreillymedia
Preface | xxi
PART I
Language
This part of the book teaches the Swift language, from the ground up. The descrip‐
tion is rigorous and orderly. Here you’ll become sufficiently conversant with Swift to
be comfortable with it, so that you can proceed to the practical business of actual
programming.
• Chapter 1 surveys the structure of a Swift program, both physically and concep‐
tually. You’ll learn how Swift code files are organized, and you’ll be introduced to
the most important underlying concepts of the object-oriented Swift language:
variables and functions, scopes and namespaces, object types and their instances.
• Chapter 2 explores Swift functions. We start with the basics of how functions are
declared and called; then we discuss parameters — external parameter names,
default parameters, and variadic parameters. Then we dive deep into the power
of Swift functions, with an explanation of functions inside functions, functions as
first-class values, anonymous functions, functions as closures, curried functions,
and function references and selectors.
• Chapter 3 starts with Swift variables — their scope and lifetime, and how they are
declared and initialized, along with features such as computed variables and set‐
ter observers. Then some important built-in Swift types are introduced, includ‐
ing Booleans, numbers, strings, ranges, tuples, and Optionals.
• Chapter 4 is all about Swift object types — classes, structs, and enums. It explains
how these three object types work, and how you declare, instantiate, and use
them. Then it proceeds to polymorphism and casting, protocols, generics, and
extensions. The chapter concludes with a discussion of Swift’s umbrella types,
such as Any and AnyObject, and collection types — Array, Dictionary, and Set
(including option sets).
• Chapter 5 is a miscellany. We start with Swift’s flow control structures for branch‐
ing, looping, and jumping, including error handling. Then I describe Swift access
control (privacy), introspection (reflection), and how to create your own opera‐
tors. There follows a discussion of some recently added Swift language features:
synthesized protocol implementations, key paths, and dynamic member lookup.
The chapter concludes by considering Swift memory management.
CHAPTER 1
The Architecture of Swift
It will be useful at the outset for you to have a general sense of how the Swift language
is constructed and what a Swift-based iOS program looks like. This chapter will sur‐
vey the overall architecture and nature of the Swift language. Subsequent chapters
will fill in the details.
Ground of Being
A complete Swift command is a statement. A Swift text file consists of multiple lines
of text. Line breaks are meaningful. The typical layout of a program is one statement,
one line:
print("hello")
print("world")
3
print(
"world")
Comments are everything after two slashes in a line (so-called C++-style comments):
print("world") // this is a comment, so Swift ignores it
You can also enclose comments in /*...*/, as in C. Unlike C, C-style comments can
be nested.
Many constructs in Swift use curly braces as delimiters:
class Dog {
func bark() {
print("woof")
}
}
By convention, the contents of curly braces are preceded and followed by line breaks
and are indented for clarity, as shown in the preceding code. Xcode will help impose
this convention, but the truth is that Swift doesn’t care, and layouts like this are legal
(and are sometimes more convenient):
class Dog { func bark() { print("woof") }}
Swift is a compiled language. This means that your code must build — passing
through the compiler and being turned from text into some lower-level form that a
computer can understand — before it can run and actually do the things it says to do.
The Swift compiler is very strict; in the course of writing a program, you will often try
to build and run, only to discover that you can’t even build in the first place, because
the compiler will flag some error, which you will have to fix if you want the code to
run. Less often, the compiler will let you off with a warning; the code can run, but in
general you should take warnings seriously and fix whatever they are telling you
about. The strictness of the compiler is one of Swift’s greatest strengths, and provides
your code with a large measure of audited correctness even before it ever runs.
The Swift compiler’s error and warning messages, however, range from the insightful
to the obtuse to the downright misleading. You will often know that something is
wrong with a line of code, but the Swift compiler will not be telling you clearly exactly
what is wrong or even where in the line to focus your attention. My advice in these
situations is to pull the line apart into several lines of simpler code until you reach a
point where you can guess what the issue is. Try to love the compiler despite the occa‐
sional unhelpful nature of its messages. Remember, it knows more than you do, even
if it is sometimes rather inarticulate about its knowledge.
But it is surprising to find that 1 can be followed by a dot and a message. This is legal
and meaningful in Swift (don’t worry about what it actually means):
let s = 1.description
But we can go further. Return to that innocent-looking 1 + 2 from our earlier code.
It turns out that this is actually a kind of syntactic trickery, a convenient way of
expressing and hiding what’s really going on. Just as 1 is actually an object, + is
actually a message; but it’s a message with special syntax (operator syntax). In Swift,
every noun is an object, and every verb is a message.
Perhaps the ultimate acid test for whether something is an object in Swift is whether
you can modify it. An object type can be extended in Swift, meaning that you can
define your own messages on that type. For example, you can’t normally send the say-
Hello message to a number. But you can change a number type so that you can:
extension Int {
func sayHello() {
print("Hello, I'm \(self)")
}
}
1.sayHello() // outputs: "Hello, I'm 1"
Everything Is an Object? | 5
Other documents randomly have
different content
The Project Gutenberg eBook of Atchoo! Sneezes from a Hilarious
Vaudevillian
This ebook is for the use of anyone anywhere in the United States and most other parts of the
world at no cost and with almost no restrictions whatsoever. You may copy it, give it away or re-use
it under the terms of the Project Gutenberg License included with this ebook or online at
www.gutenberg.org. If you are not located in the United States, you will have to check the laws of
the country where you are located before using this eBook.
Language: English
Credits: E-text prepared by Demian Katz and the Online Distributed Proofreading Team
(http://www.pgdp.net) from page images generously made available by Villanova
University Digital Library (http://digital.library.villanova.edu/)
*** START OF THE PROJECT GUTENBERG EBOOK ATCHOO! SNEEZES FROM A HILARIOUS
VAUDEVILLIAN ***
The Project Gutenberg eBook, Atchoo!, by George Niblo
Note: Images of the original pages are available through Villanova University Digital Library. See
http://digital.library.villanova.edu/Americana/Dime%20Novel/Street%20and%20Smith/StreetandS
07242dbb-24fe-42df-98f4-2b994c86e60a.xml
"ATCHOO!"
Sneezes from a Hilarious Vaudevillian
BY
GEORGE NIBLO
STREET & SMITH - PUBLISHERS - NEW YORK
ATCHOO!
Sneezes from a Hilarious Vaudevillian
BY
GEORGE NIBLO
NEW YORK
STREET & SMITH, Publishers
238 William Street
Copyright, 1903
Atchoo!
ATCHOO!
Fellow citizens!—I beg pardon, I mean ladies and gentlemen! You see I've just
come from a political meeting, and that sort of thing gets on your nerves. I went
to hear my friend Isaacstein talk. His subject was "Why should the Jew have to
work?"
They did a lot of whitewashing at that meeting. I suppose it's all right. Of course
you can't make a new fence with a pail of whitewash, but you can cover up the
mothholes.
But we mustn't be too hard on the politicians. If it wasn't for politics a good many
fellows that are too lazy to earn a living with their hands would be paupers. But
some of 'em are all right. There's Isaacstein for instance. As good a man as ever
sauntered down Hester Street. He joined the noble army of grafters two years ago
and worked so hard at his profession that he got appendicitis.
A friend of Isaacstein's met another acquaintance of his in Hester Street and
asked:
"Haf you heard aboudt Isaacstein?"
"No. Vat iss it?"
"He vas sick. They take him by der hospital, and vat you tink they do to him?"
"Vell. Vell. Vat iss it?"
"They put him in a room all by himself und take his appendix away from him."
"Na! Na! Na! Vat a pity, ain't it, he didn't have it in his wife's name?"
Why, I was taken sick myself lately—such thing will happen even in the best
regulated families, you know.
While I was on my way here there was a fire down in one of those thickly populated streets where
twenty families and more live, like sardines, in a tenement. The fire engine came booming along, and as
usual created tremendous excitement.
I noticed a small chap on a bicycle riding zigzag in front of the machine, evidently anxious to keep up
with it and get to the fire in time to watch it begin work.
Half a dozen times the driver had to pull up suddenly to avoid running over the nervy little Hebrew, and
this of course made the firemen riding with the machine furious.
Just in front of where I was standing one of the gallant life savers jumped down from the engine,
caught hold of the boy and pulled him off to one side, at the same time saying:
"You miserable little Sheeney, you ought to be arrested for getting in the way! I've a good mind to
spank you."
The boy looked at the fireman in surprise and whimpered:
"If it wasn't for the Jews you wouldn't have anything to do."
I often squander an hour or two down in Hester
Street, where I have some rare acquaintances among
the second-hand dealers.
Of course you understand that I only go there to
study human nature, and I remember some months
ago being delightfully entertained at a Jewish
wedding, where my esteemed friend Moses
Schaumburg gave his cherished Rebecca into the
keeping of young Silverstein, a progressive Broadway
salesman.
This fact was brought to my mind when, only the
other day I saw the bridegroom rush into his father-
in-law's establishment bearing a look of excitement, and also a few very positive scratches upon his
olive face, and exclaiming dramatically:
"Mister Schaumburg, I vants you to dake back your daughter Rebecca."
The old man threw up his hands.
"I dakes not dot Repecca back. Ven a man comes to my house, picks out
himself a piece of goots, and dot goots vas received by him in goot order, I
vould be a fool to dake pack dot goods. No, sir, you schoost keep dot
Repecca."
My brother Tom was hit on the head some time ago,
and at the hospital they said they would have to
amputate half his brain. I didn't want them to,
because he is absent-minded anyway.
"We'll have to give him something to make him sleep,"
said one of the surgeons.
"That won't be necessary," said another; "he's a policeman."
That made Tom sore, and he snapped: "I've got half a mind to cave in your
ribs for you."
"You won't feel that way in a minute," said the surgeon, "because that's the
half of your mind we're going to cut out."
It was a great operation. When I told my wife of the surgeon's little joke and
how Tom came back at him she said she never knew a time when Tom wasn't
ready to give anybody a piece of his mind.
Tom was a confirmed dyspeptic, too, and when the operator was taking an X-ray photograph of the seat
of his troubles, this waggish brother of mine, with a ghastly attempt to be facetious, said:
"This, I suppose, is what might be called taking light exercise on an empty stomach."
Perhaps it may surprise you to hear me say that some years ago I was
connected with the newspaper business.
I don't tell this to everybody, you know, but there are some little things
connected with my experience that drive away the blues in these times when
the ghost refuses to walk regularly on pay day.
It was out in old Kaintuck, the Blue Grass country famous for its fast horses,
fair women and old Bourbon.
Say, have you ever been in the land of Daniel Boone and Davy Crockett, the
original Tennessee Congressmen?
You don't know what you've missed then—grand scenery, splendid cooking, and the most original
people in the mountains, where they make that moonshine whiskey you've heard about.
I used to hustle right lively looking for news, and during the course of my
journeyings I ran across a grizzled old farmer from the back settlements, who
looked like he might be a good judge of double distilled mountain dew that had
paid no revenue to Uncle Sam.
Of course I tackled him right away, and first lining him up in the tap-room of
the tavern, asked what news there might be up in his section, for it was a
warm corner of the State, and could usually be depended on for some lively
incidents during the week.
His answer rather disappointed me at first.
"They ain't nothin' doin' up our way," he said, "'cause we're all too busy with
our crops to bother about anything else. All quiet in our neighborhood for
sartin."
"Pretty good crops this year?" I inquired.
"Bully," says he. "I ought to be in my field this minute, an' I would be if I hadn't come to town to see
the coroner."
"The coroner?" I began to feel interested, because you know there's only one kind of harvest that needs
a coroner.
"Yep. Want him to hold an inquest on a couple of fellers down in our neighborhood."
"Inquest? Was it an accident?"
"Nope. Zeke Burke did it a-puppus. Plugged George Rambo and his boy Bill
with a pistol. Got to have an inquest."
"What caused the fight?"
"There wasn't no fight. Zeke never give the other fellers a show. Guess he was
right, too, 'cause the Rambos didn't give Zeke's father an' brother any chance.
Just hid behind a tree and fired at 'em as they came along the road. That was
yistiday mornin', an' in an hour Zeke had squared accounts."
"Has Zeke been arrested?"
"Nope. What's the use? Some of old man Rambo's relatives came along last
night, burned down Zeke's house, shot him an' his wife, an' set fire to his barn.
Nope, Zeke hasn't been arrested. But I ain't got time to talk to you. Have to git
back to my harvestin'. But there ain't no news down our way. If anythin'
happens I'll let ye know."
One of my best friends down there was an old judge who knew more about whiskey than he did about
law. One day a young lawyer came to town and hung up his shingle.
Up to that day the judge had been the only member of the legal fraternity there.
Old Si Corntassle, a close-fisted farmer, sizing up the situation, thought it a good chance to corner some
legal advice without cost, so he hastened to call upon the young man, told him he was very glad he had
come into the town, as the old judge was getting superannuated, and then contrived in a sort of
neighborly talk to get some legal questions answered.
Then thanking the young sprig of the bar, he put on his hat and was about to leave, when the lawyer
asked him if he should charge the advice, for which the fee was five dollars.
The old fellow went into a violent passion and swore he never would pay, but the young lawyer told him
he would sue him if he didn't.
So old Si trotted down to see the
judge, found him hoeing in his
garden, and said:
"That young scamp that's just
come into town! I dropped in to
make a neighborly call on him and
he charged me five dollars for legal
advice."
"Served you right," said the judge,
who sized up the situation, and
saw a chance to pay off an old
score; "you had no business to have gone to him."
"But have I got to pay it, judge?"
"Of course you have."
"Well, then," said the man, "I suppose I must," and he started off.
"Hold on!" said the judge; "aren't you going to pay me?"
"Pay you? What for?" said old Si.
"For legal advice."
"What do you charge?"
"Ten dollars."
And consequently as old Si had to settle with both he rather overreached himself in the transaction.
Some of you people doubtless find benefit in visiting the country, but I imagine Snellbaker, who has a
gents' furnishing-goods emporium on the corner of a Brooklyn Street, rather carries off the prize in a
profitable trip.
I met him the other day, well sunburned, and with a twinkle in his eye.
"I say, Mr. Niblo, did you hear about my luck?" he asked, slapping me on the
shoulder.
"Why, no, what's happened now?" I replied, wondering if he had drawn the
grand prize in a lottery, or if his children had the measles.
"Well, you know when I went away to the country, I
only took my five children and I brought ten home with
me."
"How was that?" I asked, in surprise.
"Well, they ate green apples and got doubled up."
Singular what queer things do happen on the electric
cars of a great metropolis. The other day I was riding
down to the City Hall in a pretty crowded car when something happened.
All the other passengers in the car were men except one; and she was a girl, a
nice, pretty, young thing of that peculiar pinkish clarity of complexion more
commonly designated "peaches and cream."
The conductor had just collected her fare and was proceeding on his way to the rear platform when the
girl grabbed at the left arm of her jacket and emitted a gaspy little scream.
"What is it, miss?" asked the conductor.
"Oh, what shall I do?" moaned the girl. "I've lost it! I've lost my Yale pin!"
And she looked as if she would topple over on the man next to her. The
conductor stooped and looked about the floor of the car. All of us passengers
did the same. The pretty young thing shook out her skirts vigorously. All hands
lent their aid to lift up the gratings and to search the space beneath them.
There was, however, no signs of the cherished emblem. About the time
everybody was beginning to feel exhausted the girl suddenly exclaimed:
"Oh, I remember now! It's all right. Don't bother any more. I gave it back last
night."
"City Hall!" yelled the conductor, and I was glad to get off.
Last time I rode in a trolley car I got a scare for sure. Honestly now, it gave me
a queer feeling up and down my spine when I noticed that the car number was
1313, and what made it worse we were just passing Thirteenth Street at the
time.
I thought I would mention the fact to the conductor, especially when upon counting the passengers I
found there were just that fatal number aboard.
It was the thirteenth of the month too, and bless you if that conductor's number wasn't just 3913.
So I grimly paraded these significant facts before the attention of the knight of the fare register.
"I should think it would make you nervous!" I remarked.
"Only once't that I remember," said the conductor, with a grin.
"When and how?"
"There was thirteen babies in this here car yellin' in thirteen different keys all
at the same time," replied the conductor.
Some people are so superstitious, you know, always carrying home old
horseshoes and nailing them up over the door—why, a pagan nation like the
Japanese have the same custom with other embellishments.
The fun of it is, while some stoutly maintain the horseshoe must be nailed with
the forks pointing upward, there are others just as set in their belief that if a
chap wants real good luck to swoop down upon his domicile it is absolutely
imperative that the opening must be left below.
Why Ketcham actually grew hot under the collar the
other day because I sneered when he chanced to
mention what horrible bad fortune had come to him since his propitiation to
the gods was stolen from his barn door by a wandering dago junk-man.
"Don't you believe then that there's good luck in finding a horseshoe?" he
demanded, fiercely.
"Why, yes, under certain conditions," I replied; "for instance when you find it
on the winning horse."
Ketcham is quite a gay fellow, and a member of many clubs, so that he can
seldom be found home of an evening.
I once remonstrated with him, as a true friend should.
"See here," I said, seriously, "you are out every night until the 'wee sma' hours.' Isn't midnight late
enough for you?"
"Well," he replied, "I find when I show up at midnight my wife can talk to me, but when I get home at
three, words fail her."
Say, my wife came home from shopping the other day filled with righteous
indignation, and, of course, while men are not supposed to have any curiosity,
you know, my peace of mind was somewhat disturbed.
I began to have vague fears that perhaps some miserable detective in one of
the department stores might have insulted her—perhaps accused her of having
too warm an affection for the lace counter.
At length, however, seeing that I would not ask the question she was burning
to hear, she burst out with:
"I wish the shopkeepers would be more careful how they put mirrors in
conspicuous places."
"What's the matter? Been trying to dodge your own reflection?" I asked, for do
you know it was the first time I had ever heard a woman complain of too much looking-glass.
"No; but you know there is one of those triple mirrors in one of the department
stores, and poor dear Fido spent fifteen minutes chasing around it trying to
find the other dog. I thought I'd never get him out of that store."
Ever been through the Chinese quarter down around Mott Street, where you
can smell the incense of the joss-sticks burning before the ugly little idols?
I saw in the paper the other day about a fellow who
had come from Korea with samples of idols that he
wanted an American firm to manufacture, and it
begins to look as though presently our enterprising
Yankees might corral this trade along with everything
else.
That gave me an inspiration which I set down in verse—if you'd like to hear the
result I don't mind one bit, so prepare to weep, for here it goes:
No seven-handed figures;
No gods with coiling tails:
No birds, no bugs, no serpents,
No animals, nor whales—
No, sir! He'll have our idols:
A shovelful of coal,
A meter, and an oil can
To terrify his soul.
Mr. Carboline, our druggist at the corner, has troubles of his own, though I never realized the fact until I
saw a perspiring individual rush in upon him with a thermometer in his hand the other day, and in an
excited tone exclaim:
"Here, take back this darned machine before I freeze to death."
He looked so heated just then that we began to imagine he must be a little out
of his mind, but Carboline ventured to ask humbly enough what was the
matter with the mercury register.
"It's out of whack somehow, and won't register correctly. Darn it, I've been
shivering in my room for a week, and just couldn't keep warm. I had the
thermometer over my writing desk, and the other morning when the steam
went down a little I looked at the mercury. It showed forty degrees.
"I knew nothing less than a polar bear could work in that temperature, and
went hustling after the janitor.
"He shook up his furnace, and the steam began to sizzle, but the room
wouldn't get warm enough to raise that mercury above 50.
"We ran short of coal for a day, and she went down to 40 again, and I went over to stop with a friend
till we got more coal.
"Then the steam sizzled once more, but the north wind seemed to come in through the window cracks
and the shivers had me all over.
"I struck for window strips, and had a row with the landlord.
"The mercury showed 50 degrees right along, and though I made it hot for the janitor I couldn't get any
of it into the blamed thermometer.
"Yesterday I gave notice that I would get out if they didn't keep me warm. I'm a bachelor tenant paying
a good price and generally no kicker, and they didn't want me to leave.
"About an hour ago the janitor came in to see how I was getting along.
"He found me at my desk with a blanket around me. He asked if I were sick. I told him I was frozen.
"He said he thought the room was very warm. Before licking him I showed him the thermometer and
told him that was the real test.
"The mercury stood at 50.
"The janitor swore and went out.
"He came back in a minute with another thermometer and hung it alongside of
mine. It was a fine one, guaranteed to keep perfect records.
"It marked 65 degrees when he brought it in, and in a minute or two it showed
71. Mine stood still at 50.
"The janitor looked at the two machines and began to grin. I began to unwind
the blanket that was around me. The janitor looked scared, but I told him not
to run; that I wasn't going to lick him. The only man that I felt like licking was
the one who sold me a thermometer that wouldn't go.
"You're the one.
"Now, it's up to you to apologize, give me a machine that is true, or be licked. I've paid my money and
you can take your choice."
Mr. Carboline preferred to make the change.
By the way, before I forget it, let me tell you about young Charlie Suitz, a friend of mine, who is really
as modest a chap as you would care to meet.
Charlie has a girl upon whom he calls very frequently, and, they tell me, at the most unexpected times.
That was probably how it happened he dropped in one afternoon and was informed by her mother that
she was upstairs taking a bath, so he told the old lady he only wanted to speak to her for a minute; and
she called out:
"Mamie, come right down, Mr. Suitz wants to see you down here."
So Mamie called back, "Oh, mother, I can't; I have nothing on."
"Well, slip on something right away, and come down."
And what do you think? Mamie slipped on the stairs, and came down.
Talking of your level-headed young Lochinvars of to-day, who use automobiles in their elopements
instead of horses as in the old times, there was Charlie's brother who fell in love with the only daughter
of old Squeezer, the richest skinflint in Stringtown, and was bound to have her, even if he had to resort
to strategy.
"Oh, Bob," she whispered, sliding down into the outstretched arms of the lover
who stood at the bottom of the ladder, "are you sure the coast is clear?"
"To a dead certainty," he replied, bitterly. "I succeeded in boring a hole in the
water pipe. Your father has discovered it, and will keep his finger over the hole
until the plumber arrives. Come!"
I dined at the Waldorf the other night, and somehow in the long list of courses
found my mind wrestling with an item that had caught my eye in one of the
yellow sheets, where a certain well-known doctor declared that the simple
cooking of savage tribes was far superior to that of the present civilized races.
When I reached home the thought, and perhaps the menu I had so gallantly
assailed, so impressed me, that I sat down and rattled off a few verses
covering the ground. This is how the song goes:
Our website is not just a platform for buying books, but a bridge
connecting readers to the timeless values of culture and wisdom. With
an elegant, user-friendly interface and an intelligent search system,
we are committed to providing a quick and convenient shopping
experience. Additionally, our special promotions and home delivery
services ensure that you save time and fully enjoy the joy of reading.
textbookfull.com