Obscure Topics In Cocoa Objectivec Mattt Thompson pdf download
Obscure Topics In Cocoa Objectivec Mattt Thompson pdf download
Thompson download
https://ebookbell.com/product/obscure-topics-in-cocoa-objectivec-
mattt-thompson-37518952
https://ebookbell.com/product/nshipster-obscure-topics-in-cocoa-
objective-c-thompson-mattt-36752360
https://ebookbell.com/product/nshipster-obscure-topics-in-cocoa-
objective-c-thompson-mattt-chenjin5com-36752362
https://ebookbell.com/product/obscure-invitations-the-persistence-of-
the-author-in-twentiethcentury-american-literature-benjamin-
widiss-51932698
https://ebookbell.com/product/obscure-locks-simple-keys-the-annotated-
watt-chris-ackerley-51969942
Obscure Hands Trusted Men Textualization The Office Of The City Scribe
And The Written Management Of Information And Communication Of The
Council Of Reval Tallinn Before 1460 Tapio Salminen
https://ebookbell.com/product/obscure-hands-trusted-men-
textualization-the-office-of-the-city-scribe-and-the-written-
management-of-information-and-communication-of-the-council-of-reval-
tallinn-before-1460-tapio-salminen-36441432
https://ebookbell.com/product/obscure-objects-of-desire-surrealism-
fetishism-and-politics-new-johanna-malt-12261758
https://ebookbell.com/product/obscure-krista-walsh-48726246
Obscure Locks Simple Keys The Annotated Watt 1st Edition Chris
Ackerley
https://ebookbell.com/product/obscure-locks-simple-keys-the-annotated-
watt-1st-edition-chris-ackerley-11332606
https://ebookbell.com/product/obscure-mosaic-chronicles-book-seven-
pearson-andrea-pearson-23978426
first edition
nshipster
NS
obscure topics
in cocoa &
objective-c
mattt thompson
!
Mattt Thompson
NSHipster: Obscure
Topics In Cocoa &
Objective-C
!
!
!
!
!
!
!
!
!
!
!
!
Copyright © 2013 Mattt Thompson
All rights reserved
ISBN 978-0-9912182-1-9
NSHipster
Portland, Oregon
http://nshipster.com
Table of Contents
Objective-C 10
#pragma 11
nil / Nil /
NULL / NSNull 16
BOOL / bool /
Boolean / NSCFBoolean 20
Equality 24
Type Encodings 35
C Storage Classes 41
@ 47
__attribute__ 61
instancetype 71
NS_ENUM &
NS_OPTIONS 74
Foundation &
CoreFoundation 79
Key-Value Coding
Collection Operators 80
Key-Value Observing 86
NSError 99
NSOperation 108
NSSortDescriptor 115
NSPredicate 120
NSExpression 133
NSFileManager 141
NSValue 153
NSValueTransformer 156
NSDataDetector 160
CFBag 166
NSCache 171
NSIndexSet 174
NSOrderedSet 176
NSHashTable &
NSMapTable 181
UIKit 188
UIMenuController 189
UILocalizedIndexedCollation 197
UIAppearance 204
Localization,
Internationalization &
Accessibility 209
NSLocale 210
NSLocalizedString 217
UIAccessibility 222
NSFormatter 232
CFStringTransform 241
NSLinguisticTagger 246
9
Objective-C
10
#pragma
11
Good habits start with #pragma mark:
@implementation ViewController
- (id)init {
...
}
#pragma mark - UIViewController
- (void)viewDidLoad {
...
}
#pragma mark - IBAction
- (IBAction)cancel:(id)sender {
...
}
#pragma mark - UITableViewDataSource
- (NSInteger)tableView:(UITableView *)tableView
numberOfRowsInSection:(NSInteger)section
{
}
#pragma mark - UITableViewDelegate
- (void)tableView:(UITableView *)tableView
didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
...
}
12
#pragma mark declarations starting with a dash (-) are preceded
with a horizontal divider.
Inhibiting Warnings
What's even more annoying than poorly-formatted code?
Code that generates warnings. Especially 3rd-party code.
There are few things as irksome as that one vendor library that
takes forever to compile, and finishes with 200+ warnings.
Even shipping code with a single warning is in poor form.
13
Try setting the -Weverything flag and checking the "Treat Warnings
as Errors" box your build settings.
This turns on Hard Mode in Xcode.
14
You can read more about the LLVM's use of #pragma in the Clang
Compiler User's Manual.
Like a thrift store 8-track player turned into that lamp in the
foyer, #pragma remains a curious vestige of the past: Once the
secret language of compilers, it is now re-purposed to better-
communicate intent to other programmers.
15
nil / Nil /
NULL / NSNull
16
On the framework level, Foundation defines the NSNull class,
which defines a single class method, +null, which returns a
singleton NSNull instance. NSNull is different from nil or
NULL, in that it is an actual object, rather than a zero value.
17
// For example, this expression...
if (name != nil && [name isEqualToString:@"Steve"])
{ ... }
!
// ...can be simplified to:
if ([name isEqualToString:@"steve"]) { ... }
18
NSMutableDictionary *mutableDictionary =
[NSMutableDictionary dictionary];
!
mutableDictionary[@"someKey"] = [NSNull null];
// Sets value of NSNull singleton for `someKey`
!
NSLog(@"Keys: %@", [mutableDictionary allKeys]);
// @[@"someKey"]
!
So to recap, here are the four values representing nothing that
every Objective-C programmer should know about:
19
BOOL / bool /
Boolean /
NSCFBoolean
20
Boolean values are used in conditionals, such as if or while
statements, to conditionally perform logic or repeat
execution. When evaluating a conditional statement, the value
0 is considered "false", while any other value is considered
"true". Because NULL and nil have a value of 0, they are
considered "false" as well.
21
However, because BOOL is typedef 'd as a signed char on 32-
bit architectures, this will not behave as expected:
The answer:
__NSCFBoolean
Wait, what?
22
All this time, we've been led to believe that NSNumber boxes
primitives into an object representation. Any other integer or
float derived NSNumber object shows its class to be
__NSCFNumber. What gives?
!
Wrapping things up, here is a table with the truth types and
values in Objective-C:
23
Equality
24
Two objects may be equal or equivalent to one another, if they
share a common set of properties. Yet, those two objects may
still be thought to be distinct, each with their own identity.
isEqual
Subclasses of NSObject implementing their own isEqual:
method are expected to do the following:
25
For container classes like NSArray, NSDictionary, and
NSString, equality deep equality comparison, testing equality
for each member in pairwise fashion:
!
26
isEqualTo____:
The following NSObject subclasses in Foundation have
custom equality implementations, with the corresponding
method:
NSAttributedString -isEqualToAttributedString:
NSData -isEqualToData:
NSDate -isEqualToDate:
NSDictionary -isEqualToDictionary:
NSHashTable -isEqualToHashTable:
NSIndexSet -isEqualToIndexSet:
NSNumber -isEqualToNumber:
NSOrderedSet -isEqualToOrderedSet:
NSSet -isEqualToSet:
NSString -isEqualToString:
NSTimeZone -isEqualToTimeZone:
NSValue -isEqualToValue:
27
The Curious Case of NSString Equality
As an interesting aside, consider the following:
NSString *a = @"Hello";
NSString *b = @"Hello";
BOOL wtf = (a == b); // YES (!)
So what's going on here? Why does this work, when the same
code for NSArray or NSDictionary literals wouldn't do this?
28
Hashing
The primary use case of object equality tests for object-
oriented programming is to determine collection
membership. To keep this fast, subclasses with custom
equality implementations are expected to implement hash:
• However, the converse does not hold: two objects need not
be equal in order for their hash values to be equal
([a hash] == [b hash] ¬ [a isEqual:b])
Hashing Fundamentals
A hash table is a fundamental data structure in programming,
and it's what enables NSSet & NSDictionary to have fast
(O(1)) lookup of elements.
29
Arrays store elements in sequential indexes, such that an
Array of size n will have slots at positions 0, 1, up to n - 1. To
determine where an element is stored in the array (if at all),
each position would have to be checked one-by-one (unless
the array happens to be sorted, but that's another story).
30
The trick is in determining the critical values of an object.
31
Person.h
@interface Person
@property NSString *name;
@property NSDate *birthday;
!
- (BOOL)isEqualToPerson:(Person *)person;
@end
Person.m
@implementation Person
- (BOOL)isEqualToPerson:(Person *)person {
if (!person) {
return NO;
}
!
BOOL haveEqualNames = (!self.name && !person.name) ||
[self.name isEqualToString:person.name];
BOOL haveEqualBirthdays =
(!self.birthday && !person.birthday) ||
[self.birthday isEqualToDate:person.birthday];
32
#pragma mark - NSObject
!
- (BOOL)isEqual:(id)object {
if (self == object) {
return YES;
}
!
if (![object isKindOfClass:[Person class]]) {
return NO;
}
!
return [self isEqualToPerson:(Person *)object];
}
- (NSUInteger)hash {
return [self.name hash] ^ [self.birthday hash];
}
@end
Don't Overthink It
While all of this has been an interesting exercise in
epistemology and computer science, there is one lingering
pragmatic detail:
33
Take, for instance, the previous example of the Person class.
It's not inconceivable that two individuals would share a
common name and birthday. In reality, this crisis of identity
would be resolved by additional information, whether it's a
system-dependent identifier like a Social Security Number,
their parents' identities, or any other physical attributes.
!
Hopefully, after all of this explanation, we all stand with equal
footing on this slippery subject.
34
Type Encodings
!
@encode, one of the @ Compiler Directives, returns a C string
that encodes the internal representation of a given type, for
example, @encode(int) → i. This is similar to the ANSI C
typeof operator.
35
Code Meaning
c A char
i An int
s A short
q A long long
C An unsigned char
I An unsigned int
S An unsigned short
L An unsigned long
f A float
d A double
v A void
{name=type...} A structure
(name=type...) A union
36
Of course, charts are fine, but experimenting in code is even
better:
37
Result:
int : i
float : f
float * : ^f
char : c
char * : *
BOOL : c
void : v
void * : ^v
!
NSObject * : @
NSObject : #
[NSObject] : {NSObject=#}
NSError ** : ^@
!
int[] : [5i]
float[] : [3f]
struct : {_struct=sqQ}
38
• Passing NSObject directly yields #. However, passing
[NSObject class] yields a struct named NSObject with a
single class field. That is, of course, the isa field, which all
NSObject instances have to signify their type.
Method Encodings
As mentioned in Apple's "Objective-C Runtime
Programming Guide", there are a handful of type encodings
that are used internally, but cannot be returned with @encode.
Code Meaning
r const
n in
N inout
o out
O bycopy
R byref
V oneway
39
Although it has fallen out of fashion in the age of iOS, DO is
an interprocess messaging protocol used to communicate
between Cocoa applications. Under these constraints, there
were benefits to be had from the additional context.
!
So what do we gain from our newfound understanding of
Objective-C Type Encodings? Honestly, not that much.
40
C Storage Classes
auto
There's a good chance you've never seen this keyword in the
wild. That's because auto is the default storage class, and
therefore rarely needs to be specified explicitly.
41
register
Most Objective-C programmers probably aren't familiar with
register either, as it's not widely used in the NS world.
static
Finally, one that everyone's sure to recognize: static.
42
1. A static variable inside a method or function retains its
value between invocations.
Static Singletons
A common pattern in Objective-C is the static singleton,
wherein a statically-declared variable is initialized and
returned in either a function or class method:
+ (instancetype)sharedInstance {
static id _sharedInstance = nil;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
_sharedInstance = [[self alloc] init];
// any further configuration
});
!
return _sharedInstance;
}
43
extern
Whereas static makes functions and variables globally visible
within a particular file, extern makes them visible globally to
all files.
That said, there are two common and practical uses for extern
in Objective-C: constants and public functions.
AppDelegate.h
44
AppDelegate.m
Public Functions
Some APIs may wish to expose helper functions publicly. The
pattern follows the same as in the previous example:
TransactionStateMachine.h
45
TransactionStateMachine.m
NSString *
NSStringFromTransactionState(TransactionState state) {
switch (state) {
case TransactionOpened: return @"Opened"
case TransactionPending: return @"Pending";
case TransactionClosed: return @"Closed";
default: return nil;
}
}
46
@
Perl, with all of its short variable names and special characters,
reads like Q*bert swearing.
)))))
)))
))
)))) ))
)))) ))
)))
)
!
47
So if one were to go code-watching for the elusive Objective-
C species, what would we look for?
• Square brackets
• Ridiculously-long method names
• @'s
Its uses are varied and disparate, such that the only way to
accurately describe what @ means by itself is "shorthand for
something to do with Objective-C". @ compiler directives
cover a broad range in usefulness and obscurity, with staples
like @interface and @implementation, as well as ones a
developer go their whole career without running into, like
@defs and @compatibility_alias.
48
Interface & Implementation
@interface and @implementation are the first things you
learn about when you start Objective-C:
• @interface...@end
• @implementation...@end
What you don't learn about until later on, are categories and
class extensions.
MyObject+CategoryName.h
49
MyObject+CategoryName.m
Rather than littering your code with random, arbitrary color values,
create an NSColor / UIColor category that defines class methods like
+appNameDarkGrayColor. You can then add a semantic layer on
top of that by creating method aliases like +appNameTextColor,
which returns +appNameDarkGrayColor.
50
Another Random Scribd Document
with Unrelated Content
Returning now to the terrace below, common to both Mashonganavi
and Shipauluvi, the trail is descended to Shungopavi. A deep canyon
separates the mesa upon which this village is built from the one
upon which the two former are located. Near the foot of the trail the
government has established a schoolhouse, and close by are the
springs and pools of water. It is a sandy ride or walk, and on a hot
day—"a-tu-u-u"—wearisome and exhausting. For half a dollar or so
one may hire a burro and his owner as guide, and it is much easier
to go burro-back over the yielding sand than to walk. There are
straggling peach trees on the way, and a trail, rocky and steep, to
ascend ere we see Shungopavi.
The wagons may be driven to the village (as mine were), but it is a
long way around. The road to Oraibi across the mesa is taken, and
when about half-way across a crude road is followed which runs out
upon the "finger tip" where Shungopavi stands. Here the governor in
1901 was Lo-ma-win-i, and he and I became very good friends.
Knowing my interest in the Snake Dance, he sent for the chief
priests of the Snake and Antelope Clans (Kai-wan-i-wi-ya-ŭ-má and
Lo-ma-ho-in-i-wa), and from them I received a cordial invitation to
be present and participate in the secret ceremonials of the kiva at
their next celebration. I have been privileged to be present, but was
never invited before.
The governor is an expert silversmith, the necklace he wears being a
specimen of his own art. It is wonderful how, with their crude
materials and tools, such excellent work can be produced. Mexican
dollars are melted in a tiny home-made crucible, rude moulds are
carved out of sand—or other stone into which the melted metal is
poured, and then hand manipulation, hammering, and brazing
complete the work. Their silver articles of adornment are finger
rings, bracelets, and necklaces.
Oraibi is the most western and conservative of the Hopi villages. It is
by far the largest, having perhaps a third of the whole population. It
is divided into two factions, the so-called hostiles and friendlies, the
former being the conservative element, determined not to forsake
"the ways of the old," the ways of their ancestors; and the latter
being generally willing to obey orders ostensibly issued by
"Wasintonia"—as they call the mysterious Indian Department. These
divisions are a source of great sorrow to the former leaders of the
village. In the introduction to "The Oraibi Soyal Ceremony" by
Professor George A. Dorsey, of the Field Columbian Museum, and
Rev. H. R. Voth, his assistant, and formerly a Mennonite missionary
at Oraibi, this dissension is spoken of as follows: "During the year
1891 representatives of the Indian Department made strenuous
efforts to secure pupils for the government school located at Keam's
Canyon, about forty miles from Oraibi. This effort on the part of the
government was bitterly resented by a certain faction of the people
of Oraibi, who seceded from Lolúlomai, the village chief, and soon
after began to recognize Lomahungyoma as leader. The feeling on
the part of this faction against the party under Lolúlomai was further
intensified by the friendly attitude the Liberals took toward other
undertakings of the government, such as allotment of land in
severalty, the building of dwelling-houses at the foot of the mesa,
the gratuitous distribution of American clothing, agricultural
implements, etc. The division thus created manifested itself not only
in the everyday life of the people, but also in their religious
ceremonies. Inasmuch as the altars and their accessories are the
chief elements in these ceremonies, they soon became the special
object of controversy, each party contending for their possession;
and so it came about that the altars remained to that faction to
which the chief priests and those who had them in charge belonged,
the members of the opposing faction, as a rule, withdrawing from
further participation in the celebration of the ceremony."
The dance plaza is on the western side of the village, and there the
dances and other outdoor ceremonies take place.
One of my earliest visits to Oraibi was made in the congenial
company of Major Constant Williams, who was then the United
States Indian Agent, at Fort Defiance, for the Navahoes and Hopis.
We had driven across the Navaho Reservation from Fort Defiance to
Keam's Canyon, and then visited the mesas in succession. We drove
to the summit of the Oraibi mesa in his buckboard, a new
conveyance which he had had made to order at Durango, Colo. The
road was the same one up which the soldiers had helped the horses
drag the Gatling gun at the time of the arrest of the so-called
"hostiles," who were sent to Alcatraz for their refusal to forsake their
Oraibi ways and follow the "Washington way." It was a steep, ugly
road, rough, rocky, and dangerous. The Major's horses, however,
were strong, intelligent, and willing, so we made the ascent with
comparative ease. The return, however, was different. There were so
many things of interest at Oraibi that I found it hard to tear myself
away, and the "shades of night were falling fast"—far too fast for the
Major's peace of mind—ere I returned to the buckboard. By the time
we had traversed the summit of the mesa to the head of the "trail"
part of the descent, it was dark enough to make the cold tremors
perambulate up and down one's spine. But I had every confidence in
the Major's driving, his horses, and his knowledge of that fearfully
precipitous and dangerous road. Slowly we descended, the brake
scraping and often entirely holding the wheels. We could see and
feel the dark abysses, first on one side and then on the other, or feel
the overshadowing of the mighty rock walls which towered above us.
I was congratulating myself that we had passed all the dangerous
places, and in a few moments should be on the drifted sand, which,
though steep, was perfectly safe, when we came to the last "drop
off." This can best be imagined by calling it what it was, a steep,
rocky stairway, of two or three steps, with a precipice on one side,
and a towering wall on the other. Hugging the wall, the upper step
extended like a shelf for eight or ten feet, and the nigh horse,
disliking to make the abrupt descent of the step, clung close to the
wall and walked along the shelf. The off horse dropped down. The
result can be imagined. One horse's feet were up at about the level
of the other's back. The wheels followed their respective horses. The
nigh wheels stayed on the shelf, the off wheels came down the step.
The Major and I decided, very suddenly, to leave the buckboard. We
were rudely toppled out, down the precipice on the left,—I at the
bottom of the heap. Down came camera cases, tripods, boxes of
plates, and all the packages of odds and ends I had bought from the
Indians, bouncing about our ears. Like a flash the two horses took
fright and started off, dragging that overturned buckboard after
them. They did not swirl around to the left down the sandy road, but
to the right upon a terrace of the rocky mesa, and we saw the
sparks fly as the ironwork of the wagon struck and restruck the
rocks. The noise and roar and clatter were terrific. Great rocks were
started to rolling, and the echoes were enough to awaken the dead.
Suddenly there was a louder crash than ever, and then all was silent.
We felt our hearts thumping against our ribs, and the only sounds
we could hear were their fierce beatings and our own hard
breathing. Fortunately, we had landed on a narrow shelf some seven
feet down, covered deep with sand, so neither of us was seriously
hurt except in our feelings; but imagine the dismay that swept aside
all thoughts of thankfulness for our narrow escape when that crash
and dread silence came. No doubt horses and buckboard were
precipitated over one of the cliffs and had all gone to "eternal
smash." My conscience made me feel especially culpable, for had I
not detained the Major we should have left the mesa long before it
was so dark. I had caused the disaster! It was nothing that I had
been "spilt out," that doubtless my cameras were smashed, and the
plates I had exposed with so much care and in spite of the
opposition of the Hopis were in tiny pieces—for I had clearly heard
that peculiar "smash" that spoke of broken glass as I myself landed
on the top of my head. Think of that span of fine horses, and the
Major's new buckboard! The thought about completed the work of
mental and physical paralysis the shock of falling had begun. I was
suddenly awakened, not by the Major's voice, for neither of us had
yet spoken a word,—and indeed, I didn't know but that he was
dead,—but by the scratching of a match. Then he was alive! That
was cause for thankfulness. Setting fire to a dried cactus, the Major,
after thoroughly picking himself up and shaking himself together,
proceeded to gather up the photographic débris. Silently I aided
him. Still silently we piled it all together, as much under the shelter
of the rocks as possible, and then, still without a word, we climbed
back upon the road and started to walk to the house of Mr. Voth, the
missionary, where we were stopping. For half a mile or more we
trudged on wearily through the deep and yielding sand. Still never a
word. We both breathed heavily, for the sand was dreadfully soft. I
was wondering what I could say. My conscience so overpowered me
that I dared not speak. I was humbling myself, inwardly, into the
very dust for having been the unconscious and innocent, yet
nevertheless actual cause of this disaster. I simply couldn't break the
silence. To offer to pay for the horses and buckboard was easy
(though that would be a serious matter to my slender purse)
compared with appeasing the sturdy Major for the shock to his
mental and physical system. Then, too, how he must feel! At the
very thought the cold sweat started on my brow and I could feel it
trickling down my chest and back.
An Oraibi Basket Weaver.
An Admiring Hopi Mother.
Suddenly the Major stopped, and in the darkness I could dimly see
him take out his large white handkerchief, mop his brow and head,
and then, with explosive force, but in a voice charged with deepest
and sincerest feeling he broke the painful silence: "Thank God, the
sun isn't shining."
Brave-hearted, generous Major Williams! Not a word of reproach, no
suggestion of blame. What a relief to my burdened soul. I was
almost hysterical in my ready response. Yes, we could be thankful
that our lives and limbs were spared. We were both unhurt. New
horses and buckboard could be purchased, but life and health
preserved called for thankfulness to the Divine Protector.
Thus we congratulated ourselves as we slowly plodded along
through the sand. Arrived at Mr. Voth's, we soon retired,—he in the
bedroom prepared for him by kindly Mrs. Voth, I in my blankets
outside. The calm face of the sky soon soothed my disquieted
feelings and nerves, and in a short time I fell asleep. Not a thought
disturbed me until just as the faintest peepings of dawn began to
show on the eastern ridges, when, awakening, I heard a noise as of
a horse shaking his harness close by. Like a flash I jumped up, and,
in my night-robe though I was, rushed to the entrance to the corral.
There, unharmed and uninjured, with harness upon them complete,
the lines dangling down behind, the neck yoke holding them
together, as if they were just brought from the stable ready to be
hitched to the wagon, were the two horses which I had vividly
pictured to myself as dashed to pieces upon the cruel rocks at the
foot of one of the mesa precipices.
I could scarcely refrain from shouting my joy. Hastily I dressed, and
while dressing thought: "The horses are here; I'll go and hunt for
the wagon." So noiselessly I hitched them to Mr. Voth's buckboard
and drove off. When I came to the scene of the disaster, I found I
could drive upon the rocky terrace. There was no difficulty in
following the course of the runaways. Here was part of the seat,
farther on some of the ironwork, and still farther the dashboard. At
last I reached the overturned and dismantled vehicle. It was in a
sorry state. Two of the wheels were completely dished, the seat and
dashboard were "scraped" off, one whiffletree was broken, and the
whole thing looked as if it had been rudely treated in a tornado. I
turned it over, tied the wheels so that they would hold, and then,
fastening it behind Mr. Voth's buckboard, slowly drove back to the
house.
When the Major awoke he was as much surprised and pleased as I
was to find the horses safe and sound and the buckboard in a
repairable condition. With a little manɶuvring we got the vehicle as
far as Keam's Canyon, where old Jack Tobin, the blacksmith, fixed it
up so that it could be driven back to Fort Defiance, and thither, with
care and caution, the Major drove me. A few weeks later, under the
healing powers of the agency blacksmith, the buckboard renewed its
youth,—new wheels, new seat, new dashboard, and an all covering
new coat of paint wiped out the memories of our trip down from the
Oraibi mesa, except those we carried in the depths of our own
consciousness.
CHAPTER V
A FEW HOPI CUSTOMS
The Hopi uses a weapon for catching rabbits which, for want of a
better name, white men call a boomerang. It possesses none of the
strange properties of the Australian weapon, yet in the hands of a
skilled Hopi it is wonderfully effective. I have seen fifty Oraibis on
horseback, and numbers of men and boys on foot, each armed with
one of these weapons, on their rabbit drive. They determine on a
certain area and then beat it thoroughly for rabbits, and woe be to
the unhappy cottontail or even lightning-legged jack-rabbit if a Hopi
throws his boomerang. Like the wind it speeds true to its aim and
seldom fails to kill or seriously wound.
Though most of the men have guns and many of the youths
revolvers, the bow and arrow as a weapon is not entirely discarded.
All the young boys, even little tots that can scarcely walk, use the
bow and arrow with dexterity. A small hard melon or pumpkin is
thrown into the air and a child will sometimes put two or even three
arrows into it before it reaches the ground. Old men who are too
poor to own modern weapons are often seen sitting like the
proverbial and oft-pictured fox, stealthily watching for a ground
squirrel, prairie-dog, or rat to come out of his hole, when the speedy
and certain arrow is let fly to his undoing.
Except for a little wild meat of this kind, secured seldom, or a sheep,
which is too valuable for its wool to kill on any except very special
and rare occasions, the Hopis are practically vegetarians. They are
not above taking what the gods send them, however, in the shape of
a dead horse. A few years ago Mr. D. M. Riordan, formerly of
Flagstaff, conducted a party of friends over a large section of the
region presented in these pages, and when near Oraibi a beautiful
mare of one of the teams suddenly bloated and speedily died. In
less than an hour after they were told they might take the flesh; the
Hopis had skinned it, cut up the carcass, and removed every shred
of it. I afterwards saw the flesh cut into strips, hung outside the
houses of the fortunate possessors to dry, and I doubt not that
horse meat made many a happy meal for them during the months
that followed.
ebookbell.com