Core Data By Tutorials Aaron Douglas 2024 scribd download
Core Data By Tutorials Aaron Douglas 2024 scribd download
com
https://textbookfull.com/product/core-data-by-tutorials-
aaron-douglas/
OR CLICK BUTTON
DOWNLOAD NOW
https://textbookfull.com/product/design-patterns-by-tutorials-
learning-design-patterns-in-swift-4-2-joshua-greene/
textboxfull.com
https://textbookfull.com/product/core-data-objc-io-florian-kugler/
textboxfull.com
https://textbookfull.com/product/concurrency-by-tutorials-second-
edition-multithreading-in-swift-with-gcd-and-operations-tutorial-team/
textboxfull.com
https://textbookfull.com/product/design-patterns-by-tutorials-third-
edition-learning-design-patterns-in-swift-raywenderlich-tutorial-team/
textboxfull.com
Machine Learning by Tutorials Beginning Machine Learning
for Apple and iOS First Edition Raywenderlich Tutorial
Team
https://textbookfull.com/product/machine-learning-by-tutorials-
beginning-machine-learning-for-apple-and-ios-first-edition-
raywenderlich-tutorial-team/
textboxfull.com
https://textbookfull.com/product/ios-test-driven-development-by-
tutorials-first-edition-learn-real-world-test-driven-development-
joshua-greene/
textboxfull.com
https://textbookfull.com/product/ios-11-by-tutorials-learning-the-new-
ios-apis-with-swift-4-1st-edition-the-raywenderlich-tutorial-team/
textboxfull.com
Core Data in Swift Data Storage and Management for iOS and
OS X 1st Edition Marcus Zarra
https://textbookfull.com/product/core-data-in-swift-data-storage-and-
management-for-ios-and-os-x-1st-edition-marcus-zarra/
textboxfull.com
Notice of Rights
All rights reserved. No part of this book or corresponding materials (such as text,
images, or source code) may be reproduced or distributed by any means without
prior written permission of the copyright owner.
Notice of Liability
This book and all corresponding materials (such as source code) are provided on an
"as is" basis, without warranty of any kind, express of 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 connection with the software or the use of other dealing in
the software.
Trademarks
All trademarks and registered trademarks appearing in this book are the property of
their own respective owners.
raywenderlich.com 2
Core Data by Tutorials
Dedications
"To my husband, Mike, and my parents - all whom have inspired me to
do my best and keep plugging away throughout the years."
— Aaron Douglas
— Saul Mora
— Matthew Morey
"To my wonderful wife Emily and my parents Aldo and Zoraida. Thank
you for always supporting me every step of the way."
— Pietro Rea
raywenderlich.com 3
Core Data by Tutorials
raywenderlich.com 4
Core Data by Tutorials
Rich Turton is the final pass editor of this book. Rich is an iOS
developer for MartianCraft, prolific Stack Overflow participant and
author of a development blog, Command Shift. When he's not in
front of a computer he is usually building Lego horse powered
spaceships (don't ask!) with his daughters.
raywenderlich.com 5
Core Data by Tutorials
raywenderlich.com 6
Core Data by Tutorials
raywenderlich.com 7
Core Data by Tutorials
raywenderlich.com 8
Core Data by Tutorials
raywenderlich.com 9
I Introduction
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 isn’t 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.
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 10
Core Data by Tutorials Introduction
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 and calculate
statistics. You’ll learn all about these features and more in this book.
• Say goodbye to screens and screens of code just to set up the Core Data “stack”.
• Say goodbye to having to tell Swift what type of managed object you're using.
We've updated all the chapters in this book for Swift 3, iOS 10 and Xcode 8.
• Xcode 8.0 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
You can use the iOS 10 Simulator that comes with Xcode for all of the chapters.
raywenderlich.com 11
Core Data by Tutorials Introduction
Once you have these items in place, you’ll be able to follow along with every
chapter in this book.
If you’re a complete beginner to iOS, we suggest you read through The iOS
Apprentice, 5th Edition first. That will give you a solid foundation in building iOS
apps from the ground-up.
If you know the basics of iOS development but are new to Swift, we suggest you
read Swift Apprentice 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: raywenderlich.com/store
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.
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.
raywenderlich.com 12
Core Data by Tutorials Introduction
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.
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.
raywenderlich.com 13
Core Data by Tutorials Introduction
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
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.
raywenderlich.com 14
Core Data by Tutorials Introduction
raywenderlich.com 15
1 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 starter code templates to the Data Model editor.
You’re going to hit the ground running right from the start. By the end of the
chapter you’ll know how to:
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. 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.
Getting started
Open Xcode and create a new iPhone project based on the Single View
Application template. Name the app HitList and make sure Use Core Data is
checked:
raywenderlich.com 16
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 an NSPersistentContainer in AppDelegate.swift.
You’ll learn about each of these pieces in the first few chapters. Later, you’ll even
have the chance to write your own Core Data stack! The standard stack works well
for most apps, but depending on your your app and its data requirements, you can
customize the stack to be more efficient.
Note: Not all Xcode templates under iOS/Application have the option to start
with Core Data. In Xcode 8, only the Master-Detail Application and 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! :]
raywenderlich.com 17
Core Data by Tutorials Chapter 1: Your First Core Data App
Next, drag a Table View from the object library into the view controller, then resize
it so it covers the entire view.
If not already open, use the icon located in the lower left corner of your canvas to
open Interface Builder’s document outline.
Ctrl-drag from the Table View in the document outline to its parent view and
select the Leading Space to Container Margin constraint:
Do this three more times, selecting the constraints Trailing Space to Container
Margin, Vertical Spacing to Top Layout Guide and finally, Vertical Spacing to
Bottom Layout Guide. Adding those four constraints makes the table view fill its
parent view.
raywenderlich.com 18
Core Data by Tutorials Chapter 1: Your First Core Data App
Next, drag a Bar Button Item and place it on the view controller’s navigation bar.
Finally, select the bar button item and change its system item to Add. Your canvas
should look similar to the following screenshot:
Every time you tap the Add button, an alert controller containing a text field will
appear. From there you’ll be able to type someone’s name into the text field.
Tapping Save will save the name, dismiss the alert controller and refresh the table
view, displaying all the names you’ve entered.
But first, you need to make the view controller the table view’s data source. In the
canvas, Ctrl-drag from the table view to the yellow view controller icon above the
navigation bar, as shown below, and click on dataSource:
raywenderlich.com 19
Core Data by Tutorials Chapter 1: Your First Core Data App
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!
Next, name the new IBOutlet property tableView, resulting in the following line:
Next, Ctrl-drag from the Add button into ViewController.swift just below your
viewDidLoad() definition. This time, create an action instead of an outlet, naming
the method addName, with a type UIBarButtonItem:
You can now refer to the table view and the bar button item’s action in code.
Next, you’ll set up the model for the table view. Add the following property to
ViewController.swift below the tableView IBOutlet:
raywenderlich.com 20
Core Data by Tutorials Chapter 1: Your First Core Data App
names is a mutable array holding string values displayed by the table view. Next,
replace the implementation of viewDidLoad() with the following:
This will set a title on the navigation bar and register the UITableViewCell class with
the table view.
// MARK: - UITableViewDataSource
extension ViewController: UITableViewDataSource {
let cell =
tableView.dequeueReusableCell(withIdentifier: "Cell",
for: indexPath)
cell.textLabel?.text = names[indexPath.row]
return cell
}
}
If you’ve ever worked with UITableView, this code should look very familiar. First
you return the number of rows in the table as the number of items in your names
array.
Next, you need a way to add new names so the table view can display them.
Implement the addName IBAction method you Ctrl-dragged into your code earlier:
raywenderlich.com 21
Core Data by Tutorials Chapter 1: Your First Core Data App
self.names.append(nameToSave)
self.tableView.reloadData()
}
alert.addTextField()
alert.addAction(saveAction)
alert.addAction(cancelAction)
Every time you tap the Add button, this method presents a UIAlertController with
a text field and two buttons, Save and Cancel.
Save inserts the text fields current text into the names array then reloads the table
view. Since the names array is the model backing the table view, whatever you type
into the text field will appear in the table view.
Finally, build and run your app for the first time. Next, tap the Add button. The
alert controller will look like this:
raywenderlich.com 22
Core Data by Tutorials Chapter 1: Your First Core Data App
Add four or five names to the list. You should see something similar to below:
Your table view will display the data and your array will store the names, but the
big thing missing here is persistence. The array is in memory but if you force quit
the app or reboot your device, your hit list will be wiped out.
raywenderlich.com 23
Core Data by Tutorials Chapter 1: Your First Core Data App
Core Data provides persistence, meaning it can store data in a more durable state
so it can outlive an app re-launch or a device reboot.
You haven’t added any Core Data yet, so nothing should persist after you navigate
away from the app. Let’s test this out. Press the Home button if you’re using a
physical device or the equivalent (Shift+⌘+H) if you’re using the Simulator. This
will take you back to the familiar app grid on the home screen:
From the home screen, tap the HitList icon to bring the app back to the
foreground. The names are still on the screen. What happened?
When you tap the Home button, the app currently in the foreground goes to the
background. When this happens, the operating system flash-freezes everything
currently in memory, including the strings in the names array. Similarly, when it’s
time to wake up and return to the foreground, the operating system restores what
used to be in memory as if you’d never left.
No, not really. If you had completely killed the app in the fast app switcher or
turned off your phone, those names would be gone. You can verify this, as well.
With the app in the foreground, double tap the Home button to enter the fast app
switcher, like so:
raywenderlich.com 24
Core Data by Tutorials Chapter 1: Your First Core Data App
From here, flick the HitList app snapshot upwards to terminate the app. There
should be no trace of HitList in living memory (no pun intended). Verify the names
are gone by returning to the home screen and tapping on the HitList icon to trigger
a fresh launch.
All that matters is the names are still there when the app comes back!
So the real test of persistence, is whether your data is still there after a fresh app
launch.
Up to this point, you’ve been using plain old Swift strings to store the names in
memory. In this section, you’ll replace these strings with Core Data objects.
The first step is to create a managed object model, which describes the way Core
Data represents data on disk.
raywenderlich.com 25
Core Data by Tutorials Chapter 1: Your First Core Data App
By default, Core Data uses a SQLite database as the persistent store, so you can
think of the Data Model as the database schema.
Note: You’ll come across the word managed quite a bit in this book. If you see
“managed” in the name of a class, such as in NSManagedObjectContext, chances
are you are dealing with a Core Data class. “Managed” refers to Core Data’s
management of the life cycle of Core Data objects.
However, don’t assume all Core Data classes contain the word “managed”.
Actually, most don’t. For a comprehensive list of Core Data classes, check out
the Core Data framework reference in the documentation browser.
Since you’ve elected to use Core Data, Xcode automatically created a Data Model
file for you and named it HitList.xcdatamodeld.
Open HitList.xcdatamodeld. As you can see, Xcode has a powerful Data Model
editor:
raywenderlich.com 26
Core Data by Tutorials Chapter 1: Your First Core Data App
The Data Model editor has a lot of features you’ll explore in later chapters. For now,
let’s focus on creating a single Core Data entity.
Click on Add Entity on the lower-left to create a new entity. Double-click the new
entity and change its name to Person, like so:
You may be wondering why the model editor uses the term Entity. Weren’t you
simply defining a new class? As you’ll see shortly, Core Data comes with its own
vocabulary. Here’s a quick rundown of some terms you’ll commonly encounter:
Note: You’ve probably noticed, entities sound a lot like a classes. Likewise,
attributes and relationships sound a lot like properties. What’s the difference?
You can think of a Core Data entity as a class definition and the managed
object as an instance of that class.
raywenderlich.com 27
Core Data by Tutorials Chapter 1: Your First Core Data App
Now you know what an attribute is, you can add an attribute to Person object
created earlier. Open HitList.xcdatamodeld. Next, select Person on the left-hand
side and click the plus sign (+) under Attributes.
Set the new attribute’s name to, er, name and change its type to String:
In Core Data, an attribute can be of one of several data types. You’ll learn about
these in the next few chapters.
import CoreData
This import is all you need to start using the Core Data API in your code.
raywenderlich.com 28
Core Data by Tutorials Chapter 1: Your First Core Data App
You’ll store Person entities rather than string names, so you rename the array
serving as the table view’s data model to people. It now holds instances of
NSManagedObject rather than simple strings.
NSManagedObject represents a single object stored in Core Data; you must use it to
create, edit, save and delete from your Core Data persistent store. As you’ll see
shortly, NSManagedObject is a shape-shifter. It can take the form of any entity in
your Data Model, appropriating whatever attributes and relationships you defined.
Since you’re changing the table view’s model, you must also replace both data
source methods implemented earlier. Replace your UITableViewDataSource
extension with the following:
// MARK: - UITableViewDataSource
extension ViewController: UITableViewDataSource {
func tableView(_ tableView: UITableView,
numberOfRowsInSection section: Int) -> Int {
return people.count
}
Note how you grab the name attribute from the NSManagedObject. It happens here:
cell.textLabel?.text =
person.value(forKeyPath: "name") as? String
Why do you have to do this? As it turns out, NSManagedObject doesn’t know about
the name attribute you defined in your Data Model, so there’s no way of accessing it
directly with a property. The only way Core Data provides to read the value is key-
value coding, commonly referred to as KVC.
raywenderlich.com 29
Exploring the Variety of Random
Documents with Different Content
megérkezve, a színpadon – hogy annál nagyobb legyen a kísérteties
hangulat – bár az őrültségét csak fölötte hézagosan magyarázza
meg, hogy ő is elveszítette a maga kék küraszirját, akit kétszer látott:
először a bálteremben s másodszor, amikor a kék küraszirok a
halálba indulásuk előtt utóljára dáridóztak Bécsben; se az, hogy
azóta egy kissé megfürdött a posványban… És nincs mit szólni a
gyakornokról sem, aki ezt a másik leányt még a kék küraszirok
haláltánca előtt elhagyta a Moser-leányért és az egész darabon át
nem tudja megérteni, hogy ennek pedig ő nem kell, főképpen azért
nem, mert a betegápolásba idejekorán belefáradt nő nem kívánkozik
az erdő magánosságába. A néző se tudja megérteni, hogy ez a
gyakornok hogyan és miért került bele ebbe a darabba.
A fejlemények is csak valami hosszú epilógnak a minimumig
lemérsékelt hatását tehetik a nézőre. Hogy a kék kürasztirok mind
egy szálig áldozatául estek érthetetlen kiküldetésüknek és csodás
véletlenségből csak egy ember menekült meg közülök, éppen az, aki
– élnivágyásból – egyedül debachált a rendelés ellen, de ez az egy
is, szíves meglepetésül a nézőnek, modernül elmés
következetlenséggel, agyonlőtte magát, hogy doktor Schindler-
Mirákoló szamárnak deklarálhassa – már csak tudomásul szolgál,
mint a jegyzőkönyvekben szokás mondani. Hasonlóképpen: hogy
egy darab egyetlen maradi alakja, Richterné, Kata-Ophéliának az
anyja, továbbra is mindennap eljár a templomba.
A nézőt most már csak a Moser-leány sorsa érdekelheti. Tehát: a
kék küraszirja visszautasította azt a kivánságát, hogy haljanak meg
együtt; a katona elment a csatába, hogy büntetésül és példaadás
okából halhasson meg, a leány pedig egyedül nem tudott meghalni;
és minthogy Mirákoló mester azt a kis apagyilkossági ügyet
szerencsésen elsimította a hatóságok előtt, tovább él, virágot szed,
de nem tud felejteni. A jó Mirákoló, aki továbbra is atyailag
gondoskodik róla, azt a tanácsot adja neki, hogy ha már a szíve
ellenállhatatlanul a katonasághoz vonja, álljon be az egészségügyi
csapatokhoz betegápolónőnek. „De hát akkor miért öltem meg az
apámat?! – kérdhetné tőle Moser Mari – ha továbbra is
betegápolónőnek kell maradnom!“
És most már a szerző áll elő a maga meglepetésével. Kiderül
ugyanis a darab végén, hogy mindez azt a tanácsot kivánta
példázni, hogy: „Hallgassátok meg, amikor az élet szava hí
benneteket!“ Hát hiszen ezek mind hallgattak az élet szavára!… De
vajjon kívánatos-e az élet szavára hallgatni, ha ennek a
szófogadásnak ilyen gyors pusztulás, az apostoli igék áhítatos
hallgatóinak ilyen tömeges halála jár a nyomában?! („Majd szépen
fogunk hallgatni erre a hivogatásra!…“ – mondanák sokan
Budapesten.) De pardon!… „Félreértés!… – folytatja Schnitzler
doktor – Életnek én csak a szerelmi életet nevezem! És ennek az
igazi életnek egyetlen órájáért, az élet minden örömének egyetlen
éjszakába való belesűrűsítéséért érdemes feláldozni mindent, a
hosszú életet, a tartalom nélküli évek egész értéktelen sokaságát és
minden tekintetet, amelyeket komolyan szoktatok venni, amelyekért
közületek olyan sokan tartózkodnak az élet kéjeinek egyetlen
éjszakába való komprimálásától!“ Vagy úgy?! Az már más. Hanem
erről az Élet szava című drámából kissé bajos meggyőződni. Mert
Moser Mari a harmadik felvonásban csak egyetlen mondatban
nyilatkozik az éjszakájáról: „azután megértem üdvösséget, ahogy
soha nem is álmodtam, kétségbeesést, ahogy ember el nem
képzelheti… mi keresni valóm van még a földön?“ – de nem mondja,
hogy az az üdvösség fölért minden utána következő
kétségbeeséssel és hogy szívesen vállalja a hosszú kétségbeesést,
mint annak a rövid üdvösségnek az árát, váltságdíját. (Amint hogy a
véralkata szerint mindig különbözőképpen ítéli meg az ember, hogy
az élet örömeivel való sokféle gazdálkodás közül melyik a helyes; s
a legtöbb embernek erről minduntalan más-más a véleménye, a
körülményekhez képest.) Ahogy pedig Kata agyongyönyörködi
magát, az erősen hasonlít a sárba fulladáshoz; ez a kép se
meggyőző, még csak nem is csábító. De ne tünődjünk ezen
hosszan, mert mire lélekzetet vehetünk, Schnitzler doktor már maga
is ellentmond magának. Mégis csak jó életben maradni, mert: „Lássa
– mondja Schnitzler doktor Marinak – ma virágot szed az erdő
szélén és odanyújtja a homlokát a nyári szellőnek…“ „Maga él, Mari,
a többi csak volt. Amaz éjszaka és ama reggel óta is nappalok
következtek az éjszakára… virágot szed, a ragyogó déli égbolt alatt
beszél velem, stb., mindez élet… és ki tudja, nem fogja-e egyszer,
idővel, sokkal tisztábban és mélyebben hallani az élet szavát, mint
azon az éjjelen, mikor dolgokat élt át, melyek oly félelmes és izzó
nevűek, mint gyilkosság és szerelem?!…“ Tehát a hosszú élet, a
tartalom nélküli évek egész értéktelen sokasága se kutya?!… már
csak azért sem, mert még sokszor lehet hallani benne „az élet hívó
szavát“?! De hát melyik a választani való, amikor választani kell:
minden földi gyönyörűségnek egyetlen fenséges éjszakába való
komprimálása vagy a tartalom nélküli, de napsütéses és várandós
élet sokasága? Hiszen a darabjának erre a kérdésére kellene
felelnie!… hiszen a szerző maga vetette fel a kérdést!… De
Schnitzler doktor úgy felel a saját kérdésére, mint a fázódó és éhes
cigány, akitől azt kérdezték, hogy mit választ: melegedni akar-e
inkább, vagy enni? A legjobb – mondja – a tűznél szalonnát pirítani!
Bizonyára, de mintha tréfálna, mikor a maga kérdésére nem akar
felelni. Vagy maga se tudja, hogy tulajdonképpen mit kiván
mondani?!… Semmi különöset, csak egy kicsit kacérkodni óhajtott
az epikureizmussal és egyben az amoralista világfelfogással?!
Utoljára, mintha mégis jobban húzna a hosszú élethez, az akár
tartalom nélkül való, de nem reménytelen évek nem egészen
értéktelen sokaságához, mint az élvezeteknek huszonnégy órába
való kögítéséhez. Mert azt mondatja Schindler doktorral Marinak
Kata holttesténél: „Az, hogy én jó ember vagyok… hogy maga
gonosztevő… és hogy ez a halott bűnös volt… csak: szavak!
Magának még süt a nap és nekem… és azoknak (a gyerekekre
mutat, akik átszaladnak a réten). Ennek már nem. Más egyebet
semmi bizonyosat se tudok a világon! (Gyerekek nevetve szaladnak
át a réten és eltünnek az erdőben.)“ Vége.
Hát éppen ez az okoskodás – amelyet Schindler doktor
tanulságul bök ki a darab pointejének – az a valami, amire joggal
lehet elmondani, hogy csak: Szavak!… Üres beszéd!… Frivol játék a
gondolattal és a kifejezéssel!… Mert régi útszéli igazság, hogy kevés
a bizonyosságunk, de nem igaz, hogy az emberi elmének sok ezer
éves nyugtalansága teljességgel semmi eredményhez nem vezetett
volna s hogy mindazok a fogalmak, amelyekhez a jó és rossz
kérdése dolgában az emberek mindezidáig eljutottak: csupa fallácia.
Csakhogy arra, hogy ehhez a kérdéshez hozzászólhasson, Schitzler
Arthurban nincs meg a kellő komolyság. (1911 november.)
XLVI.
SCHÖNHERR.
Hit és haza.
BARRIE.
Egyenlőség.
PINERO.
Ne váljunk el.
SHAW.
Crampton úr valaha olyan nőt vett feleségül, aki nem szerette őt.
Bár az asszony a fajfentartáshoz a szerelmet fölöslegesnek tartja,
férjének azt a bűnét, hogy őt a feleségévé tette, jónak látja minden
rendelkezésére álló eszközzel megtorolni. Nemcsak hogy a
legteljesebben kielégíti önállóságra törő hajlamait, nemcsak hogy a
közéleti szereplésnek él és szónoklatokat tart a nők jogairól, hanem
üres óráiban azzal szórakozik, hogy agyonbosszantja a férjét. Mikor
már három gyermekük van, Crampton úrnak elfogy a türelme és
megszökik a családjától. Nyugodt lelkiismerettel teszi ezt, mert a
felesége is gazdag. Az asszony elköltözik Madeirába s itt a maga
elveinek szellemében, exotikus nevelésben részesíti a gyermekeit,
akik exotikus állatkákká növekednek fel. Tizennyolc év telik el így.
Végre az asszony, aki férje eltűnése óta a leánykori nevét használja,
a gyermekeivel egy angolországi fürdőhelyre utazik s ott a családot
egy kacskaringós véletlen összehozza Cramptonnal.
A kisebbik leánynak ugyanis megfájul a foga s egy ifjú,
éhenkórász fogorvoshoz kerülnek, akit meghívnak ebédre. A derék
ifjú, aki különben sem tudja fékezni azt a mániáját, hogy folytonosan
locsoghasson-fecseghessen, annyival inkább szeretné elfogadni a
meghívást, mert nyomban beleszeretett a nagyobbik kisasszonyba s
az egész családról szerteáradó gazdagság-illatba, de malőrje van
szegénynek. A háziura, akinek már jókora összegű házbérrel
tartozik, szintén aznap huzatta ki vele a fogát s a háziura is meghívja
ebédre, ugyanakkorra, amikorra amazok. A Buridán szamárnak
szituációjában lévő, mindenkit elbájoló éhenkórász nem meri
visszautasítani háziurának a meghívását s a nagyérdekességű
bonyodalmat csak úgy véli megoldhatónak, ha a háziura is a
madeirai családnál fog ebédelni. A háziúr se talál más kivezető utat
a nehéz esetből, mint hogy a kellemes fogorvos kedvéért megegye
az ismeretlen család ebédjét.
A háziúr persze éppen Mr. Crampton. Mikor ez a gentleman
észreveszi, hogy hová jutott, az első percben el akar illanni, de
utóbb, gyermekeinek láttán, valami nosztalgia-féle fogja el a családi
élet után. Tulajdonképpen maga se tudja, hogy mit akar, de azért
diadalmasan versenyezve a legtürelmesebb szamárral, végigvárja
ezt a felvonást. Nos ahogyan a kedves család a véletlenül előkerült
férjet és apát fogadja, az már nem farsangi tréfa, nem is
kutyakomédia, hanem valóságos szaturnália. Pedig kivált a
gyerekeknek, ezeknek a talán nem is Madeirából, hanem a Fidzsi-
szigetekről érkezett infámis kölyköknek semmi egyéb okuk nincs az
apjukkal cudarkodniok, csak az, hogy kitálalhassák, mennyire
kiállhatatlanok tudnak lenni, milyen borzasztóan neveletleneknek
nevelte őket az anyjuk, és hogy mennyivel alávalóbbak tudnak lenni
a gazdagság minden kényelmében élő, jól öltözött fiatal lények a
kannibál-gyerekeknél vagy növekedni kezdő párduc-ivadékoknál.
Mintha valami perverz gyönyörűséget találnának annak
exhibiciójában, hogy mekkora szemtelenségre képesek és milyen
magasfokú utálatosságot tudnak kifejteni. Crampton pedig ahelyett,
hogy visszafutballozná őket Madeira kapujába, szelíden
elégedetlenkedik velök vagy babuskálja őket.
Eközben a nézőnek végig kell hallgatnia, hogy dr. Valentine, aki
alighanem egy madeirai borbélyműhelyben végezte a fogászati
tanulmányait, micsoda szóáradattal vall szerelmet, a „szerelem“ szó
használata nélkül, de nem csupa e vagy i hangzó alkalmazásával, a
„szerelem“ szótól iszonyodó és különben rendkívül együgyű Glória
kisasszonynak. Azonkívül végig kell néznie egy Pry Pál-szerűen
minden lében kanál, tűrhetetlenül konfidens és szánalmas
életbölcsességeket kenetesen szónokolgató pincérnek a színpadon
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.
textbookfull.com