100% found this document useful (1 vote)
6 views

Core Data by Tutorials iOS 8 and Swift Edition Aaron Douglas pdf download

Core Data by Tutorials is a comprehensive guide for iOS developers looking to learn about Core Data using Swift. The book covers fundamental concepts, practical applications, and advanced topics such as syncing with iCloud and performance optimization. It is designed for those with basic knowledge of iOS and Swift, providing hands-on tutorials to build a Core Data app from scratch.

Uploaded by

dhogaobiadi
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
6 views

Core Data by Tutorials iOS 8 and Swift Edition Aaron Douglas pdf download

Core Data by Tutorials is a comprehensive guide for iOS developers looking to learn about Core Data using Swift. The book covers fundamental concepts, practical applications, and advanced topics such as syncing with iCloud and performance optimization. It is designed for those with basic knowledge of iOS and Swift, providing hands-on tutorials to build a Core Data app from scratch.

Uploaded by

dhogaobiadi
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 59

Core Data by Tutorials iOS 8 and Swift Edition

Aaron Douglas pdf download

https://ebookfinal.com/download/core-data-by-tutorials-ios-8-and-
swift-edition-aaron-douglas/

Explore and download more ebooks or textbooks


at ebookfinal.com
Here are some recommended products for you. Click the link to
download, or explore more at ebookfinal

Core Data in Swift Data Storage and Management for iOS and
OS X Marcus S. Zarra

https://ebookfinal.com/download/core-data-in-swift-data-storage-and-
management-for-ios-and-os-x-marcus-s-zarra/

iOS 8 Swift Programming Cookbook Solutions Examples for


iOS Apps 1st Edition Nahavandipoor

https://ebookfinal.com/download/ios-8-swift-programming-cookbook-
solutions-examples-for-ios-apps-1st-edition-nahavandipoor/

iOS 5 by Tutorials Volumes 1 and 2 2nd Edition Ray


Wenderlich

https://ebookfinal.com/download/ios-5-by-tutorials-
volumes-1-and-2-2nd-edition-ray-wenderlich/

Core Data Data Storage and Management for iOS OS X and


iCloud Second Edition Marcus S. Zarra

https://ebookfinal.com/download/core-data-data-storage-and-management-
for-ios-os-x-and-icloud-second-edition-marcus-s-zarra/
Introducing iOS 8 1st Edition Steve Derico

https://ebookfinal.com/download/introducing-ios-8-1st-edition-steve-
derico/

Learning iOS UI Development Implement complex iOS user


interfaces with ease using Swift 1st Edition D'Areglia

https://ebookfinal.com/download/learning-ios-ui-development-implement-
complex-ios-user-interfaces-with-ease-using-swift-1st-edition-
dareglia/

Swift Data Structure and Algorithms 1st Edition Azar

https://ebookfinal.com/download/swift-data-structure-and-
algorithms-1st-edition-azar/

Test Driven IOS Development with Swift 4 Third Edition


Dominik Hauser

https://ebookfinal.com/download/test-driven-ios-development-with-
swift-4-third-edition-dominik-hauser/

Learning Swift Building Apps for macOS iOS and Beyond 3rd
Edition Jonathon Manning

https://ebookfinal.com/download/learning-swift-building-apps-for-
macos-ios-and-beyond-3rd-edition-jonathon-manning/
Core Data by Tutorials iOS 8 and Swift Edition Aaron
Douglas Digital Instant Download
Author(s): Aaron Douglas, Saul Mora, Matthew Morey, Pietro Rea
ISBN(s): 9780989675192, 098967519X
File Details: PDF, 17.11 MB
Year: 2014
Language: english
Core Data by Tutorials
By the raywenderlich.com Tutorial Team

Aaron Douglas, Saul Mora,

Matthew Morey, and Pietro Rea

Copyright © 2013 Razeware LLC.

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 per- mission of the copyright owner.

This book and all corresponding materials (such as source code) are provided
on an "as is" basis, without warranty of any kind, express or implied, including
but not limited to the warranties of merchantability, fitness for a particular
purpose, and noninfringement. In no event shall the authors or copyright
holders be liable for any claim, damages or other liability, whether in action of
contract, tort or otherwise, arising from, out of or in connec- tion with the
software or the use or other dealings in the software.

All trademarks and registered trademarks appearing in this book are the
property of their respective owners.
Table of Contents: Overview
Introduction .............................................................................................. 9!
Chapter 1: Your First Core Data App ............................................. 15!
Chapter 2: NSManagedObject Subclasses .................................... 33!
Chapter 3: The Core Data Stack ...................................................... 58!
Chapter 4: Intermediate Fetching .................................................... 79!
Chapter 5: NSFetchedResultsController ........................................ 111!
Chapter 6: Versioning and Migration ........................................... 134!
Chapter 7: Syncing with iCloud ...................................................... 170!
Chapter 8: Unit Testing..................................................................... 188!
Chapter 9: Measuring and Boosting Performance...................... 204!
Chapter 10: Multiple Managed Object Contexts ....................... 236!
Conclusion ............................................................................................ 256!
Table of Contents: Extended
Introduction .............................................................................................. 9!
What you need ............................................................................................. 10!
Who this book is for ..................................................................................... 10!
How to use this book..................................................................................... 11!
What’s in store ............................................................................................... 11!
Source code and forums .............................................................................. 12!
Updates........................................................................................................... 12!
License ............................................................................................................. 13!
About the authors .......................................................................................... 13!
About the editors ........................................................................................... 14!
Chapter 1: Your First Core Data App ............................................. 15!
Getting started .............................................................................................. 15!
Modeling your data ..................................................................................... 23!
Saving to Core Data .................................................................................... 26!
Fetching from Core Data ............................................................................. 30!
Where to go from here? .............................................................................. 32!
Chapter 2: NSManagedObject Subclasses .................................... 33!
Getting started .............................................................................................. 33!
Modeling your data ..................................................................................... 36!
Storing non-standard data types in Core Data ...................................... 39!
Managed object subclasses ........................................................................ 40!
Propagating a managed context .............................................................. 44!
Data validation in Core Data ..................................................................... 53!
Tying everything up ...................................................................................... 56!
Where to go from here? .............................................................................. 57!
Chapter 3: The Core Data Stack ...................................................... 58!
Getting started .............................................................................................. 58!
The managed object model ........................................................................ 60!
The persistent store ....................................................................................... 60!
The persistent store coordinator ................................................................. 61!
The managed object context ...................................................................... 61!
Creating your stack object .......................................................................... 62!
Modeling your data ..................................................................................... 66!
Adding managed object subclasses .......................................................... 70!
A walk down persistence lane .................................................................... 71!
Deleting objects from Core Data ............................................................... 76!
Where to go from here? .............................................................................. 78!
Chapter 4: Intermediate Fetching .................................................... 79!
NSFetchRequest: the star of the show ....................................................... 79!
Introducing the Bubble Tea app................................................................. 80!
Stored fetch requests.................................................................................... 82!
Fetching different result types .................................................................... 87!
Sorting fetched results ................................................................................ 103!
Asynchronous fetching ................................................................................ 105!
Batch updates: no fetching required ....................................................... 108!
Where to go from here? ............................................................................ 110!
Chapter 5: NSFetchedResultsController ........................................ 111!
Introducing the World Cup app ............................................................... 111!
It all begins with a fetch request... ........................................................... 113!
Grouping results into sections.................................................................... 119!
“Cache” the ball .......................................................................................... 123!
Monitoring changes ..................................................................................... 124!
Inserting an underdog ................................................................................ 129!
Where to go from here? ............................................................................ 133!
Chapter 6: Versioning and Migration ........................................... 134!
When to migrate ......................................................................................... 134!
The migration process................................................................................. 135!
Getting started ............................................................................................ 136!
A lightweight migration .............................................................................. 137!
A manual migration .................................................................................... 146!
A complex mapping model ....................................................................... 153!
Migrating non-sequential versions ........................................................... 159!
Where to go from here? ............................................................................ 169!
Chapter 7: Syncing with iCloud ...................................................... 170!
Getting started ............................................................................................ 171!
CloudNotes ................................................................................................... 172!
Enabling iCloud ........................................................................................... 173!
The cloud stack ............................................................................................ 175!
Testing iCloud .............................................................................................. 176!
Responding to iCloud changes.................................................................. 182!
Switching iCloud accounts .......................................................................... 184!
Where to go from here? ............................................................................ 187!
Chapter 8: Unit Testing..................................................................... 188!
Getting started ............................................................................................ 189!
Core Data stack for testing ....................................................................... 190!
Your first test ................................................................................................ 191!
Asynchronous tests ....................................................................................... 194!
Tests first ....................................................................................................... 196!
Validation and refactoring ....................................................................... 200!
Where to go from here? ............................................................................ 203!
Chapter 9: Measuring and Boosting Performance...................... 204!
Getting started ............................................................................................ 204!
Measure, change, verify ............................................................................ 207!
Fetching and performance ........................................................................ 217!
Where to go from here? ............................................................................ 235!
Chapter 10: Multiple Managed Object Contexts ....................... 236!
Getting started ............................................................................................ 236!
Doing work in the background ................................................................. 242!
Editing on a scratchpad ............................................................................. 248!
Where to go from here? ............................................................................ 254!
Conclusion ............................................................................................ 256!
Dedications
“To my partner, Mike, who supports all of the weirdness that is me.”

–Aaron Douglas

“To my Wife – without your tireless support behind the scenes, all my
work the world enjoys would not be possible.”

–Saul Mora

“To my amazing wife Tricia and my parents - Thanks for always


supporting me.”

–Matthew Morey

“To my Core Data mentors Otto, Ron, Ahmed and Siva.”

–Pietro Rea
Introduction
By Greg Heo

What is Core Data? You'll hear a variety of answers to this question: It’s a
database! It's SQLite! It's not a database! And so forth.

Here's the technical answer: Core Data is an object graph management and
persistence framework in the OS X and iOS SDKs.

That means Core Data can store and retrieve data, but it is not a relational
database like MySQL or SQLite. Although it can use SQLite as the data store behind
the scenes, you don’t think about Core Data in terms of tables and rows and
primary keys.

Imagine you’re writing an app to keep track of dining habits. You have a varied set
of objects: restaurant objects, each with properties such as name and address;
categories, to organize the restaurants; and visits, to log each visit to a restaurant.
The object graph in memory might look something like this:

Object graph management means Core Data works with objects that you define,
such as the ones in the diagram above. For example, each restaurant (represented
by a red bubble) would have a property pointing back to the category object. It
would also have a property holding the list of visits.

raywenderlich.com Page 9
Core Data by Tutorials Introduction

Since Cocoa is an object-oriented framework, you’re probably storing data in


objects already. Core Data builds on this to keep track of the objects and their
relationships to each other. You can imagine expanding the graph to include what
the user ordered, ratings and so on.

Persistence means the data is stored somewhere durable such as the device’s
flash memory or “the cloud.” You point to the entire graph and just say “save.”
When your app launches, you just say “load” and the entire object graph pops up in
memory again, ready for use. That’s Core Data at work!

Maybe your users eat out a lot and have thousands of restaurant visits—rest
assured Core Data is smart about lazily loading objects and caching to optimize
both memory usage and speed.

Core Data has many other features aside from simply storing and fetching data:
You can perform custom filtering with predicates, sort the data and synchronize a
data store with iCloud, among other things. You’ll learn all about these features and
more in this book.

What you need


To follow along with the tutorials in this book, you’ll need the following:
• A Mac running OS X Mavericks (10.9.5) or later. You’ll need this to be able to
install the latest version of Xcode.
• Xcode 6.0.1 or later. Xcode is the main development tool for iOS. You can
download the latest version of Xcode for free from the Mac app store here:
https://itunes.apple.com/app/xcode/id497799835?mt=12
• One or more devices (iPhone, iPad or iPod Touch) running iOS 8 or later,
and a paid membership to the iOS development program [optional]. You’ll
only need a paid membership and a physical iOS device for Chapter 7, “Syncing
with iCloud.” For the rest of the book, you can get by with the iOS 8 Simulator
that comes with Xcode.
Once you have these items in place, you’ll be able to follow along with every
chapter in this book.

Who this book is for


This book is for iOS developers who already know the basics of iOS and Swift, and
want to learn Core Data.

If you’re a complete beginner to iOS, we suggest you read through The iOS
Apprentice, 3rd Edition first. That will give you a solid foundation in building iOS
apps from the ground-up.

raywenderlich.com Page 10
Core Data by Tutorials Introduction

If you know the basics of iOS development but are new to Swift, we suggest you
read Swift by Tutorials first. That book has a similar hands-on approach and takes
you on a comprehensive tour through the Swift language.

You can find both of these prerequisite books at our store:


http://www.raywenderlich.com/store

How to use this book


This book will teach you the fundamentals of Core Data by means of hands-on
tutorials. You’ll jump right into building a Core Data app in Chapter 1, as we think
most people learn best by doing. We encourage you to type along with the
instructions in the book.

If you’re new to Core Data or want to review the basics, we suggest you start with
Chapters 1–3. These chapters cover the fundamentals of Core Data and you’ll need
the knowledge in them to understand the rest of the book.

Otherwise, we suggest a pragmatic approach. Each chapter stands on its own, so


you can pick and choose the chapters that interest you the most.

What’s in store
Here’s a quick summary of what you’ll find in each chapter:
1. Chapter 1, Your First Core Data App: You’ll click File\New Project and write
a Core Data app from scratch! This chapter covers the basics of setting up your
data model and then adding and fetching records.
2. Chapter 2, NSManagedObject Subclasses: NSManagedObject is the base data
storage class of your Core Data object graphs. This chapter will teach you how
you customize your own managed object subclasses to store and validate data.
3. Chapter 3, The Core Data Stack: Under the hood, Core Data is made up of
many parts working together. In this chapter, you’ll learn about how these parts
fit together, and move away from the starter Xcode template to build your own
customizable system.
4. Chapter 4, Intermediate Fetching: Your apps will fetch data all the time, and
Core Data offers many options for getting the data to you efficiently. This chapter
covers more advanced fetch requests, predicates, sorting and asynchronous
fetching.
5. Chapter 5, NSFetchedResultsController: Table views are at the core of many
iOS apps, and Apple wants to make Core Data play nicely with them! In this
chapter, you’ll learn how NSFetchedResultsController can save you time and code
when your table views are backed by data from Core Data.

raywenderlich.com Page 11
Core Data by Tutorials Introduction

6. Chapter 6, Versioning and Migration: As you update and enhance your app,
its data model will almost certainly need to change. In this chapter, you’ll learn
how to create multiple versions of your data model and then migrate your users
forward so they can keep their existing data as they upgrade.
7. Chapter 7, Syncing with iCloud: Move beyond storing data locally on a single
device, to cloud storage and synchronizing across all the user’s devices. This
chapter covers how to extend an existing Core Data app to use iCloud.
8. Chapter 8, Unit Tests: Testing is an important part of the development
process, and you shouldn’t leave Core Data out of those tests! In this chapter,
you’ll learn how to set up a separate test environment for Core Data and see
examples of how to test your models.
9. Chapter 9, Measuring and Boosting Performance: No one ever complained
that an app was too fast, so it’s important to be vigilant about tracking
performance. In this chapter, you’ll learn how to measure your app’s performance
with various Xcode tools and then pick up some tips for dealing with slow spots in
your code.
10. Chapter 10, Multiple Managed Object Contexts: In this final chapter, you’ll
expand the usual Core Data stack to include multiple managed object contexts.
You’ll learn how this can improve perceived performance and help make your app
architecture less monolithic and more compartmentalized.

Source code and forums


This book comes with complete source code for each of the chapters—it’s shipped
with the PDF. Some of the chapters also include starter projects or other required
resources, and you’ll definitely want to have these on hand as you go through the
book.

We’ve set up an official forum for the book at


http://www.raywenderlich.com/forums. This is a great place to ask questions you
have about the book or about developing Core Data apps, or to submit any errors
or suggested updates.

Updates
Since you’ve purchased the PDF version of this book, you get free access to any
updates we make to the book!

The best way to get update notifications is to sign up for our monthly newsletter.
This includes a list of the tutorials that came out on raywenderlich.com that month,
any important news like book updates or new books, and a list of our favorite
development links for that month. You can sign up at this URL:

http://www.raywenderlich.com/newsletter

raywenderlich.com Page 12
Core Data by Tutorials Introduction

License
By purchasing Core Data by Tutorials, you have the following license:
• You are allowed to use and/or modify the source code in Core Data by Tutorials in
as many apps as you want, with no attribution required.
• You are allowed to use and/or modify all art, images and designs that are included
in Core Data by Tutorials in as many apps as you want, but must include this
attribution line somewhere inside your app: “Artwork/images/designs: from Core
Data by Tutorials book, available at http://www.raywenderlich.com.”
• The source code included in Core Data by Tutorials is for your personal use only.
You are NOT allowed to distribute or sell the source code in Core Data by
Tutorials without prior authorization.
• This book is for your personal use only. You are NOT allowed to sell this book
without prior authorization or distribute it to friends, co-workers or students; they
would need to purchase their own copies.
All materials provided with this book are provided on an “as is” basis, without
warranty of any kind, express or implied, including but not limited to the warranties
of merchantability, fitness for a particular purpose and non-infringement. In no
event shall the authors or copyright holders be liable for any claim, damages or
other liability, whether in an action of contract, tort or otherwise, arising from, out
of or in connection with the software or the use or other dealings in the software.

All trademarks and registered trademarks appearing in this book are the property of
their respective owners.

About the authors


Pietro Rea is an iOS developer based in Hoboken, NJ.
He started writing code in high school and currently
specializes in Objective-C, Swift and iOS. These days, he
develops mobile applications for Quidsi, an Amazon
company. You can follow him on Twitter as @pietrorea or
on his blog at www.pietrorea.com

Saul Mora is an engineer at Coursera, in Mountain View,


California. He enjoys writing apps, riding bicycles and
traveling the world. Saul is a frequent speaker at many
iOS and Mac developer conferences and also produces a
podcast for developers called NSBrief (nsbrief.com).
Occasionally, you can find Saul teaching the wonders of
programming to the next generation of developers.

raywenderlich.com Page 13
Core Data by Tutorials Introduction

Aaron Douglas was that kid taking apart the home


appliances at five years of age to see how they worked.
Today he's a full-time iOS developer with a passion for
doing things right the first time. He enjoys camping
during the summer and pretending to be a storm chaser
while sitting at home. Find him on the Interwebs as
@astralbodies.

Matthew Morey is an engineer, developer, hacker,


creator, and tinkerer. As an active member of the iOS
community and a Lead Developer at ChaiOne he has led
numerous successful mobile projects worldwide.

When not developing apps he enjoys traveling,


snowboarding, and surfing. He blogs about technology
and business at matthewmorey.com.

About the editors


Richard Turton was the technical editor for this book. He
is an iOS developer for a leading UK mobile agency, a
prolific Stack Overflow participant and the author of a
development blog, commandshift.co.uk. When he's not in
front of a computer, he is underneath one or both of his
daughters as a horse, monkey or cushion.

Bradley C. Phillips was the editor for this book, and was
the first editor to come aboard at raywenderlich.com. He
has worked as a journalist and previously directed the
intelligence department of an investigative firm in New
York City. Right now, Bradley works freelance and pursues
his own projects. Contact him if you need a skilled and
experienced editor for your blog, books or anything else.

Greg Heo was the final pass editor for this book, and has
been part of the editorial team at raywenderlich.com since
2012.

He has been nerding out with computers since the


Commodore 64 era in the 80s and continues to this day on
the web and on iOS. He likes caffeine, codes with two-
space tabs and writes with semicolons.

raywenderlich.com Page 14
Chapter 1: Your First Core
Data App
By Pietro Rea

Welcome to Core Data! In this chapter, you’ll write your very first Core Data app.
You’ll see how easy it is to get started with all the resources provided in Xcode,
from the starter code templates to the data model editor.

You’re going to hit the ground running right from the first chapter in this book; by
the end of the chapter you’ll know how to:
• model data you want to store in Core Data using Xcode’s model editor;
• add new records to Core Data;
• fetch a set of records from Core Data; and
• display the fetched results to the user in a table view.
You’ll also get a sense of what Core Data is doing behind the scenes, and how you
can interact with the various moving pieces there. This will put you well on your
way to understanding the next two chapters, which continue the introduction to
Core Data with more advanced models and data validation, amongst other things.

We’re getting ahead of ourselves though – it’s time to build an app!

Getting started
Open Xcode and create a new iPhone project based on the Single View
Application template. Call the app HitList and make sure Use Core Data is
checked:

raywenderlich.com Page 15
Core Data by Tutorials Chapter 1: Your First Core Data App

Checking the Use Core Data box will cause Xcode to generate boilerplate code for
what’s known as a Core Data stack in AppDelegate.swift.

The Core Data stack consists of a set of objects that facilitate saving and retrieving
information from Core Data. There’s an object to manage the Core Data state as a
whole, an object representing the data model, and so on.

You’ll learn about each of these pieces in these first few chapters. Later, you’ll even
have the chance to write your own Core Data stack! The standard stack works just
fine for many apps but based on your app and its data, you can customize the stack
to be more efficient.

Note: Not all Xcode templates have the option to start with Core Data. In
Xcode 6, only the Master-Detail Application and the Single View
Application templates have the Use Core Data checkbox.

The idea for this sample app is simple. There will be a table view with a list of
names for your very own “hit list”. You’ll be able to add names to this list and
eventually, you’ll use Core Data to make sure the data is stored between sessions.
We don’t condone violence in this book so you can think of this app as a “favorites
list” to keep track of your friends too, of course! ;]

Click on Main.storyboard to open it in Interface Builder. Select its only view


controller and change its size class to Regular Height and Compact Width to match
an iPhone in portrait mode:

raywenderlich.com Page 16
Core Data by Tutorials Chapter 1: Your First Core Data App

Next, embed the view controller in a navigation controller. From Xcode’s Editor
menu, select Embed In…\ Navigation Controller.

Back in Interface Builder, drag a Table View from the object library into the view
controller so that it covers the entire view.

Then, drag a Bar Button Item and place it on the view controller’s newly added
navigation bar. Finally, double-click the bar button item to change its text to Add.
Your canvas should now look like the following screenshot:

Every time you tap Add on the top-right, an alert containing a text field will appear
on the screen. From there you’ll be able to type someone’s name into the text field.
Dismissing the alert will save the name and refresh the table view with all the
names you’ve saved up to that point.

raywenderlich.com Page 17
Core Data by Tutorials Chapter 1: Your First Core Data App

Before you can do that, you need to make the view controller the table view’s data
source. Ctrl-drag from the table view to the yellow view controller icon above the
navigation bar, as shown below, and click on dataSource:

In case you were wondering, you don’t need to set up the table view’s delegate
since tapping on the cells won’t trigger any action. It doesn’t get simpler than this!

Open the Assistant Editor by hitting Command-Option-Enter or by selecting the


middle button on the Editor toolset on the Xcode bar. Ctrl-drag from the table view
onto ViewController.swift, inside the class definition to insert an outlet:

Name the new IBOutlet property tableView, resulting in the following line:

@IBOutlet weak var tableView: UITableView!

Ctrl-drag from the Add bar button item onto ViewController.swift, but this time,
create an action instead of an outlet and name the method addName:

@IBAction func addName(sender: AnyObject) {

You can now refer to the table view and the bar button item’s action in code. Next,
set up the model for the table view. Add the following property to
ViewController.swift:

//Insert below the tableView IBOutlet


var names = [String]()

names is a mutable Array to hold the strings for the table view to display.

raywenderlich.com Page 18
Core Data by Tutorials Chapter 1: Your First Core Data App

Replace the implementation of viewDidLoad with the following:

override func viewDidLoad() {


super.viewDidLoad()
title = "\"The List\""
tableView.registerClass(UITableViewCell.self,
forCellReuseIdentifier: "Cell")
}

This will set a title and register the UITableViewCell class with the table view. You
do this so that when you dequeue a cell, the table view will return a cell of the
correct type.

Still in ViewController.swift, declare that ViewController will conform to the


UITableViewDataSource protocol by editing the class declaration:

//Add UITableViewDataSource to class declaration


class ViewController: UIViewController, UITableViewDataSource {

Immediately, Xcode will complain about ViewController not conforming to the


protocol. Below viewDidLoad, implement the following data source methods to fix
the error:

// MARK: UITableViewDataSource
func tableView(tableView: UITableView,
numberOfRowsInSection section: Int) -> Int {
return names.count
}

func tableView(tableView: UITableView,


cellForRowAtIndexPath
indexPath: NSIndexPath) -> UITableViewCell {

let cell =
tableView.dequeueReusableCellWithIdentifier("Cell")
as UITableViewCell

cell.textLabel!.text = names[indexPath.row]

return cell
}

If you’ve ever worked with UITableView, this code should look very familiar. The
first method says that the table view will have as many rows as the names array has
strings.

raywenderlich.com Page 19
Core Data by Tutorials Chapter 1: Your First Core Data App

The second method, tableView(_:cellForRowAtIndexPath:), dequeues table view


cells and populates them with the corresponding string in the names array.

Don’t run the app just yet. First, you need a way to input names so the table view
can display them.

Implement the addName IBAction method you Ctrl-dragged into your code earlier:

//Implement the addName IBAction


@IBAction func addName(sender: AnyObject) {

var alert = UIAlertController(title: "New name",


message: "Add a new name",
preferredStyle: .Alert)

let saveAction = UIAlertAction(title: "Save",


style: .Default) { (action: UIAlertAction!) -> Void in

let textField = alert.textFields![0] as UITextField


self.names.append(textField.text)
self.tableView.reloadData()
}

let cancelAction = UIAlertAction(title: "Cancel",


style: .Default) { (action: UIAlertAction!) -> Void in
}

alert.addTextFieldWithConfigurationHandler {
(textField: UITextField!) -> Void in
}

alert.addAction(saveAction)
alert.addAction(cancelAction)

presentViewController(alert,
animated: true,
completion: nil)
}

Every time you tap the Add bar button item, this method presents an
UIAlertController with a text field and two buttons, Save and Cancel.

Save takes whatever text is currently in the text field, inserts it into the name array
and reloads the table view. Since the names array is the model backing the table
view, whatever you typed into the text field will appear in the table view.

Finally it’s time to build and run your app for the first time. Tap the Add bar button
item. The alert controller will look like this:

raywenderlich.com Page 20
Discovering Diverse Content Through
Random Scribd Documents
THE ROUT OF THE MAHIKI

The location of the adventure with the shark-god Maka’u-kiu1 was at the
mouth of Wai-pi’o valley, a region where Hawaii’s storm-coast forms an
impassable rampart, save as it is cut by this and its twin valley, Wai-manu.
These valleys take head in a wild forest region, the home of mist, rain and
swamp. Adjoining this and part of the same watershed is the region known
as Mahiki-waena, a land which the convenience of traffic required should
be open to travel. It was the haunt of a ferocious horde of mo’o called
mahiki2 from their power to leap and spring like grass-hoppers.

When Hiiaka proposed to pass through this region in the ordinary course of
travel, the head of the Mahiki insolently denied her the right of way,
suggesting as an alternative the boisterous sea-route around the northern
shoulder of Hawaii. Hiiaka’s blood was up. The victory over the hosts of
Pana-ewa and the more recent destruction of Maka’u-kiu had fired her
courage. She resolved once for all to make an end of this arrogant nuisance
and to rid the island of the whole pestilential brood of imps and mo’o.
Standing on a height that overlooked Wai-pi’o, she chanted a mele which is
at once descriptive of the scene before her and at the same time expressive
of her determination:

Mele Uhau

A luna au o Wai-pi’o,
Kilohi aku k’uu maka ilalo;
Hele ho’i ke ala makai o Maka’u-kiu;
Hele ho’i ke ala mauka o Ka-pu-o’a—
Pihapiha, he’e i ka welowelo,
I ka pu’u Kolea, i ka ino, e—
Ino Mahiki:
Ua ike ka ho’i au, he ino Mahiki,
He ino, he ino loa no, e!
TRANSLATION

As I journeyed above Wai-pi’o


Mine eyes drank in that valley—
The whole long march as far as from
The sea-fight at Maka’u-kiu
Till the trail climbs Ka-pu-o’a.
There soggy the road and glairy,
And there do flaunt and flourish,
On Plover Mount, the cursed Mahiki.
For I am convinced that that crew
Are bad, as bad as bad can be!

Hiiaka’s march to encounter the Mahiki was interrupted for a short time by
an incident that only served to clinch her resolution. An agonizing cry of
distress assailed her ear. It came from a dismantled heap of human flesh, the
remains of two men who had been most brutally handled—by these same
Mahiki, perhaps—their leg and arm-bones plucked out and they left to
welter in their misery. It was seemingly the cruel infliction of the Mahiki.
The cry of the two wretches could not be disregarded:

E Hiiaka-i-ka-poli-o-Pele, e,
E ki’i mai oe ia maua;
E ka hookuli i ka ualo, e!
Ka opu aloha ole, e-e!

TRANSLATION

O Hiiaka-of-Pele’s-heart,
Come thou and assist us.
Turn not a deaf ear to our cry!
Be not of hard and unfeeling heart!

Hiiaka, with a skill that did credit to her surgery, splinted the maimed limbs,
inserting stems from her favorite ti plant to take the place of the long bones
that had been removed. She left them seated in comfort at the roadside at
Pololú.
The Mahiki, on seeing Hiiaka advance into their territory, threw up the dirt
and dust in their front, to express their contempt for such an insignificant
body of trespassers. Hiiaka, paying no attention to their insolence, pressed
on. Her purpose was to strike directly at Mo’o-lau, the leader of the horde,
to whom she addressed this incantation:

A loko au o Mahiki,
Halawai me ke Akua okioki po’o.
Okioki ino, la, i kona po’o;
Kahihi a’e la i kona naau;
Hoale mai ana i kona koko i o’u nei.
E Lau e, Lau e-e!
No’u ke ala, i hele aku ho’i, e-e!

TRANSLATION

I enter the land of Mahiki;


I counter the head-hunting witch.
See me pluck the head from her body;
See me tear out her very heart,
Till her blood surges round me in waves—
Blood of the monster that’s legion.
Mine is the common right of way:
The traveler’s right to the road!

At dark Hiiaka camped in the road and during the night a female ku-pua
named Lau-mihi, whom the Mahiki chief had sent as a spy to watch Hiiaka,
was seen standing on a high place to one side of them. Hiiaka at once flew
at her and put an end to her.

Now began a fierce battle between Hiiaka and the Mahiki dragon and his
forces. They fought till both sides were exhausted and then, as if by mutual
consent, stopped to rest.

Hiiaka perceived that the battle was to be even more fiercely contested than
that at Pana-ewa. She bade Paú-o-pala’e to take good care that no ill came
to Wahine-oma’o. Looking up into the heavens, Hiiaka saw her relatives
and friends Poha-kau, Ka-moho-alii, Kane-milo-hai, and a large concourse
of other gods, including Kane, Kanaloa, Ku and Lono, watching her,
evidently greatly interested in her performances. They assured her of their
protection. At this Hiiaka was much encouraged and gave utterance to her
feelings in this kanaenae:

A Moolau, i ka pua o ka uhiuhi,


Helele’i mai ana ka pua o Ko’o-ko’o-lau.
Lohi’a e na mo’o liilii—
Na mo’o liilii ke ala
E kolo i ke kula,
E iho i kai o Kawaihae, la.
Hea a’e la ka mo’o liilii:
E hakaká kaua; paio olua auane’i.
He ’kau Mo’o-lau, o Mo’o-lau akua, e!

TRANSLATION

In the wilds of Mo’o-lau,


The uhiuhi’s time for bloom—
The petals fall of Koolau’s flower:
The little dragons have found the way
By which they can crawl to the plain,
Go down to the sea at Kawaihae.
The little demons now announce
That you and I shall battle wage:
We two, indeed, must fight, they say—
A god is Mo’o-lau, a host of gods!

At this the great dragon Mo’o-lau bestirred himself. His attack was direct,
but he divided his host into two columns so as to envelope Hiiaka and
attack her on each flank. Hiiaka saw them approaching through the jungle
and chanted the following rallying song:

Mele Ho’-uluulu

A Mo’o-lau, i ka pua o ka uhiuhi,


Pala luhi ehu iho la
Ka pua o ke kauno’a i ka la;
Na hale ohai i Kekaha, o Wa’a-kiu;—
E kiu, e kiu ia auane’i kou ahiahi;
E maka’i ia olua auane’i.
He akua Mo’o-lau, o Mo’o-lau akua, e!

TRANSLATION

In the jungle of Mo’o-lau,


The uhi-uhi’s season of bloom;
The flower of the rootless kau-no’a
Is wilted and bent in the sun;
My bower in Kekaha’s invaded:
Some creature is playing the spy.
I, in turn,—be warned—will spy out
Your quiet and rest of an evening:
This to you, you, god Mo’o-lau!

Pele, perceiving that the crisis of the conflict had now come, called upon all
the male and female relatives of Hiiaka (hoaiku) to go to her assistance;
“Go and help your sister Hiiaka. There she is fighting desperately with
Mo’o-lau—fighting and resting, fighting and resting, well nigh exhausted.
Go and help her; all of you go. It’s a fight against Mo’o-lau.”

When the battalion of gods moved against the mo’o, it was a rout and a
slaughter. Then the cry arose: “No fight has been made against the Mahiki
dragon; he yet survives.” Thereupon they turned their attack against that old
dragon and his guards. Hiiaka then celebrated the double victory in this
paean:

Kaiko’o Pu’u-moe-awa, wawá ka laau;


Nei o Pu’u-owai ma, e:
Nahá ka welowelo; he’e na’e ho’i, e!
E Pu’u-owai ma, e, ke holo la!
E Miki-aloalo, e, nawai ka make?
Ke i-o nei, e!

TRANSLATION

A roar as of surf on the hill Moe-awa:


The tumult resounds through the forest:
Pu’u-owai and his band lead the rout,
Your battallions are torn into tatters—
You are running, Captain Owai!
And you, Captain Spry, whose the defeat?
The answer is made by the shouting!

Hiiaka’s chief weapon of attack seems to have been her magical paú. With
this as a besom she beat them down as a husbandman might beat down a
swarm of locusts. The Mahiki and the Mo’o-lau had ceased to exist as
organized bodies. But from the rout and slaughter of the armies many
individuals had escaped with their lives, and these had hid themselves away
in caves and secret places, some of them even, presuming apparently upon
their power of disguise, had taken refuge in the remote scattered habitations
of the people. Such an inference seems to be justified by the language of the
mele now to be given:

Note.—The gods that came to the assistance of Hiiaka such times as circumstances pinched her and
whose spiritual power at all times reënforced her feeble humanity were limited in their dominion to
certain vaguely defined provinces and departments. Thus, if there was any sea-fighting to be done, it
fell to the shark-god, the Admiral Ka-moho-alii, to take charge of it. On the other hand, the conduct
of a battle on terra firma would be under the generalship of Kane-milo-hai; while to Kana-loa
belonged the marshalling of the celestial hosts, the moon and the stars. But the orb of day, the Sun,
belonged to Lono. Hence, if the fighting was during the hours of daylight, Lono would logically
assume the command. The rule of the great god Ku was also exercised principally by day. It was he
who arranged the calendar and settled the order of the seasons, the days and the nights. The
subdivisions and departmental complications under these general divisions were numerous.

Lilo i Puna, lilo i Puna,


Lilo i Puna, i ke au a ka hewahewa;
Popo’i aku ka i na hale:
Ua piha na hale i ke ’kua—
O Kini Akua o Wai-mea,
O ka Lehu Akua o Maná.
Kini wale Wai-mea
I ka pihe o ke ’kua o Uli, e.
Po wale Mahiki;
A ia Mahiki ke uwá la no, e!

TRANSLATION

Scattered through Puna, scattered through Puna,


Is the rout of the vagrant imps:
They swarm in the dwellings of men;
The houses are lousy with demons—
Wai-mea’s myriads of godlings,
Thy four hundred thousand, Maná.
Wai-mea thrills with the snarl of witch-gods:
Night’s shadows brood over Mahiki;
The uproar keeps on in Mahiki.

1 Maka’u-kiu, afeared-o-a-spy. ↑
2 Ma-hi-ki (mahiti, mawhiti), to leap, to skip, to spring up suddenly. The Maori Comp.
Dict. E. Tregear. ↑
CHAPTER XIII
HIIAKA LOOPS BACK IN HER JOURNEY
Hiiaka, having thus far, as it would seem, journeyed along the western coast
of Hawaii, now loops back in her course and travels in the direction of Hilo
by the way of Hamakua, for the seeming purpose of completing her work of
extermination. Like a wise general, she would leave no enemies in her rear.

When they came into the neighborhood of Wahine-oma’o’s home, that girl
spoke up and said, “I think we had better take another road. If we keep to
this one, which passes by my door, my parents, who will be watching for
me, will see me and will want me to remain with them.” This she said by
reason of her great desire to continue in Hiiaka’s company. True enough,
when they caught sight of her old home, there sat her mother Puna-hoa and
her father Kai-pala-oa.

“There they sit,” said the girl. “If they recognize me they will want to keep
me.”

Hiiaka bade Wahine-oma’o fall in behind her, hunch her shoulders, bend
forward her head and walk with short infirm steps in imitation of an old
woman. Hiiaka, on coming close to the old people, using the language of
song, asked directions as to the road:

E Puna-hoa i Kai-pala-oa,
I na maka o Nana-kilo ma
E nonoho mai la, e.
Auhea ka ala, e?

TRANSLATION

O Puna-hoa and Kai-pala-oa,


You with the clear-scanning eyes,
Sitting at rest before me,
Point me out now the road.
“The road is plain enough; you are taking the right way.… We are looking
at that young woman of your party—she has such a strong resemblance to
our missing daughter, save her way of shuffling and holding her head.”

On reaching the outskirts of the village of Hilo, Hiiaka found a rickety foot-
bridge, consisting of a single narrow and wobbly plank, liable to turn at
every step and precipitate the passenger into the tumbling waters below—
and this was the only passage across the rocky chasm of the Wai-luku1
river. This precarious crossing was the work of two sorcerers, degenerate
nondescripts, who had the audacity to levy toll for the use of their bridge, in
default of which the traveler suddenly found himself precipitated into the
raging water. By virtue of their necromantic powers, they had the
presumption to claim spiritual kinship with Hiiaka, a bond the woman could
not absolutely repudiate.

“Here comes our mo’o-puna,”2 called out Pili-a-mo’o to his companion.

“Well, what of it? She will have to pay her fare the same as anyone else,”
replied Noho-a-mo’o. “Only on that condition shall she cross by our
bridge.”

On Hiiaka’s attempting to cross without paying toll, the two sorcerers


would, following their own practice, have disarranged the treacherous plank
and precipitated her and her party into the raging stream.

“Well said,” Noho-a-mo’o replied; “provided she will consent to it.”

Hiiaka now called to them in the language of song:

Kahuli-huli,3 e-e,
Ka papa o Wai-luku!
Kahuli o Apua,
Ha’a mai o Mau-kele:
He ole ke kaha kuai ai, e-e!
Homai ka ai,
Homai ho’i ka ai, e-e!
I ai’na aku ho’i, e-e!

TRANSLATION

Cranky, cranky the bridge,


Bridge across the Wai-luku!
Upset is Apua;
Maukele declares that
The barter of food is naught.
Give us then of your food;
Give us something to eat;
Let us partake of your meat.

To this unusual demand they replied, “Indeed, do you imagine we will do


any such thing as that? It is not for us to give to you; you must give us the
fare before you cross on our bridge. We don’t give away things for
nothing.”

Hiiaka replied by repeating her request in nearly the same words:

Ka-huli-huli, e-e,
Ka papa o Wai-luku.
He ole ke kaha kuai i’a, e!
Ho-mai ka i’a;
Ho-mai ana, ho’i, ka i’a,
I ai’na aku, ho’i, e-e!

TRANSLATION

Unstable the bridge,


Bridge that spans the Wai-luku.
This barter of fish is a fraud.
Give us of your fish;
Grant us kindly some meat;
Give us something to eat.
Hiiaka repeated her demands in varying form with no other effect than to
make the toll-keepers more stubborn in their ridiculous demands. Not even
when Hiiaka, as if to cap the climax of their absurdity, ended her demand
with this ironical request:

Ho-mai, ho’i, ka wai, e;


I inu ia aku, ho’i, e!!

TRANSLATION

Give us of this water,


Give us water to drink!

Hiiaka now openly denounced the two sorcerers as being simply mo’o in
disguise, entirely wanting in those generous feelings that belong to
godhood. “These creatures are simply mo’o. If I attack them, they will run
for their lives.”

The people, failing to recognize Hiiaka as their deliverer, spiritless from


long habituation to the fraudulent dominion of these imposters, fearful also
of their vengeance, stoutly opposed Hiiaka, affirming that Pili-a-mo’o and
Noho-a-mo’o were gods in reality, having great power and capable of doing
many wonderful things. They declared their readiness to back their opinion
with their property, yes, with their lives. They were at length persuaded,
however, to accept as decisive the test proposed by Hiiaka, namely, that, if
they fled when attacked, they should cease to be regarded as gods and
should be dealt with as imposters.

True to Hiiaka’s prediction, the mo’o, in abject fear, turned and fled for
their lives at her first threatening move and she now called upon the people
to pursue and destroy them:

Kaumaha ka aï o Hilo i ka lehua


Mai ka Nuku-o-ka-manu4 a Puna-hoa, e.
Hoa ia iho la kau kanáka,
I pa’a, o pahe’e auane’i;
Hina i ka Lua-kanáka.
He kanáka! He mau akua, e!

TRANSLATION

The neck of Hilo is heavy,


Weighted with wreaths of lehua
From Bird-beak clean down to the feet.
Catch and bind these robbers of men;
Bind them fast, lest they slip through your hands
And escape to the robber-pit—
These mortals, who call themselves gods!

The meaning of the figure in the first two verses, though obscure, seems to
be that Hilo, so rich in natural beauty, is by that very fact robbed of the
energy to defend herself and cast off the incubus that oppresses her.

As the creatures fled from Hiiaka’s pursuit, their human disguise fell from
them and their real character as mo’o was evident.

“We’ve committed a great blunder,” said Pili-a-mo’o to his mate. “It looks
as if she meant to kill us. Let us apologize for our mistake and conciliate
her with fair words.”

Noho-a-mo’o agreed to this and, turning to Hiiaka, made this wheedling


speech:

Kupu maikai a’e la


Ka wahine o ka Lua;
Uä ia iho la e ka ua,
A kilinahe ka maka o ka lehua ma-uka.
Ma-uka oe e hele ai,
Ma ka hoauau wai.
E waiho ke ala no maua,
No na kupuna, e.

TRANSLATION
She has grown a fine figure,
Our girl from the Fire-pit.
The plentiful rain has made bright
This bud of upland lehua.
Pray choose your road farther inland;
That way will offer good fordage—
This road leave to your ancient kin.

Hiiaka spared not, but pursued them to their cavernous rock-heaps in which
they thought to hide themselves, and, having seized them, rent them
asunder jaw from jaw. Thus did Hiiaka add one more to the score of her
victories in the extermination of the mo’o.

1 Wai-luku, water of destruction. ↑


2 Mo’o-puna, a grandchild, nephew or niece. ↑
3 Kahuli-huli. Kahuli, or its intensive, kahuli-huli, primarily means to upset, to
overturn. A secondary meaning, much employed in the argot of hula folk, is to hand over,
to pass this way; as when one guest at table might say to a neighbor, “hand me the salt (if
you please).” ↑
4 Nuku-o-ka-manu, literally, the beak of the bird; said to be a cape in the neighborhood
of Hilo. ↑
CHAPTER XIV
HIIAKA MEETS MOTHER-GRUNDY
It was at this point of the journey that Hiiaka lost the attendance of her
sympathetic companion and faithful servant, Paú-o-pala’e. She was
persuaded to unite her fortunes with those of a man from Kohala named Pa-
ki’i; and we must leave unanswered the question, how she finally settled
with Pele this apparent desertion of the trust with which she had been
charged, that of acting as aide, kahu, to Hiiaka. Wahine-oma’o now remains
as the sole companion of Hiiaka in her future adventures.

On resuming the journey they came before long to the broad stream of
Honoli’i, which was swimming deep and, in the lack of other means of
crossing, they bundled their clothes, held them above their heads with one
hand and easily made the opposite shore by swimming with the aid of the
other hand.

At the sight of this performance, the ghost-god, Hina-hina-ku-i-ka-pali and


her companion, in a spirit of pure fault-finding and Mother-Grundyism,
exclaimed:

Popó ke kapa o ka wahine,


Au kohana wai, hoauau wai o Honoli’i.
E kapu oe, he mau alii;
He mau alii no, o Hina-hina-ku-i-ka-pali.

TRANSLATION

The women bundle their garments


And, naked, they swim the stream,
The water of Hono-li’i—
An action quite unseemly:
’Tis a slur on your noble rank,
I too am a chief, my name
Hina-hina-gem-of-the-cliff.
“For shame!” said Hiiaka. “These ghost-gods have been spying on our
nakedness, and now they make sport of us.”

A great fear came upon the ghosts, that the dread goddess would seize them
and pinch out their atomy spark of existence. In their terror, they flew home
and, perched on the shoulders of their mother, besought her to interpose in
their behalf and appease Hiiaka by a suitable offering of luau.

“There burns a fire,” said Wahine-oma’o, as they drew near the house.

“The fire of the ovens built by the ghosts,” Hiiaka answered. “They have
saved themselves from death.”

By the time they reached the house the luau was done to a turn and the
tables were spread. Wahine-oma’o made an oblation to the gods and then
ate of the viands. Hiiaka did not partake of the food.

Hiiaka now spent several days at Hono-kane, in Kohala, anxiously awaiting


the departure of some canoe, by which she might pass over to the island of
Maui. While thus absorbed, in a sentimental mood, looking one day across
the ocean at the misty outline of the distant land, she saw a man of
remarkable appearance strike out from one headland of the bay to swim to
the opposite point. Her admiration for his physical beauty and his daring
performance drew from her a song:

I i au, e au ma kai o ka hula ana.


Kai-ko’o a’e la lalo o ka pali;
Pího-pihó a’e; lele ke kai o Maka’u-kiu;
Au hopohopo ana i ka loa o Hono-kane-iki.
I kane oe a i wahine au.

TRANSLATION

My heart beats high at your venture—


To buffet the raging sea!
Wild heave the waves ’neath the cliff-wall.
To be whelmed by Ocean’s might—
The ocean of Maka’u-kiu!
My heart forgets to beat at sight
Of your rashness, Hono-kane!
Would you were the man, the woman I!

Hono-kane heard, of course, the words that were uttered in his praise and,
being a man of chivalrous instincts as well as of honor, he invited Hiiaka
and Wahine-oma’o to enjoy the hospitalities of his home.

As they sat at a feast spread in her honor, Hiiaka, as was her wont, bowed
her head in prayer with closed eyes, and the others did likewise and when
they opened their eyes and looked, the portion that had been set before
Hiiaka was gone, spirited away.

In the evening it was announced that a canoe was to sail in the early
morning on a voyage to Maui, whereupon Hiiaka secured the promise of a
passage for herself and Wahine-oma’o.
CHAPTER XV
THE VOYAGE TO MAUI
Hiiaka’s voyage across the Ale-nui-haha channel, considered merely as a
sea adventure, was a tame experience. There was no storm, no boistrous
weather, sea as calm as a mill-pond, nothing to fillip the imagination with a
sense of excitement or danger; yet it was far from being an agreeable
experience to the young woman who was now having her first hand-to-hand
tussle with the world.

They had spent the night at the house of one Pi’i-ke-a-nui. In the early
morning their host and a younger man—apparently his son—named Pi’i-ke-
a-iki, made ready their canoe to sail for Maui. Hiiaka, assuming that
passage would be granted both of them, in accordance with a promise made
the previous day, stood ready against the hour of departure. At the last
moment, the younger man, having assisted Wahine-oma’o to her seat in the
bow next to himself, called to his elder, “Pi’i-ke-a-nui, why don’t you show
your passenger to her seat, the one next you?”

“I won’t do it,” Pi’i-ke-a-nui answered groutily. “I find that the canoe will
be overloaded if we take passengers aboard and all our landlord’s freight
will get wet.”

The real reason for this volte-face on the part of the old sailor was that he
had made an unseemly proposition to Hiiaka the night before and she had
repelled him.

Wahine-oma’o, thereupon, left her seat and the canoe started without them.
It was not more than fairly underway, however, when a violent sea struck
the craft and swamped it, and all the loose freight was floating about in the
ocean.

“There, you see! We’d ’ave had better luck with the women aboard.” Such
was the exclamation of Pi’i-ke-a-iki.
It did not take long to convince the old man Pi’i-ke-a-nui, who was captain
of the canoe, that he had invited this disaster on himself, the agent of which,
as he rightly suspected, was none other than the distinguished-looking
young woman who now stood on the beach watching him in his
predicament with unperturbed countenance.

The two men floated their canoe, collected their baggage and came ashore.
When they had got the stuff dry and stowed in the waist of the craft, they
escorted the women aboard, seating Wahine-oma’o, as directed by the
captain, in the bow near Pi’i-ke-a-iki and Hiiaka in the after part, within
arm’s length of Pi’i-ke-a-nui, and they put to sea.

The canoe was a small affair, unprovided with that central platform, the
pola, that might serve as the cabin or quarter deck, on which the passengers
could stretch themselves for comfort. In her weariness, Hiiaka, with her
head toward the bow, reclined her body against the top rail of the canoe,
thus eking out the insufficiency of the narrow thwart that was her seat; and
she fell asleep, or rather, entered that border-land of Nod, in which the
central watchman has not yet given over control of the muscular system and
the ear still maintains its aerial reconnoissance.

The wind, meanwhile, as it caromed aft from the triangular sail of mat,
coquetted with her tropical apparel and made paú and kihei shake like
summer leaves.

The steersman, in whom that precious factor, a chivalrous regard for


woman, was even of less value than is common to the savage breast, in the
pursuit of a fixed purpose, began to direct amorous glances at the prostrate
form before him and to the neglect of his own proper duties. Presently he
left his steering and stole up to Hiiaka with privy paw outstretched. Hiiaka
roused from her half-dreamy state on the instant, and the man sprang back
and resumed his paddle.

Hiiaka, with the utmost coolness, expressed in song her remonstrance and
sarcastic rebuke for this exhibition of inhospitable rudeness:

A Hono-ma-ele au, i Hono-ka-lani,


Ike au i ka ua o ko’u aina,
E halulu ana, me he kanaka la—
Ka ua ku a-o-a i kai.
Haki kaupaku o ka hale i ka ino, e!
Ino Ko’o-lau, ino Ko’o-lau, e-e!

TRANSLATION

With pillowed neck I lay, face to heaven:


The rain, I found, beat on my bed;
Came a tremor, like tread of a man—
The slap of a rain-squall at sea;
Within, the roof-tree broken down,
My house exposed to the storm,
My garden of herbs laid waste!

The young man added his protest: “Yes, his whole conduct is, indeed,
shameful, scandalous. He hasn’t the decency to wait till he gets ashore.”

In the midst of this unpleasantness it was a comfort to hear the strong


cheerful voice of her former companion Paú-o-pala’e calling to her across
the stretch of waters. It will be remembered that their roads had parted
company sometime before Hiiaka had left the big island. The separation had
made no change, however, in their mutual affection:

O hele ana oe, e ka noe, e ka awa,


E na ki a Wahine-kapu,
E ka ua lele a’e maluna
O Ka-la-hiki-ola, la:
O hele ana, e!

TRANSLATION

Like a cloud you fleet by,


On the wings of the storm—
Vision of womanly tabu—
Of the rain-clouds that sweep
O’er the Hill-of-good-luck:
May you speed on your way!

Hiiaka replied to her kahu’s mele in these words:

A noho ana,
E na hoaiku,
E na hoa haele,
I uka o Ka-li’u-la,
I Moe-awakea.

TRANSLATION

Kinsmen, allies, travel-mates,


You rest in upland Ka-li’u;
There taste you midday repose.

Perhaps it was that Hiiaka failed to manifest in her carriage and department
the dignity and tabu that hedges in an alii or an akua; perhaps the rough
hearted Pi’i-ke-a-nui, sailor-fashion, deemed himself outside the realm of
honor which rules on land. However that might be, as Hiiaka lay decently
covered against the cold wind that drew down the flank of Hale-a-ka-la, this
rude fellow, regardless of every punctilio, stole up to Hiiaka and repeated
his former attempt. Hiiaka caught his hand in mid air and administered this
rebuke:

O Ka-uwiki, mauna ki’eki’e,


Huki a’e la a pa i ka lani:
He po’o-hiwi no kai halulu;
Au ana Moku-hano i ke kai—
He maka no Hana,
O maka kilo i’a.
O kou maka kunou, a,
Ua hopu-hia.

TRANSLATION
Ka-uwiki, famous in story,
While buffeting ocean’s blows,
Aspires to commerce with heaven.
Moku-hano’s palms, that float
Like a boat in the water,
Are watchful eyes to Hana,
Alert for the passing school:
Your wanton vagrant eye
Is caught in the very act.

The canoe grated on the shingly beach. The two young women, rejoiced to
be free at last from the enforced proximity of ship-board, sprang ashore and
with speedy steps put a distance between themselves and the canoe-house.
“That’s right,” called out the steersman. “Make haste to find a bath. We’ll
join you in a short time.”
CHAPTER XVI
KAPO-ULA-KINA’U, A RELATIVE OF HIIAKA—THE
MAIMED GIRL MANA-MANA-IA-KALU-EA
The canoe-men, having used their utmost expedition in landing the freight
and hauling up the canoe and getting it under cover, hastened to meet the
two women at the rendezvous they had suggested. But they were nowhere
to be found. They had disappeared as completely as though the earth had
swallowed them up. When Pi’i-ke-a-nui asked the people of the village as
to the whereabouts of the two young women who had just now landed as
passengers from the canoe, they one and all denied having set eyes upon
them.

Hiiaka had planned a visit with her sister Kapo; but, on reaching Wailuku,
the house was empty; Kapo and her husband Pua-nui had but just started to
make a ceremonious call on Ole-pau, a famous chief of the district. The
receding figure of Kapo was already hazy in the distance, so that it seemed
more than doubtful if the words of Hiiaka’s message reached the ears for
which they were intended:

He ahui hala1 ko Kapo-ula-kina’u,2


Ko ka pili kaumaha;
I ka pili a hala, la, ha-la!
Hala olua, aohe makamaka o ka hale
E kipa aku ai la ho’i i ko hale,
I kou hale, e-e!

TRANSLATION

The clustered hala is Kapo’s shield,


An omen portending disaster.
The traveler came in your absence;
Both of you gone, no one at home—
No lodge for the traveler within,
No hospitality within!

Here is another version of this mele by Hiiaka (furnished by Pelei-oholani).


As the version previously given is confessedly imperfect, in part
conjectural, there having been several hiatuses in the text, I think it well to
give an authorized version, though very different:

He ahui hala na ka makani:3


Hala ka ua,4 noho i na pali, e—
I ka pali aku i Pua-lehei,5 e.
Loli iho la, pulu elo i ka ua, e.
Aohe makamaka e kipa aku ai
I kou hale, e;
E noho ana i ke kai o Kapeku;
E hoolono i ka uwalo, e!

TRANSLATION

A hala bunch, snatched by the wind


That blows from the medicine man,
Pushing the rain to Pua-lehei:
Cold is the traveler and soaking wet,
No friend to give welcome and cheer;
House empty—gone to the seashore;
No one to heed my entreaty.

As Hiiaka passed along the cliff that overlooks the wave-swept beach at
Hono-lua, a pitiful sight met her eye, the figure of a woman crippled from
birth—without hands. Yet, in spite of her maimed condition, the brave spirit
busied herself gathering shell-fish; and when a tumbling wave rolled across
the beach she made herself a partner in its sport and gleefully retreated,
skipping and dancing to the words of a song:

Aloha wale ka i’a lamalama o ku’u aina, la,


Ka i’a kahiko pu no me ka wahine.
Lilo ke hoa, ko’eko’e ka po;
Akahi kona la o aloha mai, e-e!
Aloha Kona, ku’u aina i ka pohu, e-e!

TRANSLATION

How dear the torch-caught fish of my home-land,


The fish embraced by the women folk!
Gone one’s companion, chill grows the night:
Love cheered for a day, then flew away.—
Oh Kona, thou land of peace and of calm!

Search for the hidden meaning of this oli has brought out a marvellous
diversity of opinion. The chief difficulty lies in the interpretation of the
second verse: Ka i’a kahiko pu no me ka wahine, and centers in the
expression kahiko pu. One able critic finds in it an allusion to the
coöperation of women with the men in the work of fishing. Kahiko is a
word of dignity meaning finely apparelled. The addition of the preposition
pu amplifies it and gives it almost the meaning of wrapped together. It
seems probable also that the word i’a, literally fish, is to be taken in an
esoteric sense as a euphemism for man. Putting this interpretation upon it,
the meaning of the expression kahiko pu becomes clear as being wrapped
together, as in the sexual embrace.

Wahine-oma’o was greatly fascinated by the pathos and romance of the


situation and declared she would like to have her for an aikane, an intimate
friend.

Hiiaka replied, “Maimed folk seem to be very numerous in these parts.”

The maimed girl kept up her fishing, her light-hearted dancing and singing:

Ua ino Hono-kohau; he Ulu-au nui ka makani;


Ke ha’iha’i la i ka lau o ka awa.
La’i pono ai ke kai o Hono-lua,
E hele ka wahine i ke kapa kahakai,
Ku’i-ku’i ana i ka opihi,
Wa’u-wa’u ana i kana limu,
Welcome to our website – the ideal destination for book lovers and
knowledge seekers. With a mission to inspire endlessly, we offer a
vast collection of books, ranging from classic literary works to
specialized publications, self-development books, and children's
literature. Each book is a new journey of discovery, expanding
knowledge and enriching the soul of the reade

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.

Let us accompany you on the journey of exploring knowledge and


personal growth!

ebookfinal.com

You might also like