SlideShare a Scribd company logo
Download the full version and explore a variety of ebooks
or textbooks at https://ebookultra.com
iOS 9 Programming Fundamentals with Swift Swift
Xcode and Cocoa Basics 2nd Edition Matt Neuburg
_____ Follow the link below to get your download now _____
https://ebookultra.com/download/ios-9-programming-
fundamentals-with-swift-swift-xcode-and-cocoa-basics-2nd-
edition-matt-neuburg/
Access ebookultra.com now to download high-quality
ebooks or textbooks
Here are some recommended products for you. Click the link to
download, or explore more at ebookultra.com
Programming iOS 6 3rd Edition Fundamentals of iPhone iPad
and iPod touch Development Matt Neuburg
https://ebookultra.com/download/programming-ios-6-3rd-edition-
fundamentals-of-iphone-ipad-and-ipod-touch-development-matt-neuburg/
Programming iOS 10 Dive Deep into Views View Controllers
and Frameworks 7th Edition Matt Neuburg
https://ebookultra.com/download/programming-ios-10-dive-deep-into-
views-view-controllers-and-frameworks-7th-edition-matt-neuburg/
iOS 8 SDK Development Creating iPhone and iPad Apps with
Swift The Pragmatic Programmers 2nd Edition Adamson
https://ebookultra.com/download/ios-8-sdk-development-creating-iphone-
and-ipad-apps-with-swift-the-pragmatic-programmers-2nd-edition-
adamson/
The Basic Writings of Jonathan Swift Jonathan Swift
https://ebookultra.com/download/the-basic-writings-of-jonathan-swift-
jonathan-swift/
Learn Swift on the Mac For OS X and iOS 2015th Edition
Waqar Malik
https://ebookultra.com/download/learn-swift-on-the-mac-for-os-x-and-
ios-2015th-edition-waqar-malik/
Process Selection 2nd Edition 2003 K G Swift
https://ebookultra.com/download/process-selection-2nd-
edition-2003-k-g-swift/
Tom Swift and his Submarine Boat The fourth book in the
Tom Swift series Victor Appleton
https://ebookultra.com/download/tom-swift-and-his-submarine-boat-the-
fourth-book-in-the-tom-swift-series-victor-appleton/
Bridge Team Management 2nd Revised edition Edition Aj
Swift
https://ebookultra.com/download/bridge-team-management-2nd-revised-
edition-edition-aj-swift/
Swift 2 Blueprints 1st Edition Costa
https://ebookultra.com/download/swift-2-blueprints-1st-edition-costa/
iOS 9 Programming Fundamentals with Swift Swift Xcode and Cocoa Basics 2nd Edition Matt Neuburg
iOS 9 Programming Fundamentals with Swift Swift
Xcode and Cocoa Basics 2nd Edition Matt Neuburg
Digital Instant Download
Author(s): Matt Neuburg
ISBN(s): 9781491936771, 1491936770
Edition: 2
File Details: PDF, 4.33 MB
Year: 2015
Language: english
Matt Neuburg
iOS 9
Programming
Fundamentals
with Swift
SWIFT, XCODE, AND COCOA BASICS
C
o
v
e
r
s
i
O
S
9
,
X
c
o
d
e
7
,
a
n
d
S
w
i
f
t
2
.
0
MOBILE DEVELOPMENT / IOS
iOS 9 Programming Fundamentals with Swift
ISBN: 978-1-491-93677-1
US $49.99 CAN $57.99
“
Neuburg is my favorite
programming book
writer, period.”
—John Gruber
Daring Fireball
Matt Neuburg has a PhD in Classics
and has taught at many colleges and
universities. He has served as editor
of MacTech magazine and as contrib-
uting editor for TidBITS. He has writ-
ten many OS X and iOS applications.
Previous books include Programming
iOS 8, REALbasic: The Definitive Guide,
and AppleScript: The Definitive Guide.
Twitter: @oreillymedia
facebook.com/oreilly
Move into iOS development by getting a firm grasp of its fundamentals,
including the Xcode IDE, the Cocoa Touch framework, and Swift 2.0—the
latest version of Apple's acclaimed programming language. With this
thoroughly updated guide, you'll learn Swift’s object-oriented concepts,
understand how to use Apple's development tools, and discover how
Cocoa provides the underlying functionality iOS apps need to have.
■
■ Explore Swift’s object-oriented concepts: variables and
functions, scopes and namespaces, object types and instances
■
■ Become familiar with built-in Swift types such as numbers,
strings, ranges, tuples, Optionals, arrays, dictionaries, and sets
■
■ Learn how to declare, instantiate, and customize Swift object
types—enums, structs, and classes
■
■ Discover powerful Swift features such as protocols and generics
■
■ Catch up on Swift 2.0 innovations: option sets, protocol
extensions, error handling, guard statements, availability
checks, and more
■
■ Tour the lifecycle of an Xcode project from inception to App Store
■
■ Create app interfaces with nibs and the nib editor, Interface Builder
■
■ Understand Cocoa’s event-driven model and its major design
patterns and features
■
■ Find out how Swift communicates with Cocoa’s C and
Objective-C APIs
Once you master the fundamentals, you'll be ready to
tackle the details of iOS app development with author
Matt Neuburg's companion guide, Programming iOS 9.
Programming iOS 9
978-1-491-93685-6
Matt Neuburg
Boston
SECOND EDITION
iOS 9 Programming
Fundamentals with Swift
Swift, Xcode, and Cocoa Basics
iOS 9 Programming Fundamentals with Swift, Second Edition
by Matt Neuburg
Copyright © 2016 Matt Neuburg. All rights reserved.
Printed in the United States of America.
Published by O’Reilly Media, Inc., 1005 Gravenstein Highway North, Sebastopol, CA 95472.
O’Reilly books may be purchased for educational, business, or sales promotional use. Online editions are
also available for most titles (http://safaribooksonline.com). For more information, contact our corporate/
institutional sales department: 800-998-9938 or corporate@oreilly.com.
Editor: Rachel Roumeliotis
Production Editor: Kristen Brown
Proofreader: O’Reilly Production Services
Indexer: Matt Neuburg
Cover Designer: Karen Montgomery
Interior Designer: David Futato
Illustrator: Matt Neuburg
April 2015: First Edition
October 2015: Second Edition
Revision History for the Second Edition:
2015-09-23: First release
See http://oreilly.com/catalog/errata.csp?isbn=9781491936771 for release details.
The O’Reilly logo is a registered trademark of O’Reilly Media, Inc. iOS 9 Programming Fundamentals with
Swift, the image of a harp seal, and related trade dress are trademarks of O’Reilly Media, Inc.
While the publisher and the author have used good faith efforts to ensure that the information and instruc‐
tions contained in this work are accurate, the publisher and the author disclaim all responsibility for errors
or omissions, including without limitation responsibility for damages resulting from the use of or reliance
on this work. Use of the information and instructions contained in this work is at your own risk. If any code
samples or other technology this work contains or describes is subject to open source licenses or the intel‐
lectual property rights of others, it is your responsibility to ensure that your use thereof complies with such
licenses and/or rights.
ISBN: 978-1-491-93677-1
[LSI]
Table of Contents
Preface. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xiii
Part I. Language
1. The Architecture of Swift. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
Ground of Being 3
Everything Is an Object? 5
Three Flavors of Object Type 6
Variables 6
Functions 8
The Structure of a Swift File 9
Scope and Lifetime 11
Object Members 12
Namespaces 13
Modules 13
Instances 14
Why Instances? 16
self 19
Privacy 20
Design 21
Object Types and APIs 22
Instance Creation, Scope, and Lifetime 24
Summary and Conclusion 25
2. Functions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
Function Parameters and Return Value 27
Void Return Type and Parameters 30
iii
Function Signature 32
External Parameter Names 32
Overloading 35
Default Parameter Values 36
Variadic Parameters 37
Ignored Parameters 38
Modifiable Parameters 38
Function In Function 42
Recursion 44
Function As Value 44
Anonymous Functions 47
Define-and-Call 52
Closures 53
How Closures Improve Code 55
Function Returning Function 56
Closure Setting a Captured Variable 59
Closure Preserving Its Captured Environment 59
Curried Functions 61
3. Variables and Simple Types. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
Variable Scope and Lifetime 63
Variable Declaration 65
Computed Initializer 67
Computed Variables 68
Setter Observers 71
Lazy Initialization 73
Built-In Simple Types 75
Bool 76
Numbers 77
String 85
Character 89
Range 93
Tuple 95
Optional 98
4. Object Types. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111
Object Type Declarations and Features 111
Initializers 113
Properties 119
Methods 122
iv | Table of Contents
Subscripts 124
Nested Object Types 126
Instance References 127
Enums 129
Case With Fixed Value 130
Case With Typed Value 131
Enum Initializers 132
Enum Properties 134
Enum Methods 135
Why Enums? 136
Structs 137
Struct Initializers, Properties, and Methods 137
Struct As Namespace 139
Classes 139
Value Types and Reference Types 140
Subclass and Superclass 144
Class Initializers 150
Class Deinitializer 158
Class Properties and Methods 159
Polymorphism 161
Casting 164
Type Reference 168
Protocols 173
Why Protocols? 174
Protocol Type Testing and Casting 176
Declaring a Protocol 177
Optional Protocol Members 179
Class Protocol 180
Implicitly Required Initializers 181
Literal Convertibles 183
Generics 184
Generic Declarations 186
Type Constraints 188
Explicit Specialization 190
Associated Type Chains 191
Additional Constraints 194
Extensions 197
Extending Object Types 198
Extending Protocols 200
Extending Generics 203
Table of Contents | v
Umbrella Types 205
AnyObject 205
AnyClass 208
Any 209
Collection Types 210
Array 210
Dictionary 224
Set 229
5. Flow Control and More. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 235
Flow Control 235
Branching 236
Loops 248
Jumping 253
Operators 265
Privacy 268
Private Declaration 269
Public Declaration 271
Privacy Rules 272
Introspection 272
Memory Management 273
Weak References 275
Unowned References 276
Weak and Unowned References in Anonymous Functions 278
Memory Management of Protocol-Typed References 281
Part II. IDE
6. Anatomy of an Xcode Project. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 285
New Project 285
The Project Window 288
The Navigator Pane 289
The Utilities Pane 295
The Editor 296
The Project File and Its Dependents 299
The Target 301
Build Phases 302
Build Settings 304
Configurations 305
vi | Table of Contents
Schemes and Destinations 306
From Project to Running App 309
Build Settings 311
Property List Settings 312
Nib Files 313
Additional Resources 313
Code Files and the App Launch Process 316
Frameworks and SDKs 321
Renaming Parts of a Project 324
7. Nib Management. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 325
The Nib Editor Interface 326
Document Outline 328
Canvas 330
Inspectors and Libraries 332
Nib Loading 334
When Nibs Are Loaded 334
Manual Nib Loading 336
Connections 338
Outlets 338
The Nib Owner 340
Automatically Configured Nibs 343
Misconfigured Outlets 344
Deleting an Outlet 345
More Ways to Create Outlets 346
Outlet Collections 349
Action Connections 350
More Ways to Create Actions 352
Misconfigured Actions 353
Connections Between Nibs — Not! 354
Additional Configuration of Nib-Based Instances 354
8. Documentation. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 359
The Documentation Window 360
Class Documentation Pages 362
Sample Code 365
Quick Help 366
Symbols 367
Header Files 368
Internet Resources 369
Table of Contents | vii
9. Life Cycle of a Project. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 371
Device Architecture and Conditional Code 371
Backward Compatibility 372
Device Type 374
Version Control 375
Editing and Navigating Your Code 377
Autocompletion 378
Snippets 380
Fix-it and Live Syntax Checking 381
Navigation 382
Finding 384
Running in the Simulator 385
Debugging 386
Caveman Debugging 386
The Xcode Debugger 389
Testing 395
Clean 401
Running on a Device 402
Running Without a Developer Program Membership 403
Obtaining a Developer Program Membership 404
Obtaining a Certificate 405
Obtaining a Development Provisioning Profile 407
Running the App 408
Profile and Device Management 409
Profiling 409
Gauges 410
Instruments 410
Localization 413
Localizing the Info.plist 414
Localizing a Nib File 416
Localizing Code Strings 418
Localizing With XML Files 420
Archiving and Distribution 422
Ad Hoc Distribution 424
Final App Preparations 426
Icons in the App 426
Other Icons 427
Launch Images 428
Screenshots and Video Previews 429
Property List Settings 430
viii | Table of Contents
Submission to the App Store 431
Part III. Cocoa
10. Cocoa Classes. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 437
Subclassing 437
Categories and Extensions 440
How Swift Uses Extensions 441
How You Use Extensions 441
How Cocoa Uses Categories 442
Protocols 443
Informal Protocols 445
Optional Methods 446
Some Foundation Classes 448
Useful Structs and Constants 448
NSString and Friends 450
NSDate and Friends 452
NSNumber 454
NSValue 455
NSData 456
Equality and Comparison 457
NSIndexSet 458
NSArray and NSMutableArray 459
NSDictionary and NSMutableDictionary 461
NSSet and Friends 462
NSNull 463
Immutable and Mutable 463
Property Lists 464
Accessors, Properties, and Key–Value Coding 465
Swift Accessors 466
Key–Value Coding 467
Uses of Key–Value Coding 468
KVC and Outlets 470
Key Paths 470
Array Accessors 471
The Secret Life of NSObject 472
11. Cocoa Events. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 475
Reasons for Events 475
Table of Contents | ix
Subclassing 476
Notifications 477
Receiving a Notification 478
Unregistering 481
Posting a Notification 482
NSTimer 483
Delegation 484
Cocoa Delegation 484
Implementing Delegation 486
Data Sources 488
Actions 488
The Responder Chain 492
Deferring Responsibility 493
Nil-Targeted Actions 493
Key–Value Observing 494
Swamped by Events 498
Delayed Performance 501
12. Memory Management. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 505
Principles of Cocoa Memory Management 505
Rules of Cocoa Memory Management 506
What ARC Is and What It Does 508
How Cocoa Objects Manage Memory 508
Autorelease Pool 509
Memory Management of Instance Properties 511
Retain Cycles and Weak References 512
Unusual Memory Management Situations 514
Nib Loading and Memory Management 519
Memory Management of CFTypeRefs 520
Property Memory Management Policies 521
Debugging Memory Management Mistakes 524
13. Communication Between Objects. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 525
Visibility by Instantiation 526
Visibility by Relationship 528
Global Visibility 529
Notifications and KVO 530
Model–View–Controller 531
A. C, Objective-C, and Swift. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 535
x | Table of Contents
Index. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 561
Table of Contents | xi
iOS 9 Programming Fundamentals with Swift Swift Xcode and Cocoa Basics 2nd Edition Matt Neuburg
Preface
On June 2, 2014, Apple’s WWDC keynote address ended with a shocking announce‐
ment: “We have a new programming language.” This came as a huge surprise to the
developer community, which was accustomed to Objective-C, warts and all, and doubt‐
ed that Apple could ever possibly relieve them from the weight of its venerable legacy.
The developer community, it appeared, had been wrong.
Having picked themselves up off the floor, developers immediately began to examine
this new language — Swift — studying it, critiquing it, and deciding whether to use it.
My own first move was to translate all my existing iOS apps into Swift; this was enough
to convince me that, for all its faults, Swift deserved to be adopted by new students of
iOSprogramming,andthatmybooks,therefore,shouldhenceforthassumethatreaders
are using Swift.
The Swift language is designed from the ground up with these salient features:
Object-orientation
Swift is a modern, object-oriented language. It is purely object-oriented: “Every‐
thing is an object.”
Clarity
Swift is easy to read and easy to write, with minimal syntactic sugar and few hidden
shortcuts. Its syntax is clear, consistent, and explicit.
Safety
Swift enforces strong typing to ensure that it knows, and that you know, what the
type of every object reference is at every moment.
Economy
Swift is a fairly small language, providing some basic types and functionalities and
no more. The rest must be provided by your code, or by libraries of code that you
use — such as Cocoa.
xiii
Exploring the Variety of Random
Documents with Different Content
clear as crystal? See the twelve foundations of her walls, and in
them the names of the twelve apostles of the Lamb. And the
building of the walls of it are of jasper; and the city is pure gold, like
unto clear glass; and the foundations are garnished with all manner
of precious stones. And the twelve gates are twelve pearls, every
several gate is of one pearl; and the street of the city is pure gold,
as it were transparent glass. There is no temple in it; for the Lord
God Almighty, and the Lamb are the temple of it. It hath no need of
the sun, neither of the moon in it; for the glory of God doth lighten
it, and the Lamb is the light thereof; and the nations of them which
are saved, shall walk in the light of it. These sayings are faithful and
true: And the Lord God of the holy prophets sent his angels and his
own Son, to shew unto his servants the things which must shortly be
done.[381] Say now to all this, This is thy rest, O my soul! And this
must be the place of thy everlasting habitation. Let all the sons of
Sion rejoice, let the daughters of Jerusalem be glad; for great is the
Lord, and greatly to be praised in the city of our God, in the
mountain of his holiness. Beautiful for situation, the joy of the whole
earth is Mount Sion. God is known in her palaces for a refuge.[382]
[379] Luke xii, 32.
[380] Psalm xlviii, 12, 13.
[381] Revelation xxi, 11-24. xxii, 6.
[382] Psalm xlviii, 11, 1-3.
§ 18. Yet proceed on. The soul that loves, ascends frequently, and
runs familiarly through the streets of the heavenly Jerusalem,
visiting the Patriarchs and prophets, saluting the apostles, and
admiring the armies of martyrs: So do thou lead on thy heart as
from street to street; bring it into the palace of the Great King; lead
it, as it were, from chamber to chamber. Say to it; Here must I
lodge; here must I live; here must I praise; here must I love, and be
beloved. I must shortly be one of this heavenly choir, and be better
skilled in the music. Among this blessed company must I take up my
place, my voice must join to make up the melody. My tears will then
be wiped away; my groans be turned to another tune; my cottage of
clay be changed to this palace; my prison-rags to these splendid
robes; and my sordid flesh shall be put off, and such a sun-like
spiritual body be put on: For the former things are here passed
away.[383] Glorious things are spoken of thee, O city of God![384]
When I look upon this glorious place, what a dunghill and dungeon,
methinks is earth? O what difference betwixt a man feeble, pained,
groaning, dying, rotting in the grave, and one of these triumphant,
shining saints? Here shall I drink of the river of pleasures, the
streams whereof make glad the city of God.[385] Must Israel, under
the bondage of the law, serve the Lord with joyfulness, and with
gladness of heart, for the abundance of all things.[386] Surely I shall
serve him with joyfulness and gladness of heart, for the abundance
of glory. Did persecuted saints take joyfully the spoiling of their
goods?[387] And shall not I take joyfully such a full reparation of all
my losses? Was it a celebrated day wherein the Jews rested from
their enemies, because it was turned unto them from sorrow to joy,
and from mourning into a good day?[388] What a day then will that be
to my soul, whose rest and change will be unconceivably greater?
When the wise men saw the star that led to Christ, they rejoiced
with exceeding great joy.[389] But I shall shortly see him, who is
himself the bright and morning star.[390] If the disciples departed
from the sepulchre with great joy, when they had but heard that
their Lord was risen from the dead;[391] what will be my joy, when I
see him reigning in glory, and myself raised to a blessed communion
with him? Then shall I indeed have beauty for ashes, the oil of joy
for mourning, and the garment of praise for the spirit of heaviness;
and Sion shall be made an eternal excellency, a joy of many
generations.[392] Why then do I not rise from the dust, and cease my
complaints? Why do I not trample on vain delights, and feed on the
foreseen delights of glory? Why is not my life a continual joy, and
the savor of heaven perpetually upon my spirit?
[383] Revelation xxi, 4.
[384] Psalm lxxxvii, 3.
[385] Psalm xxxvi, 8. xlvi, 4.
[386] Deuteronomy xxviii, 47.
[387] Hebrews x, 34.
[388] Esther ix, 22.
[389] Matthew ii, 10.
[390] Revelation, xxii, 16.
[391] Matthew xxviii, 7, 8.
[392] Isaiah lxi, 3. lx, 15.
§ 19. Let me here observe, that there is no necessity to exercise
these affections, either exactly in this order, or all at one time.
Sometimes one of thy affections may need more exciting, or may be
more lively than the rest; or, if thy time be short, one may be
exercised one day, and another upon the next; all which must be left
to thy prudence to determine. Thou hast also an opportunity, if
inclined to make use of it, to exercise opposite and more mixed
affections; such as—hatred of sin, which would deprive thy soul of
these immortal joys;—godly fear, lest thou shouldst abuse thy
mercy;—godly shame and grief, for having abused it;—unfeigned
repentance;—self-indignation;—jealousy over thy heart;—and pity
for those who are in danger of losing these immortal joys.
§ 20. (III.) We are also to take notice, how heavenly
contemplation is promoted by soliloquy and prayer. Though
consideration be the chief instrument in this work, yet, by itself, it is
not so likely to affect the heart. In this respect contemplation is like
preaching, where the mere explaining of truths and duties is seldom
attended with such success, as the lively application of them to the
conscience; and especially when a Divine blessing is earnestly
sought to accompany such application.
§ 21. (1.) By soliloquy, or a pleading the case with thyself, thou
must in thy meditation quicken thy own heart. Enter into a serious
debate with it. Plead with it in the most moving and affecting
language, and urge it with the most powerful and weighty
arguments. It is what holy men of God have practised in all ages.
Thus David, Why art thou cast down, O my soul! And why art thou
disquieted within me? Hope thou in God, for I shall yet praise him,
who is the health of my countenance, and my God.[393] And again,
Bless the Lord, O my soul! and all that is within me, bless his holy
name. Bless the Lord, O my soul! and forget not all his benefits,[394]
c. This soliloquy is to be made use of according to the several
affections of the soul, and according to its several necessities. It is a
preaching to one's self: For as every good master or father of a
family is a good preacher to his own family; so every good Christian
is a good preacher to his own soul. Therefore the very same method
which a minister should use in his preaching to others, every
Christian, should endeavor after in speaking to himself. Observe the
matter and manner of the most heart-affecting minister; let him be
as a pattern for your imitation; and the same way that he takes with
the hearts of his people, do thou also take with thy own heart. Do
this in thy heavenly contemplation; explain to thyself the things on
which thou dost meditate; confirm thy faith in them from Scripture;
and then apply them to thyself, according to their nature, and thy
own necessity. There is no need to object against this, from a sense
of thy own inability. Doth not God command thee to teach the
Scriptures diligently unto thy children, and talk of them when thou
sittest in thine house, and when thou walkest by the way, and when
thou liest down, and when thou risest up?[395] And if thou must have
some ability to teach thy children, much more to teach thyself; and if
thou canst talk of Divine things to others, why not also to thine own
heart?
[393] Psalm xliii, 11.
[394] Psalm ciii, 1-5.
[395] Deuteronomy vi, 7.
§ 22. (2.) Heavenly contemplation is also promoted, by speaking
to God in prayer; as well as by speaking to ourselves in soliloquy.
Ejaculatory prayer may very properly be intermixed with meditation,
as a part of the duty. How often do we find David, in the same
Psalm, sometimes pleading with his soul, and sometimes with God?
The apostle bids us speak to ourselves in psalms, and hymns, and
spiritual songs;[396] and no doubt we may also speak to God in them.
This keeps the soul sensible of the Divine presence, and tends
greatly to quicken and raise it. As God is the highest object of our
thoughts, so our viewing of him, speaking to him, and pleading with
him, more elevates the soul, and excites the affections, than any
other part of meditation. Though we remain unaffected, while we
plead the case with ourselves; yet, when we turn our speech to God,
it may strike us with awe; and the holiness and majesty of Him
whom we speak to, may cause both the matter and words to pierce
the deeper. When we read, that Isaac went out to meditate in the
field, the margin says, to pray; for the Hebrew word signifies both.
Thus in our meditations, to intermix soliloquy and prayer; sometimes
speaking to our own hearts, and sometimes to God, is, I apprehend,
the highest step we can advance to in this heavenly work. Nor
should we imagine, it will be as well to take up with prayer alone,
and lay aside meditation. For they are distinct duties, and must both
of them be performed. We need one as well as the other, and
therefore shall wrong ourselves by neglecting either. Besides the
mixture of them, like music, will be more engaging; as the one
serves to put life into the other. And our speaking to ourselves in
meditation, should go before our speaking to God in prayer. For want
of attending to this due order, men speak to God with far less
reverence and affection than they would speak to an angel, if he
should appear to them; or to a judge, if they were speaking for their
lives. Speaking to the God of heaven in prayer, is a weightier duty
than most are aware of.
[396] Ephesians v, 19.
CHAP. XV.
Heavenly contemplation assisted by sensible objects,
and guarded against a treacherous heart.
§ 1. As it is difficult to maintain a lively impression of heavenly things, therefore,
§ 2. (I.) Heavenly contemplation may be assisted by sensible objects; § 3. (1.) If
we draw strong suppositions from sense; and, § 4-11. (2.) If we compare the
objects of sense with the objects of faith, several instances of which are
produced. § 12. (II.) Heavenly contemplation may also be guarded against a
treacherous heart, by considering, § 13, 14. (1.) The great backwardness of the
heart to this duty; § 15. (2.) Its trifling in it; § 16. (3.) Its wandering from it;
and, § 17. (4.) Its too abruptly putting an end to it.
HE most difficult part of heavenly contemplation, is to
maintain a lively sense of heavenly things upon our
hearts. It is easier, merely to think of heaven a whole day, than to be
lively and affectionate in those thoughts a quarter of an hour. Faith is
imperfect, for we are renewed but in part; and goes against a world
of resistance; and, being supernatural, is prone to decline and
languish, unless it be continually excited. Sense is strong, according
to the strength of the flesh; and being natural, continues while
nature continues. The objects of faith are far off; but those of sense
are nigh. We must go as far as heaven for our joys. To rejoice in
what we never saw, nor ever knew the man that did see, and this
upon a mere promise in the Bible; is not so easy, as to rejoice in
what we see and possess. It must therefore be a point of spiritual
prudence, to call in sense to the assistance of faith. It will be a good
work, if we can make friends of these usual enemies, and make
them instruments for raising us to God, which are so often the
means of drawing us from him. Why hath God given us either our
senses, or their common objects, if they might not be serviceable to
his praise? Why doth the Holy Spirit describe the glory of the New
Jerusalem, in expressions that are grateful to the flesh? Is it that we
might think heaven to be made of gold and pearl? or that saints and
angels eat and drink? No, but to help us to conceive of them as we
are able, and to use these borrowed phrases as a glass, in which we
must see the things themselves imperfectly represented, till we
come to an immediate and perfect sight. And besides shewing how
heavenly contemplation may be assisted by sensible objects,—this
chapter will also shew how it may be preserved from a wandering
heart.
§ 2. (I.) In order that heavenly contemplation may be assisted by
sensible objects, let me only advise—to draw strong suppositions
from sense,—and to compare the objects of sense with objects of
faith.
§ 3. (1.) For the helping of thy affections in heavenly
contemplation, draw as strong suppositions as possible from thy
senses. Think on the joys above, as boldly as Scripture hath
expressed them. Bring down thy conceptions to the reach of sense.
Both love and joy are promoted by familiar acquaintance. When we
attempt to think of God and glory, without the Scripture-manner of
representing them, we are lost, and have nothing to fix our thoughts
upon; we set them so far from us, that our thoughts are strange,
and we are ready to say, what is above us, is nothing to us. To
conceive of God and glory, only as above our conception, will beget
but little love; or as above our love, will produce little joy. Therefore
put Christ no farther from you, than he hath put himself, lest the
Divine nature be again inaccessible. Think of Christ, as in our own
glorified nature. Think of glorified saints, as men made perfect.
Suppose thyself a companion with John in his survey of the new
Jerusalem, and viewing the thrones, the Majesty, the heavenly hosts,
the shining splendor, which he saw. Suppose thyself his fellow-
traveller into the celestial kingdom, and that thou hadst seen all the
saints in their white robes, with palms in their hands; and that thou
hadst heard those Songs of Moses, and of the Lamb. If thou hadst
really seen and heard these things, in what a rapture wouldst thou
have been? and the more seriously thou puttest this supposition to
thyself, the more will thy meditation elevate thy heart. Do not, like
the papists, draw them in pictures; but get the liveliest picture of
them in thy mind that thou possibly canst, by contemplating the
Scripture-account of them, till thou canst say, Methinks I see a
glimpse of glory! methinks I hear the shouts of joy and praise, and
even stand by Abraham and David, Peter and Paul, and other
triumphant souls! Methinks I even see the Son of God appearing in
the clouds, and the world standing at his bar to receive their doom;
and hear him say Come ye blessed of my Father; and see them go
rejoicing into the joy of their Lord! My very dreams of these things
have sometimes greatly affected me, and should not these just
suppositions much more affect me? What if I had seen, with Paul,
those unutterable things! Or, with Stephen, had seen heaven
opened, and Christ sitting at the right hand of God? Surely that one
sight was worth his storm of stones. What if I had seen, as Isaiah
did, the Lord sitting upon his throne, and all the host of heaven
standing on his right hand and on his left? Such things did these
men of God see; and I shall shortly see far more than ever they saw,
till they were loosed from flesh, as I must be. Thus you see how it
excites our affections in this heavenly work, if we make strong and
familiar suppositions from our bodily senses, concerning the state of
blessedness, as the Spirit hath in condescending language expressed
it.
§ 4. (2.) The other way in which our senses may promote this
heavenly work, is by comparing the objects of sense with the objects
of faith. As for instance:—You may strongly argue with your hearts
from the corrupt delights of sensual men, to the joys above. Think
with yourselves; Is it such a delight to a sinner to do wickedly? And
will it not be delightful indeed to live with God? Hath the drunkard
such delight in his cups, that the fears of damnation will not make
him forsake them? Will the whore-master rather part with his credit,
estate, and salvation, than with his brutish delight? If the way to hell
can afford such pleasure, what then are the pleasures of the saints
in heaven? if the covetous man hath so much pleasure in his wealth,
and the ambitious man in places of power and titles of honor; what
then have the saints in everlasting treasures, and in heavenly
honors, where we shall be set above principalities and powers, and
be made the glorious spouse of Christ? How delightfully will the
voluptuous follow their recreations from morning to night, or sit at
their cards and dice, nights and days together? O the delight we
shall have, when we come to our rest, in beholding the face of the
living God, and in singing forth praises to him and the Lamb!—
Compare also the delights above, with the lawful and moderate
delights of sense. Think with thyself, How sweet is food to my taste
when I am hungry; especially if it be, as Isaac said, such as I love,
which my temperance and appetite incline to? What delight then
must my soul have in feeding upon Christ, the living bread, and in
eating with him at his table in his kingdom? Was a mess of pottage
so sweet to Esau in his hunger, that he would buy it at so dear a rate
as his birth-right? How highly then should I value this never-
perishing food? How pleasant is drink in the extremity of thirst,
scarcely to be expressed; enough to make the strength of Sampson
revive? O how delightful will it be to my soul to drink of that fountain
of living water, which whoso drinketh it shall thirst no more? How
delightful are grateful odors to the smell; or music to the ear; or
beautiful sights to the eye? What fragrance then hath the precious
ointment which is poured on the head of our glorified Savior, and
which must be poured on the head of all his saints, and will fill all
heaven with its odor? How delightful is the music of the heavenly
host? How pleasing will be those real beauties above? How glorious
the building not made with hands, the house that God himself dwells
in, the walks and prospects in the city of God; and the celestial
paradise!
§ 5. Compare also the delights above, with those we find in
natural knowledge. These are far beyond the delights of sense; but
how much farther are the delights of heaven? Think then, Can an
Archimedes be so taken up with his mathematical invention, that the
threats of death cannot disengage him, but he will die in the midst
of his contemplations? Should I not be much more taken up with the
delights of glory, and die with these contemplations fresh upon my
soul; especially when my death will perfect my delights, while those
of Archimedes die with him? What exquisite pleasure is it to dive into
the secrets of nature, and find out the mystery of arts and sciences;
especially if we make a new discovery in any one of them? What
high delights are there then in the knowledge of God and Christ? If
the face of human learning be so beautiful, as to make sensual
pleasures appear base and brutish; how beautiful then is the face of
God? When we meet with some choice book, how could we read it
day and night, almost forgetful of meat, drink, or sleep? What
delights are there then at God's right hand, where we shall know in
a moment all that is to be known?—Compare also the delights
above, with the delights of morality, and of the natural affections.
What delight had many sober heathens in the rules and practice of
moral duties, so that they took him alone for an honest man, who
did well through the love of virtue, and not merely for fear of
punishment; yea, so much valued was this moral virtue, that they
thought man's chief happiness consisted in it? Think then What
excellency will there be in our heavenly perfection and in that
uncreated perfection of God which we shall behold? What sweetness
is there in the exercise of natural love, whether to children, parents,
yoke-fellows, or intimate friends? Does David say of Jonathan, thy
love to me was wonderful, passing the love of women? Did the soul
of Jonathan cleave to David? Had Christ himself one disciple whom
he especially loved, and who was wont to lean on his breast? If then
the delights of close and cordial friendship be so great, what delight
shall we have in the friendship of the Most High, and in our mutual
intimacy with Jesus Christ, and in the dearest love of the saints?
Surely this will be a stricter friendship, and these more lovely and
desirable friends, than ever the sun beheld; and both our affections
to our Father and Savior, and especially theirs to us, will be such as
we never knew here. If one angel could destroy an host, the
affections of spirits must also be proportionably stronger, so that we
shall then love a thousand times more ardently than we can now. As
all the attributes and works of God are incomprehensible, so is this
of love: He will love us infinitely beyond our most perfect love to
him. What then will there be in this mutual love?
§ 6. Compare also the excellencies of heaven, with those glorious
works of creation which our eyes now behold. What wisdom, power,
and goodness, are manifested therein? How does the majesty of the
Creator shine in this fabric of the world? His works are great, sought
out of all them that have pleasure therein. What Divine skill in
forming the bodies of men or beasts? What excellency in every
plant? What beauty in flowers? What variety and usefulness in
herbs, fruits, and minerals? What wonders are contained in the earth
and its inhabitants; the ocean of waters, with its motions and
dimensions; and the constant succession of spring and autumn, of
summer and winter? Think then, If these things, which are but
servants to sinful man, are so full of mysterious worth, what is that
place where God himself dwells, and which is prepared for just men
made perfect with Christ? What glory is there in the least of yonder
stars? What a vast resplendent body is yonder moon, and every
planet? What an inconceivable glory hath the sun? But all this is
nothing to the glory of heaven. Yonder sun must there be laid aside
as useless. Yonder is but darkness to the lustre of my Father's
house. I shall myself be as glorious as that sun. This whole earth is
but my Father's footstool. This thunder is nothing to his dreadful
voice. These winds are nothing to the breath of his mouth. If the
sending rain, and making the sun to rise on the just, and on the
unjust, be so wonderful; how much more wonderful and glorious will
that sun be, which must shine on none but saints and angels?—
Compare also the enjoyments above, with the wonders of
Providence in the church and world. Would it not be an astonishing
sight to see the sea stand as a wall on the right hand and on the
left, and the dry land appear in the midst, and the people of Israel
pass safely through, and Pharaoh and his host drowned? or to have
seen the ten plagues of Egypt? or the rock gushing forth streams? or
manna and quails rained from heaven? or the earth opening and
swallowing up the wicked? But we shall see far greater things than
these; not only sights more wonderful, but more delightful: There
shall be no blood, nor wrath, intermingled; nor shall we cry out, as
the men of Bethshemesh, Who is able to stand before this holy Lord
God? How astonishing, to see the sun stand still in the firmament; or
the dial of Ahaz go back ten degrees? But we shall see when there
shall be no sun; or rather shall behold forever a sun of infinitely
greater brightness. What a life should we live, if we could have
drought or rain at our prayers; or have fire from heaven to destroy
our enemies, as Elijah had; or raise the dead, as Elisha; or
miraculously cure diseases, and speak all languages, as the
Apostles? Alas, these are nothing to the wonders we shall see and
possess with God; and all of them wonders of goodness and love?
We shall ourselves be the subjects of more wonderful mercies than
any of these. Jonah was raised but from a three day's burial in the
belly of a fish; but we shall be raised from many years rottenness
and dust; and that dust exalted to the glory of the sun; and that
glory perpetuated through eternity. Surely, if we observe but
common providences; as, the motion of the sun; the tides of the
sea; the standing of the earth; the watering it with rain, as a
garden; the keeping in order a wicked confused world; with many
others; they are all admirable. But what are these to the Sion of
God, the vision of the Divine Majesty, and the order of the heavenly
hosts?—Add to these those particular providences which thou hast
thyself enjoyed and recorded through thy life, and compare them
with the mercies thou shalt have above. Look over the mercies of
thy youth and riper age, of thy prosperity and adversity, of thy
several places and relations; are they not excellent and innumerable,
rich and engaging? How sweet was it to thee, when God resolved
thy doubts; scattered thy fears; prevented the inconveniences into
which thy own counsel would have cast thee; eased thy pains;
healed thy sickness; and raised thee up, as from death and the
grave? Think then, Are all these so sweet and precious, that without
them my life would have been a perpetual misery? Hath his
providence on earth lifted me so high, and his gentleness made me
great? How sweet then will his glorious presence be? How high will
his eternal love exalt me? and how great shall I be made in
communion with his greatness? If my pilgrimage and warfare have
such mercies, what shall I find in my home, and in my triumph? If
God communicates so much to me while I remain a sinner; what will
he bestow when I am a perfected saint? If I have had so much at
such a distance from him; what shall I have in his immediate
presence, where I shall ever stand before his throne?
§ 7. Compare the joys above, with the comforts thou hast here
received in ordinances. Hath not the Bible been to thee as an open
fountain, flowing with comforts day and night? What suitable
promises have come into thy mind; so that with David, thou mayest
say, Unless thy law had been my delight, I should then have
perished in mine affliction? Think then, If his word be so full of
consolations, what overflowing springs shall we find in God himself?
If his letters are so comfortable, what will the glories of his presence
be? If the promise is so sweet, what will the performance be? If the
testament of our Lord, and our charter for the kingdom, be so
comfortable, what will be our possession of the kingdom itself?—
Think farther, What delights have I also found in the word
preached? When I have sat under a heavenly, heart-searching
teacher, how hath my heart been warmed? Methinks I have felt
myself almost in heaven. How often have I gone to the congregation
troubled in spirit, and returned joyful? How often have I gone
doubting, and God hath sent me home persuaded of his love in
Christ? What cordials have I met with to animate me in every
conflict? If but the face of Moses shine so gloriously, what glory is
there in the face of God? If the feet of them that publish peace, that
bring good tidings of salvation, be beautiful; how beautiful is the
face of the Prince of Peace? If this treasure be so precious in
earthen vessels; what is that treasure laid up in heaven? Blessed are
the eyes that see what is seen there, and the ears that hear the
things that are heard there. There shall I hear Elijah, Isaiah,
Jeremiah, John, Peter, Paul; not preaching to gainsayers, in
imprisonment, persecution, and reproach; but triumphing in the
praises of him that hath raised them to honor and glory. Think also,
What joy is it to have access and acceptance in prayer; that I may
always go to God, and open my case, and unbosom my soul to him,
as to my most faithful friend? But it will be a more unspeakable joy,
when I shall receive all blessings without asking, and all my
necessities and miseries will be removed, and when God himself will
be the portion and inheritance of my soul. As for the Lord's supper,
What a privilege is it to be admitted to sit at his table, to have his
covenant sealed to me there? But all the life and comfort there, is to
assure me of the comforts hereafter. O the difference between the
last supper of Christ on earth, and the marriage-supper of the Lamb
at the great day! Then his room will be the glorious heavens; his
attendants, all the hosts of angels and saints; no Judas, no
unfurnished guest, comes there; but the humble believers must sit
down by him, and their feast will be their mutual loving and
rejoicing. Concerning the communion of saints, think with thyself,
What a pleasure is it to live with intelligent and heavenly Christians?
David says of such, they were all his delight. O what a delightful
society then shall I have above? Had I but seen Job on the dunghill,
what a mirror of patience? and what will it be to see him in glory?
How delightful to have heard Paul and Silas singing in the stocks?
How much more to hear them sing praises in heaven? What melody
did David make on his harp? But how much more melodious to hear
that sweet singer in the heavenly choir? What would I have given for
an hour's free converse with Paul, when he was just come down
from the third heaven? But I must shortly see those things myself,
and possess what I see. Once more, think of praising God in
concert with his saints. What if I had been in the place of those
shepherds, who saw, and heard the heavenly host singing, Glory to
God in the highest, and on earth peace, good will towards men? But
I shall see and hear more glorious things. How blessed should I have
thought myself, had I heard Christ in his thanksgivings to his Father?
How much more, when I shall hear him pronounce me blessed? If
there was such joy at bringing back the ark, or at rebuilding the
temple; what will there be in the New Jerusalem? If the earth rent,
when the people rejoiced at Solomon's coronation; what a joyful
shout will there be at the appearing of the King of the church? If,
when the foundations of the earth were laid, the morning stars sang
together, and all the sons of God shouted for joy; what a joyful song
will there be, when the world of glory is both founded and finished,
when the top-stone is laid, and when the holy city is adorned as the
bride, the Lamb's wife?
§ 8. Compare the joy thou shalt have in heaven, with what the
saints have found in the way to it, and in the foretastes of it. When
did God ever reveal the least of himself to any of his saints, but the
joy of their hearts was answerable to the revelation? In what an
ecstacy was Peter on the mount of transfiguration? Master, says he,
it is good for us to be here; let us make three tabernacles! one for
thee, and one for Moses, and one for Elias. As if he had said, O let
us not go down again to yonder persecuting rabble; let us not return
to our mean and suffering state. Is it not better to stay here now we
are here? Is not here better company, and sweeter pleasure? How
was Paul lifted up with what he saw? How did the face of Moses
shine, when he had been talking with God? These were all
extraordinary foretastes; but little to the full beatifical vision. How
often have we read and heard of dying saints, who have been as full
of joy as their hearts could hold; and when their bodies have felt the
extremity of sickness and pain, have had much of heaven in their
spirits, and their joy hath far exceeded their sorrows? If a spark of
this fire be so glorious, even amidst the sea of adversity; what then
is glory itself? O the joy that the martyrs have felt in the flames!
They were flesh and blood, as well as we; it must therefore be some
excellent thing that filled their spirits with joy while their bodies were
burning. Think, reader, in thy meditations, Sure it must be some
wonderful foretaste of glory that made the flames of fire easy, and
the king of terrors welcome. What then is glory itself. What a
blessed rest, when the thoughts of it made Paul desire to depart and
be with Christ; and makes the saints never think themselves well, till
they are dead? Shall Saunders embrace the stake, and cry Welcome
cross? And shall not I more delightfully embrace my blessedness,
and cry, Welcome crown? Shall Bradford kiss the faggot? And shall
not I kiss the Savior? Shall another poor martyr rejoice to have her
foot in the same hole of the stocks, in which Mr. Philpot's had been
before her? And shall not I rejoice, that my soul shall live in the
same place of glory, where Christ and his apostles are gone before
me? Shall fire and faggot, prisons and banishment, cruel mockings
and scourgings, be more welcome to others, than Christ and glory to
me? God forbid.
§ 9. Compare the glory of the heavenly kingdom, with the glory of
the church on earth, and of Christ in his state of humiliation. If
Christ suffering in the room of sinners had such excellency, what is
Christ at his Father's right hand? If the church under her sins and
enemies have so much beauty, what will she have at the marriage of
the Lamb? How wonderful was the Son of God in the form of a
servant? When he is born, a new star must appear, and conduct the
strangers to worship him in a manger; heavenly hosts with their
songs must celebrate his nativity; while a child, he must dispute with
doctors; when he enters upon his office, he turns water into wine;
feeds thousands with a few loaves and fishes; cleanses the lepers,
heals the sick, restores the lame, gives sight to the blind, and raises
the dead. How wonderful then is his celestial glory? If there be such
cutting down of boughs, and spreading of garments, and crying
Hosanna, for one that comes into Jerusalem riding on an ass; what
will there be when he comes with his angels in his glory? If they that
heard him preach the gospel of the kingdom, confess, Never man
spake like this man; they then that behold his majesty in his
kingdom, will say, There was never glory like this glory. If, when his
enemies came to apprehend him, they fell to the ground; if when he
is dying, the earth quakes, the veil of the temple is rent, the sun
eclipsed, the dead bodies of the saints arise, and the standers-by
acknowledge, Verily this was the Son of God? O what a day will it
be, when the dead must all arise, and stand before him; when he
will once more shake, not the earth only, but the heavens also;
when this sun shall be taken out of the firmament, and be
everlastingly darkened with his glory; and when every tongue shall
confess him to be Lord and King! If, when he rose again, death and
the grave lost their power; if angels must roll away the stone, terrify
the keepers till they are as dead men, and send the tidings to his
disciples; if he ascend to heaven in their sight; what power,
dominion, and glory, is he now possessed of, and which we must for
ever possess with him! When he is gone, can a few poor fishermen
and tent-makers cure the lame, blind, and sick, open prisons,
destroy the disobedient, raise the dead, and astonish their
adversaries? What a world will that be, where every one can do
greater works than these! If the preaching of the gospel be
accompanied with such power as to discover the secrets of the
heart; humble the proud sinner, and make the most obdurate
tremble; if it can make men burn their books, sell their lands, bring
in the price and lay it down at the preacher's feet; if it can convert
thousands, and turn the world upside down; if its doctrine, from the
prisoner at the bar, can make the judge on the bench tremble; if
Christ and his saints have this power and honor in the day of their
abasement, and in the time appointed for their suffering and
disgrace; what then will they have in their absolute dominion, and
full advancement in their kingdom of glory?
§ 10. Compare the glorious change thou shalt have at last, with
the gracious change which the Spirit hath here wrought on thy
heart. There is not the smallest sincere grace in thee, but is of
greater worth than the riches of the Indies; not a hearty desire and
groan after Christ, but is more to be valued than the kingdoms of
the world. A renewed nature is the very image of God; Christ
dwelling in us; and the Spirit of God abiding in us: It is a beam from
the face of God; the seed of God remaining us; the only inherent
beauty of the rational soul: It ennobles man above all nobility; fits
him to understand his Maker's pleasure, do his will, and receive his
glory. If this grain of mustard seed be so precious, what is the tree
of life in the midst of the paradise of God? If a spark of life, which
will but strive against corruptions, and flame out a few desires and
groans, be of so much worth; how glorious then is the fountain of
this life? If we are said to be like God, when we are pressed down
with a body of sin; sure we shall be much more like God, when we
have no such thing as sin within us. Is the desire after, and love of
heaven so excellent; what then is the thing itself? Is our joy in
foreseeing and believing so sweet; what will be the joy of full
possession! How glad is a Christian when he feels his heart begin to
melt and be dissolved with the thoughts of sinful unkindness? Even
this sorrow yields him joy. O what then will it be, when we shall
know, and love, and rejoice, and praise in the highest perfection?
Think with thyself, What a change was it, to be taken from that
state wherein I was born, and in which I was rivetted by custom,
when thousands of sins lay upon my score, and if I had so died, I
had been damned forever? What an astonishing change, to be
justified from all these enormous crimes, and freed from all these
fearful plagues, and made an heir of heaven? How often, when I
have thought of my regeneration, have I cried out, O blessed day!
and blessed be the Lord that ever I saw it! How then shall I cry out
in heaven, O blessed eternity! and blessed be the Lord that brought
me to it! Did the angels of God rejoice to see my conversion? Surely
they will congratulate my felicity in my salvation. Grace is but a
spark raked up in the ashes, covered with flesh from the sight of the
world, and sometimes covered with corruption from my own sight;
but my everlasting glory will not be so clouded, nor my light be
under a bushel, but on a hill, even upon Mount Sion, the Mount of
God.
§ 11. Once more, compare the joys which thou shalt have above,
with those foretastes of it which the Spirit hath given thee here.
Hath not God sometimes revealed himself extraordinarily to thy soul,
and let a drop of glory fall upon it? Hast thou not been ready to say,
O that it might be thus with my soul continually? Didst thou never
cry out with the martyr, after thy long and mournful expectations,
He is come, He is come? Didst thou never, under a lively sermon of
heaven, or in thy retired contemplations on that blessed state,
perceive thy drooping spirits revive, and thy dejected heart lift up
the head, and the light of heaven dawn on thy soul? Think with
thyself, What is this earnest to the full inheritance? Alas, all this
light, that so amazeth and rejoiceth me, is but a candle lighted from
heaven, to lead me thither through this world of darkness: If some
godly men have been overwhelmed with joy, till they have cried out,
Hold, Lord, stay thy hand; I can bear no more: What then will be my
joys in heaven, when my soul shall be so capable of seeing and
enjoying God, that though the light be ten thousand times greater
than the sun, yet my eyes shall be able for ever to behold it? Or, if
thou hast not yet felt these sweet foretastes, (for every believer hath
not felt them,) then make use of such delights as thou hast felt, in
order the better to discern what thou shalt hereafter feel.
§ 12. (II.) I am now to shew how heavenly contemplation may be
preserved from a wandering heart. Our chief work is here to discover
the danger, and that will direct to the fittest remedy. The heart will
prove the greatest hinderance in this heavenly employment; either,
by backwardness to it;—or, by trifling in it;—or, by frequent
excursions to other objects;—or, by abruptly ending the work before
it is well begun. As you value the comfort of this work, these
dangerous evils must be faithfully resisted.
§ 13. (1.) Thou wilt find thy heart as backward to this, I think, as
to any work in the world. O what excuses will it make! What
evasions will it find out! What delays and demurs, when it is ever so
much convinced! either it will question, whether it be a duty or not,
or, if it be so to others, whether to thyself. It will tell thee, This is a
work for ministers, that have nothing else to study; or for persons
that have more leisure than thou hast. If thou be a minister, it will
tell thee, This is the duty of the people; it is enough for thee to
meditate for their instruction, and let them meditate on what they
have heard. As if it was thy duty only to cook their meat, and serve
it up, and they alone must eat it, digest it, and live upon it. If all this
will not do, thy heart will tell thee of other business, or set thee
upon some other duty; for it had rather go to any duty than this.
Perhaps it will tell thee, Other duties are greater, and therefore this
must give place to them, because thou hast no time for both. Public
business is more important; to study and preach for the saving of
souls, must be preferred before these private contemplations. As if
thou hadst not time to care for thy own salvation, for looking after
that of others. Or thy charity to others were so great, that it obliges
thee to neglect thy own eternal welfare. Or as if there were any
better way to fit us to be useful to others, than making this proof of
our doctrine ourselves. Certainly heaven is the best fire to light our
candle at, and the best book for a preacher to study; and if we
would be persuaded to study that more, the church would be
provided with more heavenly lights; and when our studies are
divine, and our spirits divine, our preaching will also be divine, and
we may be called divines indeed. Or, if thy heart have nothing to say
against the work, it will trifle away the time in delays, and promise
this day and the next, but still keep off from the business. Or, it will
give thee a flat denial, and oppose its own unwillingness to thy
reason. All this I speak of the heart, so far as it is still carnal; for I
know, so far as it is spiritual, it will judge this the sweetest work in
the world.
§ 14. What is now to be done? Wilt thou do it, if I tell thee?
Wouldst thou not say in a like case, What should I do with a servant
that will not work? or with a horse that will not travel? Shall I keep
them to look at? Then faithfully deal thus with thy heart; persuade
it to the work; take no denial; chide it for its backwardness; use
violence with it. Hast thou no command of thy own thoughts? Is not
the subject of thy meditations a matter of choice, especially under
this conduct of thy judgment? Surely God gave thee, with thy new
nature, some power to govern thy thoughts. Art thou again become
a slave to thy depraved nature? Resume thy authority. Call in the
Spirit of Christ to thine assistance, who is never backward to so good
a work, nor will deny his help in so just a cause. Say to him, Lord,
thou gavest my reason the command of my thoughts and affections;
the authority I have received over them is from thee; and now
behold, they refuse to obey thine authority: Thou commandest me
to set them to the work of heavenly meditation, but they rebel and
stubbornly refuse the duty. Wilt thou not assist me to exercise that
authority which thou hast given me? O send down thy Spirit, that I
may enforce thy commands, and effectually compel them to obey
thy will! Thus thou shalt see thy heart will submit, its resistance be
overcome, and its backwardness be turned into cheerful compliance.
§ 15. (2.) Thy heart will also be likely to betray thee by trifling,
when it should be effectually meditating. Perhaps, when thou hast
an hour for meditation, the time will be spent before thy heart will
be serious. This doing of duty, as if we did it not, ruins as many as
the omission of it. Here let thine eye be always upon thy heart. Look
not so much to the time it spends in the duty, as to the quantity and
quality of the work that is done. You can tell by his work, whether a
servant hath been diligent. Ask yourself, What affections have been
yet exercised? How much am I yet got nearer to heaven? Think not,
since thy heart is so trifling, it is better to let it alone: for, by this
means, thou wilt certainly banish all spiritual obedience; because the
best hearts, being but sanctified in part, will resist, so far as they are
carnal. But rather consider well the corruption of thy nature; and
that its sinful indispositions will not supersede the commands of
God; nor one sin excuse for another; and that God has appointed
means to excite our affections. This self-reasoning, self-considering
duty of heavenly meditation, is the most singular means, both to
excite and increase love. Therefore stay not from the duty, till thou
feelest thy love constrain thee; any more than thou wouldst stay
from the fire, till thou feelest thyself warm; but engage in the work,
till love is excited, and then love will constrain thee to further duty.
§ 16. (3.) Thy heart will also be making excursions from thy
heavenly meditation to other objects. It will be turning aside, like a
careless servant, to talk with every one that passeth by. When there
should be nothing in thy mind but heaven, it will be thinking of thy
calling, or thy afflictions, or of every bird, or tree, or place thou
seest. The cure is here the same as before; use watchfulness and
violence. Say to thy heart, What, did I come hither to think of my
worldly business, of persons, places, news, or vanity, or of any thing
but heaven, be it ever so good? Canst thou not watch one hour?
Wouldst thou leave this world, and dwell for ever with Christ in
heaven, and not leave it one hour to dwell with Christ in meditation?
Is this thy love to thy friend? Dost thou love Christ, and the place of
thy eternal, blessed abode, no more than this? If the ravening fowls
of wandering thoughts devour the meditations intended for heaven,
they devour the life and joy of thy thoughts: Therefore drive them
away from thy sacrifice, and strictly keep thy heart to the work.
§ 17. (4.) Abruptly ending thy meditation before it is well begun, is
another way in which thy heart will deceive thee. Thou mayest easily
perceive this in other duties. In secret prayer, is not thy heart urging
thee to cut it short, and frequently making a motion to have done?
So in heavenly contemplation, thy heart will be weary of the work,
and will stop thy heavenly walk before thou art well warm. But
charge it in the name of God to stay, and not do so great a work by
halves. Say to it, Foolish heart! if thou beg a while, and goest away
before thou hast thy alms, is not thy begging a lost labor? If thou
stoppest before the end of thy journey, is not thy travel lost? Thou
camest hither in hope to have a sight of the glory which thou must
inherit; and wilt thou stop when thou art almost at the top of the
hill, and turn back before thou hast taken thy survey? Thou camest
hither in hope to speak with God, and wilt thou go before thou hast
seen him? Thou camest to bathe thyself in the streams of
consolation, and to that end didst unclothe thyself of thy earthly
thoughts, and wilt thou only touch the bank and return? Thou
camest to spy out the land of promise; go not back without one
cluster of grapes, to shew thy brethren for their encouragement. Let
them see that thou hast tasted of the wine, by the gladness of thy
heart; and that thou hast been anointed with the oil, by the
cheerfulness of thy countenance: and hast fed of the milk and
honey, by the mildness of thy disposition, and the sweetness of thy
conversation. This heavenly fire would melt thy frozen heart, and
refine and spiritualize it; but it must have time to operate. Thus
pursue the work till something be done, till thy graces be in exercise,
thy affections raised, and thy soul refreshed with the delights above;
or if thou canst not obtain these ends at once, be the more earnest
at another time. Blessed is that servant, whom his Lord, when he
cometh, shall find so doing.
CHAP. XVI.
Heavenly contemplation exemplified, and the whole
Work concluded.
§ 1. The reader's attention excited to the following example of meditation. § 2.
The excellencies of heavenly rest. § 3. Its nearness, § 4. Dreadful to sinners
§ 5. And joyful to saints; § 6. Its dear purchase; § 7. Its difference from earth.
§ 8. The heart pleaded with. § 9. Unbelief banished. § 10. A careless world
pitied. § 11-13. Heavenly rest the object of love, § 14-21. And joy. § 22. The
heart's backwardness to heavenly joy lamented. § 23-27. Heavenly rest the
object of desire. § 28. Such meditations as this urged upon the reader: § 29.
The mischief of neglecting it: § 30. The happiness of pursuing it. § 31. The
Author's concluding prayer for the success of his work.
ND now reader, according to the above directions, make
conscience of daily exercising thy graces in meditation,
as well as prayer: Retire into some secret place, at a time the most
convenient to thyself, and laying aside all worldly thoughts, with all
possible seriousness and reverence, look up toward heaven,
remember there is thine everlasting rest, study its excellency and
reality, and rise from sense to faith, by comparing heavenly with
earthly joys: Then mix ejaculations with thy soliloquies; till having
pleaded the case reverently with God, and seriously with thy own
heart, thou hast pleaded thyself from a clod to a flame, from a
forgetful sinner, and a lover of the world, to an ardent lover of God,
from a fearful coward, to a resolved Christian, from an unfruitful
sadness, to a joyful life: In a word, till thou hast pleaded thy heart
from earth to heaven, from conversing below to walking with God;
and till thou canst lay thy heart to rest, as in the bosom of Christ, by
some such meditation of thy everlasting rest as is here added for thy
assistance.
§ 2. Rest! How sweet the sound! It is melody to my ears! It lies
as a reviving cordial at my heart, and from thence sends forth lively
spirits, which beat through all the pulses of my soul! Rest,—not as
the stone that rests on the earth, nor as the flesh shall rest in the
grave, nor such a rest as the carnal world desires. O blessed rest!
When we rest not day and night, saying, Holy, holy, holy Lord God
Almighty! When we shall rest from sin, but not from worship; from
suffering and sorrow, but not from joy! O blessed day! When I shall
rest with God! When I shall rest in the bosom of my Lord! When I
shall rest in knowing, loving, rejoicing, and praising! When my
perfect soul and body shall together perfectly enjoy the most perfect
God! When God, who is love itself, shall perfectly love me, and rest
in his love to me, as I shall rest in my love to him; and rejoice over
me with joy, and joy over me with singing, as I shall rejoice in him!
§ 3. How near is that most blessed, joyful day! It comes apace.
He that shall come, will come, and will not tarry. Though my Lord
seems to delay his coming, yet a little while and he will be here.
What is a few hundred years, when they are over? How surely will
his sign appear? How suddenly will he seize upon the careless world,
even as the lightning cometh out of the east, and shineth unto the
west? He who is gone hence shall so come. Methinks I hear his
trumpet sound! Methinks I see him coming with clouds; with his
attending angels in majesty and glory!
§ 4. O secure sinners! What now will you do? Where will you hide
yourselves? What shall cover you? mountains are gone; the heavens
and the earth, which were, are passed away; the devouring fire hath
consumed all, except yourselves, who must be the fuel for ever. O
that all could consume as soon as the earth; and melt away as did
the heavens! Ah, these wishes are now but vain! The Lamb himself
would have been your friend; he would have loved you, and ruled
you, and now have saved you; but you would not then, and now it is
too late. Never cry Lord, Lord; too late, too late, man. Why dost
thou look about? Can any save thee? Whither dost thou run? Can
any hide thee? O wretch, that hast brought thyself to this!
§ 5. Now, blessed saints, that have believed and obeyed! This is
the end of faith and patience. This is it for which you prayed and
waited. Do you now repent your sufferings and sorrows, your self-
denying and holy walking? Are your tears of repentance now bitter
or sweet! See how the Judge smiles upon you; there is love in his
looks; the titles of Redeemer, Husband, Head, are written in his
amiable, shining face. Hark, he calls you, he bids you stand here on
his right-hand; fear not, for there he sets his sheep. O joyful
sentence! Come, ye blessed of My Father, inherit the kingdom
prepared for you from the foundation of the world. He takes you by
the hand, the door is open, the kingdom is his, and therefore yours;
there is your place before his throne; the father receives you as the
spouse of his Son, and bids you welcome to the crown of glory. Ever
so unworthy, you must be crowned. This was the project of free
redeeming grace, the purpose of eternal love. O blessed grace! O
blessed love! O how love and joy will rise! but I cannot express it, I
cannot conceive it.
§ 6. This is that joy which was produced by sorrow, that crown
which was procured by the cross. My Lord wept, that now my tears
might be wiped away; He bled, that I might now rejoice; he was
forsaken, that I might not now be forsook; he then died, that I
might now live. O free mercy, that can exalt so vile a wretch! Free to
me though dear to Christ! Free grace, that hath chosen me, when
thousands were forsaken! When my companions in sin must burn in
hell, I must here rejoice in rest! Here must I live with all these
saints! O comfortable meeting of my old acquaintance, with whom I
prayed, and wept and suffered, and spoke often of this day and
place! I see the grave could not detain you; the same love hath
redeemed and saved you also.
§ 7. This is not like our cottages of clay, our prisons, our earthly
dwellings. This voice of joy is not like our old complaints, our
impatient groans and sighs; nor this melodious praise like the scoffs
and revilings, or the oaths and curses, which we heard on earth.
This body is not like that we had, nor this soul like the soul we had,
nor this life like the life we lived. We have changed our place and
state, our clothes and thoughts, our looks, language, and company.
Before, a saint was weak and despised; so proud and peevish, we
could often scarce discern his graces: but now how glorious a thing
is a saint! Where is now their body of sin, which wearied themselves
and those about them? Where are now our different judgments,
reproachful names, divided spirits, exasperated passions, strange
looks, uncharitable censures? Now we are all of one judgment, of
one name, of one heart, house, and glory. O sweet reconciliation!
Happy union! Now the gospel shall no more be dishonored through
our folly. No more, my soul, shalt thou lament the sufferings of the
saints, or the church's ruins, nor mourn thy suffering friends, nor
weep over their dying beds, or their graves. Thou shalt never suffer
thy old temptations from Satan, the world, or thy own flesh. Thy
pains and sicknesses are all cured; thy body shall no more burden
thee with weakness and weariness; thy aching head and heart, thy
hunger and thirst, thy sleep and labor, are all gone. O what a mighty
change is this! From the dunghill, to the throne! from persecuting
sinners, to praising saints! From a vile body, to this which shines as
the brightness of the firmament! From a sense of God's displeasure,
to the perfect enjoyment of him in love! From all my doubts and
fears, to this possession, which puts me out of doubt! From all my
fearful thoughts of death, to this joyful life! Blessed change!
Farewell, sin, and sorrow, for ever: Farewell, my rocky, proud,
unbelieving heart; my worldly, sensual, carnal heart: And welcome
now my most holy, heavenly nature. Farewell, repentance, faith, and
hope; and welcome, love, and joy, and praise. I shall now have my
harvest, without ploughing or sowing; my joy without a preacher, or
a promise; even all from the face of God himself. Whatever mixture
is in the streams, there is nothing but pure joy in the Fountain. Here
shall I be encircled with eternity and ever live, and ever, ever praise
the Lord. My face will not wrinkle, nor my hair be grey; for this
corruptible shall have put on incorruption, and this mortal
immortality, and death shall be swallowed up in victory. O death,
where is now thy sting? O grave, where is thy victory? The date of
my lease will no more expire, nor shall I trouble myself with
thoughts of death, nor lose my joys through fear of losing them.
When millions of ages are passed, my glory is but beginning; and
when millions more are passed, it is no nearer ending. Every day is
all noon, every month is harvest, every year is a jubilee, even age is
full manhood, and all this is one eternity. O blessed eternity! The
glory of my glory! the perfection of my perfection!
§ 8. Ah drowsy, earthly heart! How coldly dost thou think of this
reviving day? Hadst thou rather sit down in dirt, than walk in the
palace of God? Art thou now remembering thy worldly business, or
thinking of thy lusts, earthly delights and merry company? Is it
better to be here, than above with God? Is the company better? Are
the pleasures greater? Come away; make no excuse, nor delay; God
commands, and I command thee; gird up thy loins; ascend the
mount; look about thee with faith and seriousness. Look not back
upon the way of the wilderness; except it be to compare the
kingdom with that howling desert, more sensibly to perceive the
wide difference. Yonder is thy Father's glory; yonder, O my soul!
must thou remove, when thou departest from this body; and when
the power of thy Lord hath raised it again, and joined thee to it,
yonder must thou live with God for ever. There is the glorious new
Jerusalem, the gates of pearl, the foundations of pearl, the streets
and pavement of transparent gold. That sun, which lighteth all this
world, will be useless there; even thyself shall be as bright as yonder
shining sun; God will be the sun, and Christ the light, and in his light
shalt thou have light.
§ 9. O my soul! dost thou stagger at the promise of God through
unbelief? I much suspect thee, didst thou believe indeed thou
wouldst be more affected with it. Is it not under the hand, and seal,
and oath of God? Can God lie? Can he that is truth itself be false?
What need hath God to flatter or deceive thee? Why should he
promise thee more than he will perform? Dare not to charge the
wise, almighty, faithful God with this. How many of the promises
have been performed to thee in thy conversion? Would God so
powerfully concur with a feigned word? O wretched heart of
unbelief? Hath God made thee a promise of rest, and wilt thou come
short of it? Thine eyes, thy ears, and all thy senses, may prove
delusions, sooner than a promise of God can delude thee. Thou
mayest be surer of that which is written in the word, than if thou see
it with thine eyes, or feel it with thine hands. Art thou sure thou art
alive, or that this is earth thou standest on, or that thine eyes see
the sun? As sure is all this glory to the saints; as sure shall I be
higher than yonder stars, and live for ever in the holy city, and
joyfully sound forth the praise of my Redeemer; if I be not shut out
by this evil heart of unbelief, causing me to depart from the living
God.
§ 10. And is this rest so sweet, and so sure? Then what means
the careless world? Know they what they neglect? Did they ever
hear of it, or are they yet asleep, or are they dead? Do they certainly
know that the crown is before them, while they thus sit still or follow
trifles? Undoubtedly they are beside themselves, to mind so much
their provision by the way, when they are hasting so fast to another
world, and their eternal happiness lies at stake. Were there left one
spark of reason, they would never sell their rest for toil, nor their
glory for worldly vanities, nor venture heaven for sinful pleasure.
Poor men! O that you would once consider what you hazard, and
then you would scorn these tempting baits! Blessed for ever be that
love, which hath rescued me from this bewitching darkness!
§ 11. Draw yet nearer, O my soul! with thy most fervent love.
Here is matter for it to work upon, something worth thy loving. O
see what beauty presents itself! Is not all the beauty in the world
united here? Is not all other beauty but deformity? Dost thou now
need to be persuaded to love? Here is a feast for thine eyes, and all
the powers of thy soul; dost thou need entreaties to feed upon it?
Canst thou love a little shining earth, a walking piece of clay? And
canst thou not love that God, that Christ, that glory, which is so truly
and unmeasurably lovely? Thou canst love thy friend, because he
loves thee; and is the love of a friend like the love of Christ? Their
weeping or bleeding for thee, do not ease thee, nor stay the course
of thy tears or blood: But the tears and blood that fell from thy Lord,
have a sovereign healing virtue. O my soul! if love deserves, and
should beget love, what incomprehensible love is here before thee?
Pour out all the store of thy affections here, and all is too little. O
that it were more; O that it were many thousand times more! Let
him be first served, that served thee first. Let him have the first-
born, and strength of thy soul! who parted with strength and life in
love for thee. O my soul! Dost thou love for excellency? Yonder is
the region of light; this is a land of darkness. Yonder twinkling stars,
that shining moon, and radiant sun, are all but lanthorns hung out of
thy Father's house, to light thee while thou walkest in this dark
world: But how little dost thou know the glory and blessedness that
is within?—Dost thou love for suitableness? What person more
suitable than Christ? His godhead and humanity, his fulness and
freeness, his willingness and constancy, all proclaim him thy suitable
friend. What state more suitable to thy misery, than mercy? Or to
thy sin and pollution, than honor and perfection? What place more
suitable to thee than heaven? Does this world agree with thy
desires; hast thou not a sufficient trial of it?—Or dost thou love for
interest and near relation? Where hast thou better interest than in
heaven, or nearer relation than there?
§ 12. Dost thou love for acquaintance and familiarity? Though
thine eyes have never seen thy Lord, yet thou hast heard his voice,
received his benefits, and lived in his bosom; He taught thee to
know thyself and him; he opened thee that first window through
which thou sawest into heaven. Hast thou forgotten since thy heart
was careless, and he awakened it; hard, and he softened it;
stubborn, and he made it yield; at peace, and he troubled it; whole,
and he broke it; and broken, till he healed it again? Hast thou
forgotten the times when he found thee in tears; when he heard thy
secret sighs and groans, and left all to come and comfort thee; when
he took thee, as it were, in his arms, and asked thee, poor soul,
what ails thee? Dost thou weep, when I have wept so much? Be of
good cheer; thy wounds are saving, and not deadly; It is I have
made them, who mean thee no hurt; though I let out thy blood, I
will not let out thy life. I remember his voice. How gently did he
take me up? How carefully did he dress my wounds? Methinks I hear
him still saying to me, poor sinner, though thou hast dealt unkindly
with me, and cast me off; yet I will not do so by thee. Though thou
hast set light by me and all my mercies, yet they and myself are all
thine. What wouldst thou have that I can give thee? And what dost
thou want that I cannot give thee? If any thing I have will pleasure
thee, thou shalt have it. Wouldst thou have pardon? I freely forgive
thee all thy debt. Wouldst thou have grace and peace? Thou shalt
have them both. Wouldst thou have myself? Behold I am thine, thy
Friend, thy Lord, thy Brother, Husband, and Head. Wouldst thou
have the Father? I will bring thee to him, and thou shalt have him, in
and by me. These were my Lord's reviving words. After all, when I
was doubtful of his love, methinks I yet remember his overcoming
arguments. Have I done so much, sinner, to testify my love, and yet
dost thou doubt? Have I offered thee myself and love so long and
yet dost thou question my willingness to be thine? At what dearer
rate should I tell thee that I love thee? Wilt thou not believe my
bitter passion proceeded from love? Have I made myself in the
gospel a lion to thine enemies, and a lamb to thee, and dost thou
overlook my lamb-like nature? Had I been willing to let thee perish,
what need I have done and suffered so much? What need I follow
thee with such patience and importunity? Why dost thou tell me of
thy wants; have I not enough for me and thee? Or of thy
unworthiness; for if thou wast thyself worthy, what shouldst thou do
with my worthiness? Did I ever invite, or save, the worthy and the
righteous; or is there any such upon earth? Hast thou nothing; art
thou lost and miserable, helpless and forlorn? Dost thou believe I am
an all-sufficient Savior, and wouldst thou have me? Lo, I am thine,
take me; if thou art willing, I am; and neither sin, nor Satan, shall
break the match. These, O these, were the blessed words which his
Spirit from his gospel spoke unto me, till he made me cast myself at
his feet, and cry out, My Savior, and my Lord, thou hast broke, thou
hast revived my heart; thou hast overcome, thou hast won my
heart; take it, it is thine; if such a heart can please thee, take it; if it
cannot, make it such as thou wouldst have it. Thus, O my soul!
Mayest thou remember the sweet familiarity thou hast had with
Christ; therefore, if acquaintance will cause affection, let out thy
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!
ebookultra.com
Ad

Recommended

iOS 9 Programming Fundamentals with Swift Swift Xcode and Cocoa Basics 2nd Ed...
iOS 9 Programming Fundamentals with Swift Swift Xcode and Cocoa Basics 2nd Ed...
exzanyangdi
 
iOS 9 Programming Fundamentals with Swift Swift Xcode and Cocoa Basics 2nd Ed...
iOS 9 Programming Fundamentals with Swift Swift Xcode and Cocoa Basics 2nd Ed...
jussiefathey
 
Ios 12 Programming Fundamentals With Swift Swift Xcode And Cocoa Basics 5th E...
Ios 12 Programming Fundamentals With Swift Swift Xcode And Cocoa Basics 5th E...
joettealhadi
 
Download Full iOS 14 Programming Fundamentals with Swift Covers iOS 14 Xcode ...
Download Full iOS 14 Programming Fundamentals with Swift Covers iOS 14 Xcode ...
vignelordi07
 
Programming Ios 5 2nd Edition 2nd Early Release Draft Matt Neuburg
Programming Ios 5 2nd Edition 2nd Early Release Draft Matt Neuburg
lindzpeccoo
 
Programming Ios 4 Fundamentals Of Iphone Ipad And Ipod Touch Development 1st ...
Programming Ios 4 Fundamentals Of Iphone Ipad And Ipod Touch Development 1st ...
jungieaugi
 
Programming iOS 4 Fundamentals of iPhone iPad and iPod Touch Development 1st ...
Programming iOS 4 Fundamentals of iPhone iPad and iPod Touch Development 1st ...
assangkaoua
 
Programming iOS 5 2nd Edition Matt Neuburg
Programming iOS 5 2nd Edition Matt Neuburg
saertahai
 
PPT.pptxvkjvwbjbbikvhixhkiheihhiiihwxhhi
PPT.pptxvkjvwbjbbikvhixhkiheihhiiihwxhhi
afsana9597
 
Cocoa and Objective C Up and Running Foundations of Mac iPhone and iPod touch...
Cocoa and Objective C Up and Running Foundations of Mac iPhone and iPod touch...
quizaloan
 
Swift programming language
Swift programming language
Nijo Job
 
Learning Swift 3 Early release 3rd Edition Jonathan Manning
Learning Swift 3 Early release 3rd Edition Jonathan Manning
nieysaiotti
 
Learning Swift Building Apps for OSX, iOS, and Beyond Jon Manning
Learning Swift Building Apps for OSX, iOS, and Beyond Jon Manning
batyegrocez1
 
Developer’s viewpoint on swift programming language
Developer’s viewpoint on swift programming language
Azilen Technologies Pvt. Ltd.
 
Learning the iOS 4 SDK for JavaScript Programmers Create Native Apps with Obj...
Learning the iOS 4 SDK for JavaScript Programmers Create Native Apps with Obj...
thoramenzab0
 
Learning Swift Building Apps for OSX, iOS, and Beyond Jon Manning 2024 scribd...
Learning Swift Building Apps for OSX, iOS, and Beyond Jon Manning 2024 scribd...
lalikaukpono
 
Oop obj c
Oop obj c
Abbas Tolgay Yılmaz
 
Learning Swift 3 Early release 3rd Edition Jonathan Manning
Learning Swift 3 Early release 3rd Edition Jonathan Manning
pundaiarleny
 
Learning the iPhone SDK for JavaScript Programmers Create Native Apps with Ob...
Learning the iPhone SDK for JavaScript Programmers Create Native Apps with Ob...
matbarnargis59
 
Swift, swiftly
Swift, swiftly
Jack Nutting
 
Using Swift for all Apple platforms (iOS, watchOS, tvOS and OS X)
Using Swift for all Apple platforms (iOS, watchOS, tvOS and OS X)
Aniruddha Chakrabarti
 
Intro toswift1
Intro toswift1
Jordan Morgan
 
iOS 5 Programming Cookbook Solutions Examples for iPhone iPad and iPod touch ...
iOS 5 Programming Cookbook Solutions Examples for iPhone iPad and iPod touch ...
dhentyimeng51
 
Developing iOS apps with Swift
Developing iOS apps with Swift
New Generation Applications
 
Ios 5 Programming Cookbook Solutions Examples For Iphone Ipad And Ipod Touch ...
Ios 5 Programming Cookbook Solutions Examples For Iphone Ipad And Ipod Touch ...
colffwalbum
 
Tech breakfast 18
Tech breakfast 18
James Leone
 
iOS 5 Programming Cookbook Solutions Examples for iPhone iPad and iPod touch ...
iOS 5 Programming Cookbook Solutions Examples for iPhone iPad and iPod touch ...
ericasapna10
 
Objective-C
Objective-C
Abdlhadi Oul
 
Capitol Doctoral Presentation -June 2025.pptx
Capitol Doctoral Presentation -June 2025.pptx
CapitolTechU
 
Assisting Individuals and Families to Promote and Maintain Health – Unit 7 | ...
Assisting Individuals and Families to Promote and Maintain Health – Unit 7 | ...
RAKESH SAJJAN
 

More Related Content

Similar to iOS 9 Programming Fundamentals with Swift Swift Xcode and Cocoa Basics 2nd Edition Matt Neuburg (20)

PPT.pptxvkjvwbjbbikvhixhkiheihhiiihwxhhi
PPT.pptxvkjvwbjbbikvhixhkiheihhiiihwxhhi
afsana9597
 
Cocoa and Objective C Up and Running Foundations of Mac iPhone and iPod touch...
Cocoa and Objective C Up and Running Foundations of Mac iPhone and iPod touch...
quizaloan
 
Swift programming language
Swift programming language
Nijo Job
 
Learning Swift 3 Early release 3rd Edition Jonathan Manning
Learning Swift 3 Early release 3rd Edition Jonathan Manning
nieysaiotti
 
Learning Swift Building Apps for OSX, iOS, and Beyond Jon Manning
Learning Swift Building Apps for OSX, iOS, and Beyond Jon Manning
batyegrocez1
 
Developer’s viewpoint on swift programming language
Developer’s viewpoint on swift programming language
Azilen Technologies Pvt. Ltd.
 
Learning the iOS 4 SDK for JavaScript Programmers Create Native Apps with Obj...
Learning the iOS 4 SDK for JavaScript Programmers Create Native Apps with Obj...
thoramenzab0
 
Learning Swift Building Apps for OSX, iOS, and Beyond Jon Manning 2024 scribd...
Learning Swift Building Apps for OSX, iOS, and Beyond Jon Manning 2024 scribd...
lalikaukpono
 
Oop obj c
Oop obj c
Abbas Tolgay Yılmaz
 
Learning Swift 3 Early release 3rd Edition Jonathan Manning
Learning Swift 3 Early release 3rd Edition Jonathan Manning
pundaiarleny
 
Learning the iPhone SDK for JavaScript Programmers Create Native Apps with Ob...
Learning the iPhone SDK for JavaScript Programmers Create Native Apps with Ob...
matbarnargis59
 
Swift, swiftly
Swift, swiftly
Jack Nutting
 
Using Swift for all Apple platforms (iOS, watchOS, tvOS and OS X)
Using Swift for all Apple platforms (iOS, watchOS, tvOS and OS X)
Aniruddha Chakrabarti
 
Intro toswift1
Intro toswift1
Jordan Morgan
 
iOS 5 Programming Cookbook Solutions Examples for iPhone iPad and iPod touch ...
iOS 5 Programming Cookbook Solutions Examples for iPhone iPad and iPod touch ...
dhentyimeng51
 
Developing iOS apps with Swift
Developing iOS apps with Swift
New Generation Applications
 
Ios 5 Programming Cookbook Solutions Examples For Iphone Ipad And Ipod Touch ...
Ios 5 Programming Cookbook Solutions Examples For Iphone Ipad And Ipod Touch ...
colffwalbum
 
Tech breakfast 18
Tech breakfast 18
James Leone
 
iOS 5 Programming Cookbook Solutions Examples for iPhone iPad and iPod touch ...
iOS 5 Programming Cookbook Solutions Examples for iPhone iPad and iPod touch ...
ericasapna10
 
Objective-C
Objective-C
Abdlhadi Oul
 
PPT.pptxvkjvwbjbbikvhixhkiheihhiiihwxhhi
PPT.pptxvkjvwbjbbikvhixhkiheihhiiihwxhhi
afsana9597
 
Cocoa and Objective C Up and Running Foundations of Mac iPhone and iPod touch...
Cocoa and Objective C Up and Running Foundations of Mac iPhone and iPod touch...
quizaloan
 
Swift programming language
Swift programming language
Nijo Job
 
Learning Swift 3 Early release 3rd Edition Jonathan Manning
Learning Swift 3 Early release 3rd Edition Jonathan Manning
nieysaiotti
 
Learning Swift Building Apps for OSX, iOS, and Beyond Jon Manning
Learning Swift Building Apps for OSX, iOS, and Beyond Jon Manning
batyegrocez1
 
Developer’s viewpoint on swift programming language
Developer’s viewpoint on swift programming language
Azilen Technologies Pvt. Ltd.
 
Learning the iOS 4 SDK for JavaScript Programmers Create Native Apps with Obj...
Learning the iOS 4 SDK for JavaScript Programmers Create Native Apps with Obj...
thoramenzab0
 
Learning Swift Building Apps for OSX, iOS, and Beyond Jon Manning 2024 scribd...
Learning Swift Building Apps for OSX, iOS, and Beyond Jon Manning 2024 scribd...
lalikaukpono
 
Learning Swift 3 Early release 3rd Edition Jonathan Manning
Learning Swift 3 Early release 3rd Edition Jonathan Manning
pundaiarleny
 
Learning the iPhone SDK for JavaScript Programmers Create Native Apps with Ob...
Learning the iPhone SDK for JavaScript Programmers Create Native Apps with Ob...
matbarnargis59
 
Using Swift for all Apple platforms (iOS, watchOS, tvOS and OS X)
Using Swift for all Apple platforms (iOS, watchOS, tvOS and OS X)
Aniruddha Chakrabarti
 
iOS 5 Programming Cookbook Solutions Examples for iPhone iPad and iPod touch ...
iOS 5 Programming Cookbook Solutions Examples for iPhone iPad and iPod touch ...
dhentyimeng51
 
Ios 5 Programming Cookbook Solutions Examples For Iphone Ipad And Ipod Touch ...
Ios 5 Programming Cookbook Solutions Examples For Iphone Ipad And Ipod Touch ...
colffwalbum
 
Tech breakfast 18
Tech breakfast 18
James Leone
 
iOS 5 Programming Cookbook Solutions Examples for iPhone iPad and iPod touch ...
iOS 5 Programming Cookbook Solutions Examples for iPhone iPad and iPod touch ...
ericasapna10
 

Recently uploaded (20)

Capitol Doctoral Presentation -June 2025.pptx
Capitol Doctoral Presentation -June 2025.pptx
CapitolTechU
 
Assisting Individuals and Families to Promote and Maintain Health – Unit 7 | ...
Assisting Individuals and Families to Promote and Maintain Health – Unit 7 | ...
RAKESH SAJJAN
 
Non-Communicable Diseases and National Health Programs – Unit 10 | B.Sc Nursi...
Non-Communicable Diseases and National Health Programs – Unit 10 | B.Sc Nursi...
RAKESH SAJJAN
 
Energy Balances Of Oecd Countries 2011 Iea Statistics 1st Edition Oecd
Energy Balances Of Oecd Countries 2011 Iea Statistics 1st Edition Oecd
razelitouali
 
What is FIle and explanation of text files.pptx
What is FIle and explanation of text files.pptx
Ramakrishna Reddy Bijjam
 
“THE BEST CLASS IN SCHOOL”. _
“THE BEST CLASS IN SCHOOL”. _
Colégio Santa Teresinha
 
How to Implement Least Package Removal Strategy in Odoo 18 Inventory
How to Implement Least Package Removal Strategy in Odoo 18 Inventory
Celine George
 
Introduction to problem solving Techniques
Introduction to problem solving Techniques
merlinjohnsy
 
Introduction to Generative AI and Copilot.pdf
Introduction to Generative AI and Copilot.pdf
TechSoup
 
Paper 107 | From Watchdog to Lapdog: Ishiguro’s Fiction and the Rise of “Godi...
Paper 107 | From Watchdog to Lapdog: Ishiguro’s Fiction and the Rise of “Godi...
Rajdeep Bavaliya
 
JHS SHS Back to School 2024-2025 .pptx
JHS SHS Back to School 2024-2025 .pptx
melvinapay78
 
PEST OF WHEAT SORGHUM BAJRA and MINOR MILLETS.pptx
PEST OF WHEAT SORGHUM BAJRA and MINOR MILLETS.pptx
Arshad Shaikh
 
june 10 2025 ppt for madden on art science is over.pptx
june 10 2025 ppt for madden on art science is over.pptx
roger malina
 
2025 June Year 9 Presentation: Subject selection.pptx
2025 June Year 9 Presentation: Subject selection.pptx
mansk2
 
Unit- 4 Biostatistics & Research Methodology.pdf
Unit- 4 Biostatistics & Research Methodology.pdf
KRUTIKA CHANNE
 
How to Manage Inventory Movement in Odoo 18 POS
How to Manage Inventory Movement in Odoo 18 POS
Celine George
 
FIRST DAY HIGH orientation for mapeh subject in grade 10.pptx
FIRST DAY HIGH orientation for mapeh subject in grade 10.pptx
GlysdiEelesor1
 
Overview of Employee in Odoo 18 - Odoo Slides
Overview of Employee in Odoo 18 - Odoo Slides
Celine George
 
Sustainable Innovation with Immersive Learning
Sustainable Innovation with Immersive Learning
Leonel Morgado
 
Measuring, learning and applying multiplication facts.
Measuring, learning and applying multiplication facts.
cgilmore6
 
Capitol Doctoral Presentation -June 2025.pptx
Capitol Doctoral Presentation -June 2025.pptx
CapitolTechU
 
Assisting Individuals and Families to Promote and Maintain Health – Unit 7 | ...
Assisting Individuals and Families to Promote and Maintain Health – Unit 7 | ...
RAKESH SAJJAN
 
Non-Communicable Diseases and National Health Programs – Unit 10 | B.Sc Nursi...
Non-Communicable Diseases and National Health Programs – Unit 10 | B.Sc Nursi...
RAKESH SAJJAN
 
Energy Balances Of Oecd Countries 2011 Iea Statistics 1st Edition Oecd
Energy Balances Of Oecd Countries 2011 Iea Statistics 1st Edition Oecd
razelitouali
 
What is FIle and explanation of text files.pptx
What is FIle and explanation of text files.pptx
Ramakrishna Reddy Bijjam
 
How to Implement Least Package Removal Strategy in Odoo 18 Inventory
How to Implement Least Package Removal Strategy in Odoo 18 Inventory
Celine George
 
Introduction to problem solving Techniques
Introduction to problem solving Techniques
merlinjohnsy
 
Introduction to Generative AI and Copilot.pdf
Introduction to Generative AI and Copilot.pdf
TechSoup
 
Paper 107 | From Watchdog to Lapdog: Ishiguro’s Fiction and the Rise of “Godi...
Paper 107 | From Watchdog to Lapdog: Ishiguro’s Fiction and the Rise of “Godi...
Rajdeep Bavaliya
 
JHS SHS Back to School 2024-2025 .pptx
JHS SHS Back to School 2024-2025 .pptx
melvinapay78
 
PEST OF WHEAT SORGHUM BAJRA and MINOR MILLETS.pptx
PEST OF WHEAT SORGHUM BAJRA and MINOR MILLETS.pptx
Arshad Shaikh
 
june 10 2025 ppt for madden on art science is over.pptx
june 10 2025 ppt for madden on art science is over.pptx
roger malina
 
2025 June Year 9 Presentation: Subject selection.pptx
2025 June Year 9 Presentation: Subject selection.pptx
mansk2
 
Unit- 4 Biostatistics & Research Methodology.pdf
Unit- 4 Biostatistics & Research Methodology.pdf
KRUTIKA CHANNE
 
How to Manage Inventory Movement in Odoo 18 POS
How to Manage Inventory Movement in Odoo 18 POS
Celine George
 
FIRST DAY HIGH orientation for mapeh subject in grade 10.pptx
FIRST DAY HIGH orientation for mapeh subject in grade 10.pptx
GlysdiEelesor1
 
Overview of Employee in Odoo 18 - Odoo Slides
Overview of Employee in Odoo 18 - Odoo Slides
Celine George
 
Sustainable Innovation with Immersive Learning
Sustainable Innovation with Immersive Learning
Leonel Morgado
 
Measuring, learning and applying multiplication facts.
Measuring, learning and applying multiplication facts.
cgilmore6
 
Ad

iOS 9 Programming Fundamentals with Swift Swift Xcode and Cocoa Basics 2nd Edition Matt Neuburg

  • 1. Download the full version and explore a variety of ebooks or textbooks at https://ebookultra.com iOS 9 Programming Fundamentals with Swift Swift Xcode and Cocoa Basics 2nd Edition Matt Neuburg _____ Follow the link below to get your download now _____ https://ebookultra.com/download/ios-9-programming- fundamentals-with-swift-swift-xcode-and-cocoa-basics-2nd- edition-matt-neuburg/ Access ebookultra.com now to download high-quality ebooks or textbooks
  • 2. Here are some recommended products for you. Click the link to download, or explore more at ebookultra.com Programming iOS 6 3rd Edition Fundamentals of iPhone iPad and iPod touch Development Matt Neuburg https://ebookultra.com/download/programming-ios-6-3rd-edition- fundamentals-of-iphone-ipad-and-ipod-touch-development-matt-neuburg/ Programming iOS 10 Dive Deep into Views View Controllers and Frameworks 7th Edition Matt Neuburg https://ebookultra.com/download/programming-ios-10-dive-deep-into- views-view-controllers-and-frameworks-7th-edition-matt-neuburg/ iOS 8 SDK Development Creating iPhone and iPad Apps with Swift The Pragmatic Programmers 2nd Edition Adamson https://ebookultra.com/download/ios-8-sdk-development-creating-iphone- and-ipad-apps-with-swift-the-pragmatic-programmers-2nd-edition- adamson/ The Basic Writings of Jonathan Swift Jonathan Swift https://ebookultra.com/download/the-basic-writings-of-jonathan-swift- jonathan-swift/
  • 3. Learn Swift on the Mac For OS X and iOS 2015th Edition Waqar Malik https://ebookultra.com/download/learn-swift-on-the-mac-for-os-x-and- ios-2015th-edition-waqar-malik/ Process Selection 2nd Edition 2003 K G Swift https://ebookultra.com/download/process-selection-2nd- edition-2003-k-g-swift/ Tom Swift and his Submarine Boat The fourth book in the Tom Swift series Victor Appleton https://ebookultra.com/download/tom-swift-and-his-submarine-boat-the- fourth-book-in-the-tom-swift-series-victor-appleton/ Bridge Team Management 2nd Revised edition Edition Aj Swift https://ebookultra.com/download/bridge-team-management-2nd-revised- edition-edition-aj-swift/ Swift 2 Blueprints 1st Edition Costa https://ebookultra.com/download/swift-2-blueprints-1st-edition-costa/
  • 5. iOS 9 Programming Fundamentals with Swift Swift Xcode and Cocoa Basics 2nd Edition Matt Neuburg Digital Instant Download Author(s): Matt Neuburg ISBN(s): 9781491936771, 1491936770 Edition: 2 File Details: PDF, 4.33 MB Year: 2015 Language: english
  • 6. Matt Neuburg iOS 9 Programming Fundamentals with Swift SWIFT, XCODE, AND COCOA BASICS C o v e r s i O S 9 , X c o d e 7 , a n d S w i f t 2 . 0
  • 7. MOBILE DEVELOPMENT / IOS iOS 9 Programming Fundamentals with Swift ISBN: 978-1-491-93677-1 US $49.99 CAN $57.99 “ Neuburg is my favorite programming book writer, period.” —John Gruber Daring Fireball Matt Neuburg has a PhD in Classics and has taught at many colleges and universities. He has served as editor of MacTech magazine and as contrib- uting editor for TidBITS. He has writ- ten many OS X and iOS applications. Previous books include Programming iOS 8, REALbasic: The Definitive Guide, and AppleScript: The Definitive Guide. Twitter: @oreillymedia facebook.com/oreilly Move into iOS development by getting a firm grasp of its fundamentals, including the Xcode IDE, the Cocoa Touch framework, and Swift 2.0—the latest version of Apple's acclaimed programming language. With this thoroughly updated guide, you'll learn Swift’s object-oriented concepts, understand how to use Apple's development tools, and discover how Cocoa provides the underlying functionality iOS apps need to have. ■ ■ Explore Swift’s object-oriented concepts: variables and functions, scopes and namespaces, object types and instances ■ ■ Become familiar with built-in Swift types such as numbers, strings, ranges, tuples, Optionals, arrays, dictionaries, and sets ■ ■ Learn how to declare, instantiate, and customize Swift object types—enums, structs, and classes ■ ■ Discover powerful Swift features such as protocols and generics ■ ■ Catch up on Swift 2.0 innovations: option sets, protocol extensions, error handling, guard statements, availability checks, and more ■ ■ Tour the lifecycle of an Xcode project from inception to App Store ■ ■ Create app interfaces with nibs and the nib editor, Interface Builder ■ ■ Understand Cocoa’s event-driven model and its major design patterns and features ■ ■ Find out how Swift communicates with Cocoa’s C and Objective-C APIs Once you master the fundamentals, you'll be ready to tackle the details of iOS app development with author Matt Neuburg's companion guide, Programming iOS 9. Programming iOS 9 978-1-491-93685-6
  • 8. Matt Neuburg Boston SECOND EDITION iOS 9 Programming Fundamentals with Swift Swift, Xcode, and Cocoa Basics
  • 9. iOS 9 Programming Fundamentals with Swift, Second Edition by Matt Neuburg Copyright © 2016 Matt Neuburg. All rights reserved. Printed in the United States of America. Published by O’Reilly Media, Inc., 1005 Gravenstein Highway North, Sebastopol, CA 95472. O’Reilly books may be purchased for educational, business, or sales promotional use. Online editions are also available for most titles (http://safaribooksonline.com). For more information, contact our corporate/ institutional sales department: 800-998-9938 or [email protected]. Editor: Rachel Roumeliotis Production Editor: Kristen Brown Proofreader: O’Reilly Production Services Indexer: Matt Neuburg Cover Designer: Karen Montgomery Interior Designer: David Futato Illustrator: Matt Neuburg April 2015: First Edition October 2015: Second Edition Revision History for the Second Edition: 2015-09-23: First release See http://oreilly.com/catalog/errata.csp?isbn=9781491936771 for release details. The O’Reilly logo is a registered trademark of O’Reilly Media, Inc. iOS 9 Programming Fundamentals with Swift, the image of a harp seal, and related trade dress are trademarks of O’Reilly Media, Inc. While the publisher and the author have used good faith efforts to ensure that the information and instruc‐ tions contained in this work are accurate, the publisher and the author disclaim all responsibility for errors or omissions, including without limitation responsibility for damages resulting from the use of or reliance on this work. Use of the information and instructions contained in this work is at your own risk. If any code samples or other technology this work contains or describes is subject to open source licenses or the intel‐ lectual property rights of others, it is your responsibility to ensure that your use thereof complies with such licenses and/or rights. ISBN: 978-1-491-93677-1 [LSI]
  • 10. Table of Contents Preface. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xiii Part I. Language 1. The Architecture of Swift. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 Ground of Being 3 Everything Is an Object? 5 Three Flavors of Object Type 6 Variables 6 Functions 8 The Structure of a Swift File 9 Scope and Lifetime 11 Object Members 12 Namespaces 13 Modules 13 Instances 14 Why Instances? 16 self 19 Privacy 20 Design 21 Object Types and APIs 22 Instance Creation, Scope, and Lifetime 24 Summary and Conclusion 25 2. Functions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27 Function Parameters and Return Value 27 Void Return Type and Parameters 30 iii
  • 11. Function Signature 32 External Parameter Names 32 Overloading 35 Default Parameter Values 36 Variadic Parameters 37 Ignored Parameters 38 Modifiable Parameters 38 Function In Function 42 Recursion 44 Function As Value 44 Anonymous Functions 47 Define-and-Call 52 Closures 53 How Closures Improve Code 55 Function Returning Function 56 Closure Setting a Captured Variable 59 Closure Preserving Its Captured Environment 59 Curried Functions 61 3. Variables and Simple Types. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63 Variable Scope and Lifetime 63 Variable Declaration 65 Computed Initializer 67 Computed Variables 68 Setter Observers 71 Lazy Initialization 73 Built-In Simple Types 75 Bool 76 Numbers 77 String 85 Character 89 Range 93 Tuple 95 Optional 98 4. Object Types. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111 Object Type Declarations and Features 111 Initializers 113 Properties 119 Methods 122 iv | Table of Contents
  • 12. Subscripts 124 Nested Object Types 126 Instance References 127 Enums 129 Case With Fixed Value 130 Case With Typed Value 131 Enum Initializers 132 Enum Properties 134 Enum Methods 135 Why Enums? 136 Structs 137 Struct Initializers, Properties, and Methods 137 Struct As Namespace 139 Classes 139 Value Types and Reference Types 140 Subclass and Superclass 144 Class Initializers 150 Class Deinitializer 158 Class Properties and Methods 159 Polymorphism 161 Casting 164 Type Reference 168 Protocols 173 Why Protocols? 174 Protocol Type Testing and Casting 176 Declaring a Protocol 177 Optional Protocol Members 179 Class Protocol 180 Implicitly Required Initializers 181 Literal Convertibles 183 Generics 184 Generic Declarations 186 Type Constraints 188 Explicit Specialization 190 Associated Type Chains 191 Additional Constraints 194 Extensions 197 Extending Object Types 198 Extending Protocols 200 Extending Generics 203 Table of Contents | v
  • 13. Umbrella Types 205 AnyObject 205 AnyClass 208 Any 209 Collection Types 210 Array 210 Dictionary 224 Set 229 5. Flow Control and More. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 235 Flow Control 235 Branching 236 Loops 248 Jumping 253 Operators 265 Privacy 268 Private Declaration 269 Public Declaration 271 Privacy Rules 272 Introspection 272 Memory Management 273 Weak References 275 Unowned References 276 Weak and Unowned References in Anonymous Functions 278 Memory Management of Protocol-Typed References 281 Part II. IDE 6. Anatomy of an Xcode Project. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 285 New Project 285 The Project Window 288 The Navigator Pane 289 The Utilities Pane 295 The Editor 296 The Project File and Its Dependents 299 The Target 301 Build Phases 302 Build Settings 304 Configurations 305 vi | Table of Contents
  • 14. Schemes and Destinations 306 From Project to Running App 309 Build Settings 311 Property List Settings 312 Nib Files 313 Additional Resources 313 Code Files and the App Launch Process 316 Frameworks and SDKs 321 Renaming Parts of a Project 324 7. Nib Management. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 325 The Nib Editor Interface 326 Document Outline 328 Canvas 330 Inspectors and Libraries 332 Nib Loading 334 When Nibs Are Loaded 334 Manual Nib Loading 336 Connections 338 Outlets 338 The Nib Owner 340 Automatically Configured Nibs 343 Misconfigured Outlets 344 Deleting an Outlet 345 More Ways to Create Outlets 346 Outlet Collections 349 Action Connections 350 More Ways to Create Actions 352 Misconfigured Actions 353 Connections Between Nibs — Not! 354 Additional Configuration of Nib-Based Instances 354 8. Documentation. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 359 The Documentation Window 360 Class Documentation Pages 362 Sample Code 365 Quick Help 366 Symbols 367 Header Files 368 Internet Resources 369 Table of Contents | vii
  • 15. 9. Life Cycle of a Project. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 371 Device Architecture and Conditional Code 371 Backward Compatibility 372 Device Type 374 Version Control 375 Editing and Navigating Your Code 377 Autocompletion 378 Snippets 380 Fix-it and Live Syntax Checking 381 Navigation 382 Finding 384 Running in the Simulator 385 Debugging 386 Caveman Debugging 386 The Xcode Debugger 389 Testing 395 Clean 401 Running on a Device 402 Running Without a Developer Program Membership 403 Obtaining a Developer Program Membership 404 Obtaining a Certificate 405 Obtaining a Development Provisioning Profile 407 Running the App 408 Profile and Device Management 409 Profiling 409 Gauges 410 Instruments 410 Localization 413 Localizing the Info.plist 414 Localizing a Nib File 416 Localizing Code Strings 418 Localizing With XML Files 420 Archiving and Distribution 422 Ad Hoc Distribution 424 Final App Preparations 426 Icons in the App 426 Other Icons 427 Launch Images 428 Screenshots and Video Previews 429 Property List Settings 430 viii | Table of Contents
  • 16. Submission to the App Store 431 Part III. Cocoa 10. Cocoa Classes. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 437 Subclassing 437 Categories and Extensions 440 How Swift Uses Extensions 441 How You Use Extensions 441 How Cocoa Uses Categories 442 Protocols 443 Informal Protocols 445 Optional Methods 446 Some Foundation Classes 448 Useful Structs and Constants 448 NSString and Friends 450 NSDate and Friends 452 NSNumber 454 NSValue 455 NSData 456 Equality and Comparison 457 NSIndexSet 458 NSArray and NSMutableArray 459 NSDictionary and NSMutableDictionary 461 NSSet and Friends 462 NSNull 463 Immutable and Mutable 463 Property Lists 464 Accessors, Properties, and Key–Value Coding 465 Swift Accessors 466 Key–Value Coding 467 Uses of Key–Value Coding 468 KVC and Outlets 470 Key Paths 470 Array Accessors 471 The Secret Life of NSObject 472 11. Cocoa Events. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 475 Reasons for Events 475 Table of Contents | ix
  • 17. Subclassing 476 Notifications 477 Receiving a Notification 478 Unregistering 481 Posting a Notification 482 NSTimer 483 Delegation 484 Cocoa Delegation 484 Implementing Delegation 486 Data Sources 488 Actions 488 The Responder Chain 492 Deferring Responsibility 493 Nil-Targeted Actions 493 Key–Value Observing 494 Swamped by Events 498 Delayed Performance 501 12. Memory Management. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 505 Principles of Cocoa Memory Management 505 Rules of Cocoa Memory Management 506 What ARC Is and What It Does 508 How Cocoa Objects Manage Memory 508 Autorelease Pool 509 Memory Management of Instance Properties 511 Retain Cycles and Weak References 512 Unusual Memory Management Situations 514 Nib Loading and Memory Management 519 Memory Management of CFTypeRefs 520 Property Memory Management Policies 521 Debugging Memory Management Mistakes 524 13. Communication Between Objects. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 525 Visibility by Instantiation 526 Visibility by Relationship 528 Global Visibility 529 Notifications and KVO 530 Model–View–Controller 531 A. C, Objective-C, and Swift. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 535 x | Table of Contents
  • 18. Index. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 561 Table of Contents | xi
  • 20. Preface On June 2, 2014, Apple’s WWDC keynote address ended with a shocking announce‐ ment: “We have a new programming language.” This came as a huge surprise to the developer community, which was accustomed to Objective-C, warts and all, and doubt‐ ed that Apple could ever possibly relieve them from the weight of its venerable legacy. The developer community, it appeared, had been wrong. Having picked themselves up off the floor, developers immediately began to examine this new language — Swift — studying it, critiquing it, and deciding whether to use it. My own first move was to translate all my existing iOS apps into Swift; this was enough to convince me that, for all its faults, Swift deserved to be adopted by new students of iOSprogramming,andthatmybooks,therefore,shouldhenceforthassumethatreaders are using Swift. The Swift language is designed from the ground up with these salient features: Object-orientation Swift is a modern, object-oriented language. It is purely object-oriented: “Every‐ thing is an object.” Clarity Swift is easy to read and easy to write, with minimal syntactic sugar and few hidden shortcuts. Its syntax is clear, consistent, and explicit. Safety Swift enforces strong typing to ensure that it knows, and that you know, what the type of every object reference is at every moment. Economy Swift is a fairly small language, providing some basic types and functionalities and no more. The rest must be provided by your code, or by libraries of code that you use — such as Cocoa. xiii
  • 21. Exploring the Variety of Random Documents with Different Content
  • 22. clear as crystal? See the twelve foundations of her walls, and in them the names of the twelve apostles of the Lamb. And the building of the walls of it are of jasper; and the city is pure gold, like unto clear glass; and the foundations are garnished with all manner of precious stones. And the twelve gates are twelve pearls, every several gate is of one pearl; and the street of the city is pure gold, as it were transparent glass. There is no temple in it; for the Lord God Almighty, and the Lamb are the temple of it. It hath no need of the sun, neither of the moon in it; for the glory of God doth lighten it, and the Lamb is the light thereof; and the nations of them which are saved, shall walk in the light of it. These sayings are faithful and true: And the Lord God of the holy prophets sent his angels and his own Son, to shew unto his servants the things which must shortly be done.[381] Say now to all this, This is thy rest, O my soul! And this must be the place of thy everlasting habitation. Let all the sons of Sion rejoice, let the daughters of Jerusalem be glad; for great is the Lord, and greatly to be praised in the city of our God, in the mountain of his holiness. Beautiful for situation, the joy of the whole earth is Mount Sion. God is known in her palaces for a refuge.[382] [379] Luke xii, 32. [380] Psalm xlviii, 12, 13. [381] Revelation xxi, 11-24. xxii, 6. [382] Psalm xlviii, 11, 1-3. § 18. Yet proceed on. The soul that loves, ascends frequently, and runs familiarly through the streets of the heavenly Jerusalem, visiting the Patriarchs and prophets, saluting the apostles, and admiring the armies of martyrs: So do thou lead on thy heart as from street to street; bring it into the palace of the Great King; lead it, as it were, from chamber to chamber. Say to it; Here must I lodge; here must I live; here must I praise; here must I love, and be beloved. I must shortly be one of this heavenly choir, and be better skilled in the music. Among this blessed company must I take up my place, my voice must join to make up the melody. My tears will then be wiped away; my groans be turned to another tune; my cottage of
  • 23. clay be changed to this palace; my prison-rags to these splendid robes; and my sordid flesh shall be put off, and such a sun-like spiritual body be put on: For the former things are here passed away.[383] Glorious things are spoken of thee, O city of God![384] When I look upon this glorious place, what a dunghill and dungeon, methinks is earth? O what difference betwixt a man feeble, pained, groaning, dying, rotting in the grave, and one of these triumphant, shining saints? Here shall I drink of the river of pleasures, the streams whereof make glad the city of God.[385] Must Israel, under the bondage of the law, serve the Lord with joyfulness, and with gladness of heart, for the abundance of all things.[386] Surely I shall serve him with joyfulness and gladness of heart, for the abundance of glory. Did persecuted saints take joyfully the spoiling of their goods?[387] And shall not I take joyfully such a full reparation of all my losses? Was it a celebrated day wherein the Jews rested from their enemies, because it was turned unto them from sorrow to joy, and from mourning into a good day?[388] What a day then will that be to my soul, whose rest and change will be unconceivably greater? When the wise men saw the star that led to Christ, they rejoiced with exceeding great joy.[389] But I shall shortly see him, who is himself the bright and morning star.[390] If the disciples departed from the sepulchre with great joy, when they had but heard that their Lord was risen from the dead;[391] what will be my joy, when I see him reigning in glory, and myself raised to a blessed communion with him? Then shall I indeed have beauty for ashes, the oil of joy for mourning, and the garment of praise for the spirit of heaviness; and Sion shall be made an eternal excellency, a joy of many generations.[392] Why then do I not rise from the dust, and cease my complaints? Why do I not trample on vain delights, and feed on the foreseen delights of glory? Why is not my life a continual joy, and the savor of heaven perpetually upon my spirit? [383] Revelation xxi, 4. [384] Psalm lxxxvii, 3. [385] Psalm xxxvi, 8. xlvi, 4. [386] Deuteronomy xxviii, 47.
  • 24. [387] Hebrews x, 34. [388] Esther ix, 22. [389] Matthew ii, 10. [390] Revelation, xxii, 16. [391] Matthew xxviii, 7, 8. [392] Isaiah lxi, 3. lx, 15. § 19. Let me here observe, that there is no necessity to exercise these affections, either exactly in this order, or all at one time. Sometimes one of thy affections may need more exciting, or may be more lively than the rest; or, if thy time be short, one may be exercised one day, and another upon the next; all which must be left to thy prudence to determine. Thou hast also an opportunity, if inclined to make use of it, to exercise opposite and more mixed affections; such as—hatred of sin, which would deprive thy soul of these immortal joys;—godly fear, lest thou shouldst abuse thy mercy;—godly shame and grief, for having abused it;—unfeigned repentance;—self-indignation;—jealousy over thy heart;—and pity for those who are in danger of losing these immortal joys. § 20. (III.) We are also to take notice, how heavenly contemplation is promoted by soliloquy and prayer. Though consideration be the chief instrument in this work, yet, by itself, it is not so likely to affect the heart. In this respect contemplation is like preaching, where the mere explaining of truths and duties is seldom attended with such success, as the lively application of them to the conscience; and especially when a Divine blessing is earnestly sought to accompany such application. § 21. (1.) By soliloquy, or a pleading the case with thyself, thou must in thy meditation quicken thy own heart. Enter into a serious debate with it. Plead with it in the most moving and affecting language, and urge it with the most powerful and weighty arguments. It is what holy men of God have practised in all ages. Thus David, Why art thou cast down, O my soul! And why art thou disquieted within me? Hope thou in God, for I shall yet praise him,
  • 25. who is the health of my countenance, and my God.[393] And again, Bless the Lord, O my soul! and all that is within me, bless his holy name. Bless the Lord, O my soul! and forget not all his benefits,[394] c. This soliloquy is to be made use of according to the several affections of the soul, and according to its several necessities. It is a preaching to one's self: For as every good master or father of a family is a good preacher to his own family; so every good Christian is a good preacher to his own soul. Therefore the very same method which a minister should use in his preaching to others, every Christian, should endeavor after in speaking to himself. Observe the matter and manner of the most heart-affecting minister; let him be as a pattern for your imitation; and the same way that he takes with the hearts of his people, do thou also take with thy own heart. Do this in thy heavenly contemplation; explain to thyself the things on which thou dost meditate; confirm thy faith in them from Scripture; and then apply them to thyself, according to their nature, and thy own necessity. There is no need to object against this, from a sense of thy own inability. Doth not God command thee to teach the Scriptures diligently unto thy children, and talk of them when thou sittest in thine house, and when thou walkest by the way, and when thou liest down, and when thou risest up?[395] And if thou must have some ability to teach thy children, much more to teach thyself; and if thou canst talk of Divine things to others, why not also to thine own heart? [393] Psalm xliii, 11. [394] Psalm ciii, 1-5. [395] Deuteronomy vi, 7. § 22. (2.) Heavenly contemplation is also promoted, by speaking to God in prayer; as well as by speaking to ourselves in soliloquy. Ejaculatory prayer may very properly be intermixed with meditation, as a part of the duty. How often do we find David, in the same Psalm, sometimes pleading with his soul, and sometimes with God? The apostle bids us speak to ourselves in psalms, and hymns, and spiritual songs;[396] and no doubt we may also speak to God in them.
  • 26. This keeps the soul sensible of the Divine presence, and tends greatly to quicken and raise it. As God is the highest object of our thoughts, so our viewing of him, speaking to him, and pleading with him, more elevates the soul, and excites the affections, than any other part of meditation. Though we remain unaffected, while we plead the case with ourselves; yet, when we turn our speech to God, it may strike us with awe; and the holiness and majesty of Him whom we speak to, may cause both the matter and words to pierce the deeper. When we read, that Isaac went out to meditate in the field, the margin says, to pray; for the Hebrew word signifies both. Thus in our meditations, to intermix soliloquy and prayer; sometimes speaking to our own hearts, and sometimes to God, is, I apprehend, the highest step we can advance to in this heavenly work. Nor should we imagine, it will be as well to take up with prayer alone, and lay aside meditation. For they are distinct duties, and must both of them be performed. We need one as well as the other, and therefore shall wrong ourselves by neglecting either. Besides the mixture of them, like music, will be more engaging; as the one serves to put life into the other. And our speaking to ourselves in meditation, should go before our speaking to God in prayer. For want of attending to this due order, men speak to God with far less reverence and affection than they would speak to an angel, if he should appear to them; or to a judge, if they were speaking for their lives. Speaking to the God of heaven in prayer, is a weightier duty than most are aware of. [396] Ephesians v, 19.
  • 27. CHAP. XV. Heavenly contemplation assisted by sensible objects, and guarded against a treacherous heart. § 1. As it is difficult to maintain a lively impression of heavenly things, therefore, § 2. (I.) Heavenly contemplation may be assisted by sensible objects; § 3. (1.) If we draw strong suppositions from sense; and, § 4-11. (2.) If we compare the objects of sense with the objects of faith, several instances of which are produced. § 12. (II.) Heavenly contemplation may also be guarded against a treacherous heart, by considering, § 13, 14. (1.) The great backwardness of the heart to this duty; § 15. (2.) Its trifling in it; § 16. (3.) Its wandering from it; and, § 17. (4.) Its too abruptly putting an end to it. HE most difficult part of heavenly contemplation, is to maintain a lively sense of heavenly things upon our hearts. It is easier, merely to think of heaven a whole day, than to be lively and affectionate in those thoughts a quarter of an hour. Faith is imperfect, for we are renewed but in part; and goes against a world of resistance; and, being supernatural, is prone to decline and languish, unless it be continually excited. Sense is strong, according to the strength of the flesh; and being natural, continues while nature continues. The objects of faith are far off; but those of sense are nigh. We must go as far as heaven for our joys. To rejoice in what we never saw, nor ever knew the man that did see, and this upon a mere promise in the Bible; is not so easy, as to rejoice in what we see and possess. It must therefore be a point of spiritual prudence, to call in sense to the assistance of faith. It will be a good work, if we can make friends of these usual enemies, and make them instruments for raising us to God, which are so often the means of drawing us from him. Why hath God given us either our senses, or their common objects, if they might not be serviceable to his praise? Why doth the Holy Spirit describe the glory of the New Jerusalem, in expressions that are grateful to the flesh? Is it that we might think heaven to be made of gold and pearl? or that saints and
  • 28. angels eat and drink? No, but to help us to conceive of them as we are able, and to use these borrowed phrases as a glass, in which we must see the things themselves imperfectly represented, till we come to an immediate and perfect sight. And besides shewing how heavenly contemplation may be assisted by sensible objects,—this chapter will also shew how it may be preserved from a wandering heart. § 2. (I.) In order that heavenly contemplation may be assisted by sensible objects, let me only advise—to draw strong suppositions from sense,—and to compare the objects of sense with objects of faith. § 3. (1.) For the helping of thy affections in heavenly contemplation, draw as strong suppositions as possible from thy senses. Think on the joys above, as boldly as Scripture hath expressed them. Bring down thy conceptions to the reach of sense. Both love and joy are promoted by familiar acquaintance. When we attempt to think of God and glory, without the Scripture-manner of representing them, we are lost, and have nothing to fix our thoughts upon; we set them so far from us, that our thoughts are strange, and we are ready to say, what is above us, is nothing to us. To conceive of God and glory, only as above our conception, will beget but little love; or as above our love, will produce little joy. Therefore put Christ no farther from you, than he hath put himself, lest the Divine nature be again inaccessible. Think of Christ, as in our own glorified nature. Think of glorified saints, as men made perfect. Suppose thyself a companion with John in his survey of the new Jerusalem, and viewing the thrones, the Majesty, the heavenly hosts, the shining splendor, which he saw. Suppose thyself his fellow- traveller into the celestial kingdom, and that thou hadst seen all the saints in their white robes, with palms in their hands; and that thou hadst heard those Songs of Moses, and of the Lamb. If thou hadst really seen and heard these things, in what a rapture wouldst thou have been? and the more seriously thou puttest this supposition to thyself, the more will thy meditation elevate thy heart. Do not, like
  • 29. the papists, draw them in pictures; but get the liveliest picture of them in thy mind that thou possibly canst, by contemplating the Scripture-account of them, till thou canst say, Methinks I see a glimpse of glory! methinks I hear the shouts of joy and praise, and even stand by Abraham and David, Peter and Paul, and other triumphant souls! Methinks I even see the Son of God appearing in the clouds, and the world standing at his bar to receive their doom; and hear him say Come ye blessed of my Father; and see them go rejoicing into the joy of their Lord! My very dreams of these things have sometimes greatly affected me, and should not these just suppositions much more affect me? What if I had seen, with Paul, those unutterable things! Or, with Stephen, had seen heaven opened, and Christ sitting at the right hand of God? Surely that one sight was worth his storm of stones. What if I had seen, as Isaiah did, the Lord sitting upon his throne, and all the host of heaven standing on his right hand and on his left? Such things did these men of God see; and I shall shortly see far more than ever they saw, till they were loosed from flesh, as I must be. Thus you see how it excites our affections in this heavenly work, if we make strong and familiar suppositions from our bodily senses, concerning the state of blessedness, as the Spirit hath in condescending language expressed it. § 4. (2.) The other way in which our senses may promote this heavenly work, is by comparing the objects of sense with the objects of faith. As for instance:—You may strongly argue with your hearts from the corrupt delights of sensual men, to the joys above. Think with yourselves; Is it such a delight to a sinner to do wickedly? And will it not be delightful indeed to live with God? Hath the drunkard such delight in his cups, that the fears of damnation will not make him forsake them? Will the whore-master rather part with his credit, estate, and salvation, than with his brutish delight? If the way to hell can afford such pleasure, what then are the pleasures of the saints in heaven? if the covetous man hath so much pleasure in his wealth, and the ambitious man in places of power and titles of honor; what then have the saints in everlasting treasures, and in heavenly
  • 30. honors, where we shall be set above principalities and powers, and be made the glorious spouse of Christ? How delightfully will the voluptuous follow their recreations from morning to night, or sit at their cards and dice, nights and days together? O the delight we shall have, when we come to our rest, in beholding the face of the living God, and in singing forth praises to him and the Lamb!— Compare also the delights above, with the lawful and moderate delights of sense. Think with thyself, How sweet is food to my taste when I am hungry; especially if it be, as Isaac said, such as I love, which my temperance and appetite incline to? What delight then must my soul have in feeding upon Christ, the living bread, and in eating with him at his table in his kingdom? Was a mess of pottage so sweet to Esau in his hunger, that he would buy it at so dear a rate as his birth-right? How highly then should I value this never- perishing food? How pleasant is drink in the extremity of thirst, scarcely to be expressed; enough to make the strength of Sampson revive? O how delightful will it be to my soul to drink of that fountain of living water, which whoso drinketh it shall thirst no more? How delightful are grateful odors to the smell; or music to the ear; or beautiful sights to the eye? What fragrance then hath the precious ointment which is poured on the head of our glorified Savior, and which must be poured on the head of all his saints, and will fill all heaven with its odor? How delightful is the music of the heavenly host? How pleasing will be those real beauties above? How glorious the building not made with hands, the house that God himself dwells in, the walks and prospects in the city of God; and the celestial paradise! § 5. Compare also the delights above, with those we find in natural knowledge. These are far beyond the delights of sense; but how much farther are the delights of heaven? Think then, Can an Archimedes be so taken up with his mathematical invention, that the threats of death cannot disengage him, but he will die in the midst of his contemplations? Should I not be much more taken up with the delights of glory, and die with these contemplations fresh upon my soul; especially when my death will perfect my delights, while those
  • 31. of Archimedes die with him? What exquisite pleasure is it to dive into the secrets of nature, and find out the mystery of arts and sciences; especially if we make a new discovery in any one of them? What high delights are there then in the knowledge of God and Christ? If the face of human learning be so beautiful, as to make sensual pleasures appear base and brutish; how beautiful then is the face of God? When we meet with some choice book, how could we read it day and night, almost forgetful of meat, drink, or sleep? What delights are there then at God's right hand, where we shall know in a moment all that is to be known?—Compare also the delights above, with the delights of morality, and of the natural affections. What delight had many sober heathens in the rules and practice of moral duties, so that they took him alone for an honest man, who did well through the love of virtue, and not merely for fear of punishment; yea, so much valued was this moral virtue, that they thought man's chief happiness consisted in it? Think then What excellency will there be in our heavenly perfection and in that uncreated perfection of God which we shall behold? What sweetness is there in the exercise of natural love, whether to children, parents, yoke-fellows, or intimate friends? Does David say of Jonathan, thy love to me was wonderful, passing the love of women? Did the soul of Jonathan cleave to David? Had Christ himself one disciple whom he especially loved, and who was wont to lean on his breast? If then the delights of close and cordial friendship be so great, what delight shall we have in the friendship of the Most High, and in our mutual intimacy with Jesus Christ, and in the dearest love of the saints? Surely this will be a stricter friendship, and these more lovely and desirable friends, than ever the sun beheld; and both our affections to our Father and Savior, and especially theirs to us, will be such as we never knew here. If one angel could destroy an host, the affections of spirits must also be proportionably stronger, so that we shall then love a thousand times more ardently than we can now. As all the attributes and works of God are incomprehensible, so is this of love: He will love us infinitely beyond our most perfect love to him. What then will there be in this mutual love?
  • 32. § 6. Compare also the excellencies of heaven, with those glorious works of creation which our eyes now behold. What wisdom, power, and goodness, are manifested therein? How does the majesty of the Creator shine in this fabric of the world? His works are great, sought out of all them that have pleasure therein. What Divine skill in forming the bodies of men or beasts? What excellency in every plant? What beauty in flowers? What variety and usefulness in herbs, fruits, and minerals? What wonders are contained in the earth and its inhabitants; the ocean of waters, with its motions and dimensions; and the constant succession of spring and autumn, of summer and winter? Think then, If these things, which are but servants to sinful man, are so full of mysterious worth, what is that place where God himself dwells, and which is prepared for just men made perfect with Christ? What glory is there in the least of yonder stars? What a vast resplendent body is yonder moon, and every planet? What an inconceivable glory hath the sun? But all this is nothing to the glory of heaven. Yonder sun must there be laid aside as useless. Yonder is but darkness to the lustre of my Father's house. I shall myself be as glorious as that sun. This whole earth is but my Father's footstool. This thunder is nothing to his dreadful voice. These winds are nothing to the breath of his mouth. If the sending rain, and making the sun to rise on the just, and on the unjust, be so wonderful; how much more wonderful and glorious will that sun be, which must shine on none but saints and angels?— Compare also the enjoyments above, with the wonders of Providence in the church and world. Would it not be an astonishing sight to see the sea stand as a wall on the right hand and on the left, and the dry land appear in the midst, and the people of Israel pass safely through, and Pharaoh and his host drowned? or to have seen the ten plagues of Egypt? or the rock gushing forth streams? or manna and quails rained from heaven? or the earth opening and swallowing up the wicked? But we shall see far greater things than these; not only sights more wonderful, but more delightful: There shall be no blood, nor wrath, intermingled; nor shall we cry out, as the men of Bethshemesh, Who is able to stand before this holy Lord God? How astonishing, to see the sun stand still in the firmament; or
  • 33. the dial of Ahaz go back ten degrees? But we shall see when there shall be no sun; or rather shall behold forever a sun of infinitely greater brightness. What a life should we live, if we could have drought or rain at our prayers; or have fire from heaven to destroy our enemies, as Elijah had; or raise the dead, as Elisha; or miraculously cure diseases, and speak all languages, as the Apostles? Alas, these are nothing to the wonders we shall see and possess with God; and all of them wonders of goodness and love? We shall ourselves be the subjects of more wonderful mercies than any of these. Jonah was raised but from a three day's burial in the belly of a fish; but we shall be raised from many years rottenness and dust; and that dust exalted to the glory of the sun; and that glory perpetuated through eternity. Surely, if we observe but common providences; as, the motion of the sun; the tides of the sea; the standing of the earth; the watering it with rain, as a garden; the keeping in order a wicked confused world; with many others; they are all admirable. But what are these to the Sion of God, the vision of the Divine Majesty, and the order of the heavenly hosts?—Add to these those particular providences which thou hast thyself enjoyed and recorded through thy life, and compare them with the mercies thou shalt have above. Look over the mercies of thy youth and riper age, of thy prosperity and adversity, of thy several places and relations; are they not excellent and innumerable, rich and engaging? How sweet was it to thee, when God resolved thy doubts; scattered thy fears; prevented the inconveniences into which thy own counsel would have cast thee; eased thy pains; healed thy sickness; and raised thee up, as from death and the grave? Think then, Are all these so sweet and precious, that without them my life would have been a perpetual misery? Hath his providence on earth lifted me so high, and his gentleness made me great? How sweet then will his glorious presence be? How high will his eternal love exalt me? and how great shall I be made in communion with his greatness? If my pilgrimage and warfare have such mercies, what shall I find in my home, and in my triumph? If God communicates so much to me while I remain a sinner; what will he bestow when I am a perfected saint? If I have had so much at
  • 34. such a distance from him; what shall I have in his immediate presence, where I shall ever stand before his throne? § 7. Compare the joys above, with the comforts thou hast here received in ordinances. Hath not the Bible been to thee as an open fountain, flowing with comforts day and night? What suitable promises have come into thy mind; so that with David, thou mayest say, Unless thy law had been my delight, I should then have perished in mine affliction? Think then, If his word be so full of consolations, what overflowing springs shall we find in God himself? If his letters are so comfortable, what will the glories of his presence be? If the promise is so sweet, what will the performance be? If the testament of our Lord, and our charter for the kingdom, be so comfortable, what will be our possession of the kingdom itself?— Think farther, What delights have I also found in the word preached? When I have sat under a heavenly, heart-searching teacher, how hath my heart been warmed? Methinks I have felt myself almost in heaven. How often have I gone to the congregation troubled in spirit, and returned joyful? How often have I gone doubting, and God hath sent me home persuaded of his love in Christ? What cordials have I met with to animate me in every conflict? If but the face of Moses shine so gloriously, what glory is there in the face of God? If the feet of them that publish peace, that bring good tidings of salvation, be beautiful; how beautiful is the face of the Prince of Peace? If this treasure be so precious in earthen vessels; what is that treasure laid up in heaven? Blessed are the eyes that see what is seen there, and the ears that hear the things that are heard there. There shall I hear Elijah, Isaiah, Jeremiah, John, Peter, Paul; not preaching to gainsayers, in imprisonment, persecution, and reproach; but triumphing in the praises of him that hath raised them to honor and glory. Think also, What joy is it to have access and acceptance in prayer; that I may always go to God, and open my case, and unbosom my soul to him, as to my most faithful friend? But it will be a more unspeakable joy, when I shall receive all blessings without asking, and all my necessities and miseries will be removed, and when God himself will
  • 35. be the portion and inheritance of my soul. As for the Lord's supper, What a privilege is it to be admitted to sit at his table, to have his covenant sealed to me there? But all the life and comfort there, is to assure me of the comforts hereafter. O the difference between the last supper of Christ on earth, and the marriage-supper of the Lamb at the great day! Then his room will be the glorious heavens; his attendants, all the hosts of angels and saints; no Judas, no unfurnished guest, comes there; but the humble believers must sit down by him, and their feast will be their mutual loving and rejoicing. Concerning the communion of saints, think with thyself, What a pleasure is it to live with intelligent and heavenly Christians? David says of such, they were all his delight. O what a delightful society then shall I have above? Had I but seen Job on the dunghill, what a mirror of patience? and what will it be to see him in glory? How delightful to have heard Paul and Silas singing in the stocks? How much more to hear them sing praises in heaven? What melody did David make on his harp? But how much more melodious to hear that sweet singer in the heavenly choir? What would I have given for an hour's free converse with Paul, when he was just come down from the third heaven? But I must shortly see those things myself, and possess what I see. Once more, think of praising God in concert with his saints. What if I had been in the place of those shepherds, who saw, and heard the heavenly host singing, Glory to God in the highest, and on earth peace, good will towards men? But I shall see and hear more glorious things. How blessed should I have thought myself, had I heard Christ in his thanksgivings to his Father? How much more, when I shall hear him pronounce me blessed? If there was such joy at bringing back the ark, or at rebuilding the temple; what will there be in the New Jerusalem? If the earth rent, when the people rejoiced at Solomon's coronation; what a joyful shout will there be at the appearing of the King of the church? If, when the foundations of the earth were laid, the morning stars sang together, and all the sons of God shouted for joy; what a joyful song will there be, when the world of glory is both founded and finished, when the top-stone is laid, and when the holy city is adorned as the bride, the Lamb's wife?
  • 36. § 8. Compare the joy thou shalt have in heaven, with what the saints have found in the way to it, and in the foretastes of it. When did God ever reveal the least of himself to any of his saints, but the joy of their hearts was answerable to the revelation? In what an ecstacy was Peter on the mount of transfiguration? Master, says he, it is good for us to be here; let us make three tabernacles! one for thee, and one for Moses, and one for Elias. As if he had said, O let us not go down again to yonder persecuting rabble; let us not return to our mean and suffering state. Is it not better to stay here now we are here? Is not here better company, and sweeter pleasure? How was Paul lifted up with what he saw? How did the face of Moses shine, when he had been talking with God? These were all extraordinary foretastes; but little to the full beatifical vision. How often have we read and heard of dying saints, who have been as full of joy as their hearts could hold; and when their bodies have felt the extremity of sickness and pain, have had much of heaven in their spirits, and their joy hath far exceeded their sorrows? If a spark of this fire be so glorious, even amidst the sea of adversity; what then is glory itself? O the joy that the martyrs have felt in the flames! They were flesh and blood, as well as we; it must therefore be some excellent thing that filled their spirits with joy while their bodies were burning. Think, reader, in thy meditations, Sure it must be some wonderful foretaste of glory that made the flames of fire easy, and the king of terrors welcome. What then is glory itself. What a blessed rest, when the thoughts of it made Paul desire to depart and be with Christ; and makes the saints never think themselves well, till they are dead? Shall Saunders embrace the stake, and cry Welcome cross? And shall not I more delightfully embrace my blessedness, and cry, Welcome crown? Shall Bradford kiss the faggot? And shall not I kiss the Savior? Shall another poor martyr rejoice to have her foot in the same hole of the stocks, in which Mr. Philpot's had been before her? And shall not I rejoice, that my soul shall live in the same place of glory, where Christ and his apostles are gone before me? Shall fire and faggot, prisons and banishment, cruel mockings and scourgings, be more welcome to others, than Christ and glory to me? God forbid.
  • 37. § 9. Compare the glory of the heavenly kingdom, with the glory of the church on earth, and of Christ in his state of humiliation. If Christ suffering in the room of sinners had such excellency, what is Christ at his Father's right hand? If the church under her sins and enemies have so much beauty, what will she have at the marriage of the Lamb? How wonderful was the Son of God in the form of a servant? When he is born, a new star must appear, and conduct the strangers to worship him in a manger; heavenly hosts with their songs must celebrate his nativity; while a child, he must dispute with doctors; when he enters upon his office, he turns water into wine; feeds thousands with a few loaves and fishes; cleanses the lepers, heals the sick, restores the lame, gives sight to the blind, and raises the dead. How wonderful then is his celestial glory? If there be such cutting down of boughs, and spreading of garments, and crying Hosanna, for one that comes into Jerusalem riding on an ass; what will there be when he comes with his angels in his glory? If they that heard him preach the gospel of the kingdom, confess, Never man spake like this man; they then that behold his majesty in his kingdom, will say, There was never glory like this glory. If, when his enemies came to apprehend him, they fell to the ground; if when he is dying, the earth quakes, the veil of the temple is rent, the sun eclipsed, the dead bodies of the saints arise, and the standers-by acknowledge, Verily this was the Son of God? O what a day will it be, when the dead must all arise, and stand before him; when he will once more shake, not the earth only, but the heavens also; when this sun shall be taken out of the firmament, and be everlastingly darkened with his glory; and when every tongue shall confess him to be Lord and King! If, when he rose again, death and the grave lost their power; if angels must roll away the stone, terrify the keepers till they are as dead men, and send the tidings to his disciples; if he ascend to heaven in their sight; what power, dominion, and glory, is he now possessed of, and which we must for ever possess with him! When he is gone, can a few poor fishermen and tent-makers cure the lame, blind, and sick, open prisons, destroy the disobedient, raise the dead, and astonish their adversaries? What a world will that be, where every one can do
  • 38. greater works than these! If the preaching of the gospel be accompanied with such power as to discover the secrets of the heart; humble the proud sinner, and make the most obdurate tremble; if it can make men burn their books, sell their lands, bring in the price and lay it down at the preacher's feet; if it can convert thousands, and turn the world upside down; if its doctrine, from the prisoner at the bar, can make the judge on the bench tremble; if Christ and his saints have this power and honor in the day of their abasement, and in the time appointed for their suffering and disgrace; what then will they have in their absolute dominion, and full advancement in their kingdom of glory? § 10. Compare the glorious change thou shalt have at last, with the gracious change which the Spirit hath here wrought on thy heart. There is not the smallest sincere grace in thee, but is of greater worth than the riches of the Indies; not a hearty desire and groan after Christ, but is more to be valued than the kingdoms of the world. A renewed nature is the very image of God; Christ dwelling in us; and the Spirit of God abiding in us: It is a beam from the face of God; the seed of God remaining us; the only inherent beauty of the rational soul: It ennobles man above all nobility; fits him to understand his Maker's pleasure, do his will, and receive his glory. If this grain of mustard seed be so precious, what is the tree of life in the midst of the paradise of God? If a spark of life, which will but strive against corruptions, and flame out a few desires and groans, be of so much worth; how glorious then is the fountain of this life? If we are said to be like God, when we are pressed down with a body of sin; sure we shall be much more like God, when we have no such thing as sin within us. Is the desire after, and love of heaven so excellent; what then is the thing itself? Is our joy in foreseeing and believing so sweet; what will be the joy of full possession! How glad is a Christian when he feels his heart begin to melt and be dissolved with the thoughts of sinful unkindness? Even this sorrow yields him joy. O what then will it be, when we shall know, and love, and rejoice, and praise in the highest perfection? Think with thyself, What a change was it, to be taken from that
  • 39. state wherein I was born, and in which I was rivetted by custom, when thousands of sins lay upon my score, and if I had so died, I had been damned forever? What an astonishing change, to be justified from all these enormous crimes, and freed from all these fearful plagues, and made an heir of heaven? How often, when I have thought of my regeneration, have I cried out, O blessed day! and blessed be the Lord that ever I saw it! How then shall I cry out in heaven, O blessed eternity! and blessed be the Lord that brought me to it! Did the angels of God rejoice to see my conversion? Surely they will congratulate my felicity in my salvation. Grace is but a spark raked up in the ashes, covered with flesh from the sight of the world, and sometimes covered with corruption from my own sight; but my everlasting glory will not be so clouded, nor my light be under a bushel, but on a hill, even upon Mount Sion, the Mount of God.
  • 40. § 11. Once more, compare the joys which thou shalt have above, with those foretastes of it which the Spirit hath given thee here. Hath not God sometimes revealed himself extraordinarily to thy soul, and let a drop of glory fall upon it? Hast thou not been ready to say, O that it might be thus with my soul continually? Didst thou never cry out with the martyr, after thy long and mournful expectations, He is come, He is come? Didst thou never, under a lively sermon of heaven, or in thy retired contemplations on that blessed state, perceive thy drooping spirits revive, and thy dejected heart lift up the head, and the light of heaven dawn on thy soul? Think with thyself, What is this earnest to the full inheritance? Alas, all this light, that so amazeth and rejoiceth me, is but a candle lighted from heaven, to lead me thither through this world of darkness: If some godly men have been overwhelmed with joy, till they have cried out, Hold, Lord, stay thy hand; I can bear no more: What then will be my joys in heaven, when my soul shall be so capable of seeing and enjoying God, that though the light be ten thousand times greater than the sun, yet my eyes shall be able for ever to behold it? Or, if thou hast not yet felt these sweet foretastes, (for every believer hath not felt them,) then make use of such delights as thou hast felt, in order the better to discern what thou shalt hereafter feel. § 12. (II.) I am now to shew how heavenly contemplation may be preserved from a wandering heart. Our chief work is here to discover the danger, and that will direct to the fittest remedy. The heart will prove the greatest hinderance in this heavenly employment; either, by backwardness to it;—or, by trifling in it;—or, by frequent excursions to other objects;—or, by abruptly ending the work before it is well begun. As you value the comfort of this work, these dangerous evils must be faithfully resisted. § 13. (1.) Thou wilt find thy heart as backward to this, I think, as to any work in the world. O what excuses will it make! What evasions will it find out! What delays and demurs, when it is ever so much convinced! either it will question, whether it be a duty or not, or, if it be so to others, whether to thyself. It will tell thee, This is a
  • 41. work for ministers, that have nothing else to study; or for persons that have more leisure than thou hast. If thou be a minister, it will tell thee, This is the duty of the people; it is enough for thee to meditate for their instruction, and let them meditate on what they have heard. As if it was thy duty only to cook their meat, and serve it up, and they alone must eat it, digest it, and live upon it. If all this will not do, thy heart will tell thee of other business, or set thee upon some other duty; for it had rather go to any duty than this. Perhaps it will tell thee, Other duties are greater, and therefore this must give place to them, because thou hast no time for both. Public business is more important; to study and preach for the saving of souls, must be preferred before these private contemplations. As if thou hadst not time to care for thy own salvation, for looking after that of others. Or thy charity to others were so great, that it obliges thee to neglect thy own eternal welfare. Or as if there were any better way to fit us to be useful to others, than making this proof of our doctrine ourselves. Certainly heaven is the best fire to light our candle at, and the best book for a preacher to study; and if we would be persuaded to study that more, the church would be provided with more heavenly lights; and when our studies are divine, and our spirits divine, our preaching will also be divine, and we may be called divines indeed. Or, if thy heart have nothing to say against the work, it will trifle away the time in delays, and promise this day and the next, but still keep off from the business. Or, it will give thee a flat denial, and oppose its own unwillingness to thy reason. All this I speak of the heart, so far as it is still carnal; for I know, so far as it is spiritual, it will judge this the sweetest work in the world. § 14. What is now to be done? Wilt thou do it, if I tell thee? Wouldst thou not say in a like case, What should I do with a servant that will not work? or with a horse that will not travel? Shall I keep them to look at? Then faithfully deal thus with thy heart; persuade it to the work; take no denial; chide it for its backwardness; use violence with it. Hast thou no command of thy own thoughts? Is not the subject of thy meditations a matter of choice, especially under
  • 42. this conduct of thy judgment? Surely God gave thee, with thy new nature, some power to govern thy thoughts. Art thou again become a slave to thy depraved nature? Resume thy authority. Call in the Spirit of Christ to thine assistance, who is never backward to so good a work, nor will deny his help in so just a cause. Say to him, Lord, thou gavest my reason the command of my thoughts and affections; the authority I have received over them is from thee; and now behold, they refuse to obey thine authority: Thou commandest me to set them to the work of heavenly meditation, but they rebel and stubbornly refuse the duty. Wilt thou not assist me to exercise that authority which thou hast given me? O send down thy Spirit, that I may enforce thy commands, and effectually compel them to obey thy will! Thus thou shalt see thy heart will submit, its resistance be overcome, and its backwardness be turned into cheerful compliance. § 15. (2.) Thy heart will also be likely to betray thee by trifling, when it should be effectually meditating. Perhaps, when thou hast an hour for meditation, the time will be spent before thy heart will be serious. This doing of duty, as if we did it not, ruins as many as the omission of it. Here let thine eye be always upon thy heart. Look not so much to the time it spends in the duty, as to the quantity and quality of the work that is done. You can tell by his work, whether a servant hath been diligent. Ask yourself, What affections have been yet exercised? How much am I yet got nearer to heaven? Think not, since thy heart is so trifling, it is better to let it alone: for, by this means, thou wilt certainly banish all spiritual obedience; because the best hearts, being but sanctified in part, will resist, so far as they are carnal. But rather consider well the corruption of thy nature; and that its sinful indispositions will not supersede the commands of God; nor one sin excuse for another; and that God has appointed means to excite our affections. This self-reasoning, self-considering duty of heavenly meditation, is the most singular means, both to excite and increase love. Therefore stay not from the duty, till thou feelest thy love constrain thee; any more than thou wouldst stay from the fire, till thou feelest thyself warm; but engage in the work, till love is excited, and then love will constrain thee to further duty.
  • 43. § 16. (3.) Thy heart will also be making excursions from thy heavenly meditation to other objects. It will be turning aside, like a careless servant, to talk with every one that passeth by. When there should be nothing in thy mind but heaven, it will be thinking of thy calling, or thy afflictions, or of every bird, or tree, or place thou seest. The cure is here the same as before; use watchfulness and violence. Say to thy heart, What, did I come hither to think of my worldly business, of persons, places, news, or vanity, or of any thing but heaven, be it ever so good? Canst thou not watch one hour? Wouldst thou leave this world, and dwell for ever with Christ in heaven, and not leave it one hour to dwell with Christ in meditation? Is this thy love to thy friend? Dost thou love Christ, and the place of thy eternal, blessed abode, no more than this? If the ravening fowls of wandering thoughts devour the meditations intended for heaven, they devour the life and joy of thy thoughts: Therefore drive them away from thy sacrifice, and strictly keep thy heart to the work. § 17. (4.) Abruptly ending thy meditation before it is well begun, is another way in which thy heart will deceive thee. Thou mayest easily perceive this in other duties. In secret prayer, is not thy heart urging thee to cut it short, and frequently making a motion to have done? So in heavenly contemplation, thy heart will be weary of the work, and will stop thy heavenly walk before thou art well warm. But charge it in the name of God to stay, and not do so great a work by halves. Say to it, Foolish heart! if thou beg a while, and goest away before thou hast thy alms, is not thy begging a lost labor? If thou stoppest before the end of thy journey, is not thy travel lost? Thou camest hither in hope to have a sight of the glory which thou must inherit; and wilt thou stop when thou art almost at the top of the hill, and turn back before thou hast taken thy survey? Thou camest hither in hope to speak with God, and wilt thou go before thou hast seen him? Thou camest to bathe thyself in the streams of consolation, and to that end didst unclothe thyself of thy earthly thoughts, and wilt thou only touch the bank and return? Thou camest to spy out the land of promise; go not back without one cluster of grapes, to shew thy brethren for their encouragement. Let
  • 44. them see that thou hast tasted of the wine, by the gladness of thy heart; and that thou hast been anointed with the oil, by the cheerfulness of thy countenance: and hast fed of the milk and honey, by the mildness of thy disposition, and the sweetness of thy conversation. This heavenly fire would melt thy frozen heart, and refine and spiritualize it; but it must have time to operate. Thus pursue the work till something be done, till thy graces be in exercise, thy affections raised, and thy soul refreshed with the delights above; or if thou canst not obtain these ends at once, be the more earnest at another time. Blessed is that servant, whom his Lord, when he cometh, shall find so doing.
  • 45. CHAP. XVI. Heavenly contemplation exemplified, and the whole Work concluded. § 1. The reader's attention excited to the following example of meditation. § 2. The excellencies of heavenly rest. § 3. Its nearness, § 4. Dreadful to sinners § 5. And joyful to saints; § 6. Its dear purchase; § 7. Its difference from earth. § 8. The heart pleaded with. § 9. Unbelief banished. § 10. A careless world pitied. § 11-13. Heavenly rest the object of love, § 14-21. And joy. § 22. The heart's backwardness to heavenly joy lamented. § 23-27. Heavenly rest the object of desire. § 28. Such meditations as this urged upon the reader: § 29. The mischief of neglecting it: § 30. The happiness of pursuing it. § 31. The Author's concluding prayer for the success of his work. ND now reader, according to the above directions, make conscience of daily exercising thy graces in meditation, as well as prayer: Retire into some secret place, at a time the most convenient to thyself, and laying aside all worldly thoughts, with all possible seriousness and reverence, look up toward heaven, remember there is thine everlasting rest, study its excellency and reality, and rise from sense to faith, by comparing heavenly with earthly joys: Then mix ejaculations with thy soliloquies; till having pleaded the case reverently with God, and seriously with thy own heart, thou hast pleaded thyself from a clod to a flame, from a forgetful sinner, and a lover of the world, to an ardent lover of God, from a fearful coward, to a resolved Christian, from an unfruitful sadness, to a joyful life: In a word, till thou hast pleaded thy heart from earth to heaven, from conversing below to walking with God; and till thou canst lay thy heart to rest, as in the bosom of Christ, by some such meditation of thy everlasting rest as is here added for thy assistance. § 2. Rest! How sweet the sound! It is melody to my ears! It lies as a reviving cordial at my heart, and from thence sends forth lively
  • 46. spirits, which beat through all the pulses of my soul! Rest,—not as the stone that rests on the earth, nor as the flesh shall rest in the grave, nor such a rest as the carnal world desires. O blessed rest! When we rest not day and night, saying, Holy, holy, holy Lord God Almighty! When we shall rest from sin, but not from worship; from suffering and sorrow, but not from joy! O blessed day! When I shall rest with God! When I shall rest in the bosom of my Lord! When I shall rest in knowing, loving, rejoicing, and praising! When my perfect soul and body shall together perfectly enjoy the most perfect God! When God, who is love itself, shall perfectly love me, and rest in his love to me, as I shall rest in my love to him; and rejoice over me with joy, and joy over me with singing, as I shall rejoice in him! § 3. How near is that most blessed, joyful day! It comes apace. He that shall come, will come, and will not tarry. Though my Lord seems to delay his coming, yet a little while and he will be here. What is a few hundred years, when they are over? How surely will his sign appear? How suddenly will he seize upon the careless world, even as the lightning cometh out of the east, and shineth unto the west? He who is gone hence shall so come. Methinks I hear his trumpet sound! Methinks I see him coming with clouds; with his attending angels in majesty and glory! § 4. O secure sinners! What now will you do? Where will you hide yourselves? What shall cover you? mountains are gone; the heavens and the earth, which were, are passed away; the devouring fire hath consumed all, except yourselves, who must be the fuel for ever. O that all could consume as soon as the earth; and melt away as did the heavens! Ah, these wishes are now but vain! The Lamb himself would have been your friend; he would have loved you, and ruled you, and now have saved you; but you would not then, and now it is too late. Never cry Lord, Lord; too late, too late, man. Why dost thou look about? Can any save thee? Whither dost thou run? Can any hide thee? O wretch, that hast brought thyself to this! § 5. Now, blessed saints, that have believed and obeyed! This is the end of faith and patience. This is it for which you prayed and
  • 47. waited. Do you now repent your sufferings and sorrows, your self- denying and holy walking? Are your tears of repentance now bitter or sweet! See how the Judge smiles upon you; there is love in his looks; the titles of Redeemer, Husband, Head, are written in his amiable, shining face. Hark, he calls you, he bids you stand here on his right-hand; fear not, for there he sets his sheep. O joyful sentence! Come, ye blessed of My Father, inherit the kingdom prepared for you from the foundation of the world. He takes you by the hand, the door is open, the kingdom is his, and therefore yours; there is your place before his throne; the father receives you as the spouse of his Son, and bids you welcome to the crown of glory. Ever so unworthy, you must be crowned. This was the project of free redeeming grace, the purpose of eternal love. O blessed grace! O blessed love! O how love and joy will rise! but I cannot express it, I cannot conceive it. § 6. This is that joy which was produced by sorrow, that crown which was procured by the cross. My Lord wept, that now my tears might be wiped away; He bled, that I might now rejoice; he was forsaken, that I might not now be forsook; he then died, that I might now live. O free mercy, that can exalt so vile a wretch! Free to me though dear to Christ! Free grace, that hath chosen me, when thousands were forsaken! When my companions in sin must burn in hell, I must here rejoice in rest! Here must I live with all these saints! O comfortable meeting of my old acquaintance, with whom I prayed, and wept and suffered, and spoke often of this day and place! I see the grave could not detain you; the same love hath redeemed and saved you also. § 7. This is not like our cottages of clay, our prisons, our earthly dwellings. This voice of joy is not like our old complaints, our impatient groans and sighs; nor this melodious praise like the scoffs and revilings, or the oaths and curses, which we heard on earth. This body is not like that we had, nor this soul like the soul we had, nor this life like the life we lived. We have changed our place and state, our clothes and thoughts, our looks, language, and company.
  • 48. Before, a saint was weak and despised; so proud and peevish, we could often scarce discern his graces: but now how glorious a thing is a saint! Where is now their body of sin, which wearied themselves and those about them? Where are now our different judgments, reproachful names, divided spirits, exasperated passions, strange looks, uncharitable censures? Now we are all of one judgment, of one name, of one heart, house, and glory. O sweet reconciliation! Happy union! Now the gospel shall no more be dishonored through our folly. No more, my soul, shalt thou lament the sufferings of the saints, or the church's ruins, nor mourn thy suffering friends, nor weep over their dying beds, or their graves. Thou shalt never suffer thy old temptations from Satan, the world, or thy own flesh. Thy pains and sicknesses are all cured; thy body shall no more burden thee with weakness and weariness; thy aching head and heart, thy hunger and thirst, thy sleep and labor, are all gone. O what a mighty change is this! From the dunghill, to the throne! from persecuting sinners, to praising saints! From a vile body, to this which shines as the brightness of the firmament! From a sense of God's displeasure, to the perfect enjoyment of him in love! From all my doubts and fears, to this possession, which puts me out of doubt! From all my fearful thoughts of death, to this joyful life! Blessed change! Farewell, sin, and sorrow, for ever: Farewell, my rocky, proud, unbelieving heart; my worldly, sensual, carnal heart: And welcome now my most holy, heavenly nature. Farewell, repentance, faith, and hope; and welcome, love, and joy, and praise. I shall now have my harvest, without ploughing or sowing; my joy without a preacher, or a promise; even all from the face of God himself. Whatever mixture is in the streams, there is nothing but pure joy in the Fountain. Here shall I be encircled with eternity and ever live, and ever, ever praise the Lord. My face will not wrinkle, nor my hair be grey; for this corruptible shall have put on incorruption, and this mortal immortality, and death shall be swallowed up in victory. O death, where is now thy sting? O grave, where is thy victory? The date of my lease will no more expire, nor shall I trouble myself with thoughts of death, nor lose my joys through fear of losing them. When millions of ages are passed, my glory is but beginning; and
  • 49. when millions more are passed, it is no nearer ending. Every day is all noon, every month is harvest, every year is a jubilee, even age is full manhood, and all this is one eternity. O blessed eternity! The glory of my glory! the perfection of my perfection! § 8. Ah drowsy, earthly heart! How coldly dost thou think of this reviving day? Hadst thou rather sit down in dirt, than walk in the palace of God? Art thou now remembering thy worldly business, or thinking of thy lusts, earthly delights and merry company? Is it better to be here, than above with God? Is the company better? Are the pleasures greater? Come away; make no excuse, nor delay; God commands, and I command thee; gird up thy loins; ascend the mount; look about thee with faith and seriousness. Look not back upon the way of the wilderness; except it be to compare the kingdom with that howling desert, more sensibly to perceive the wide difference. Yonder is thy Father's glory; yonder, O my soul! must thou remove, when thou departest from this body; and when the power of thy Lord hath raised it again, and joined thee to it, yonder must thou live with God for ever. There is the glorious new Jerusalem, the gates of pearl, the foundations of pearl, the streets and pavement of transparent gold. That sun, which lighteth all this world, will be useless there; even thyself shall be as bright as yonder shining sun; God will be the sun, and Christ the light, and in his light shalt thou have light. § 9. O my soul! dost thou stagger at the promise of God through unbelief? I much suspect thee, didst thou believe indeed thou wouldst be more affected with it. Is it not under the hand, and seal, and oath of God? Can God lie? Can he that is truth itself be false? What need hath God to flatter or deceive thee? Why should he promise thee more than he will perform? Dare not to charge the wise, almighty, faithful God with this. How many of the promises have been performed to thee in thy conversion? Would God so powerfully concur with a feigned word? O wretched heart of unbelief? Hath God made thee a promise of rest, and wilt thou come short of it? Thine eyes, thy ears, and all thy senses, may prove
  • 50. delusions, sooner than a promise of God can delude thee. Thou mayest be surer of that which is written in the word, than if thou see it with thine eyes, or feel it with thine hands. Art thou sure thou art alive, or that this is earth thou standest on, or that thine eyes see the sun? As sure is all this glory to the saints; as sure shall I be higher than yonder stars, and live for ever in the holy city, and joyfully sound forth the praise of my Redeemer; if I be not shut out by this evil heart of unbelief, causing me to depart from the living God. § 10. And is this rest so sweet, and so sure? Then what means the careless world? Know they what they neglect? Did they ever hear of it, or are they yet asleep, or are they dead? Do they certainly know that the crown is before them, while they thus sit still or follow trifles? Undoubtedly they are beside themselves, to mind so much their provision by the way, when they are hasting so fast to another world, and their eternal happiness lies at stake. Were there left one spark of reason, they would never sell their rest for toil, nor their glory for worldly vanities, nor venture heaven for sinful pleasure. Poor men! O that you would once consider what you hazard, and then you would scorn these tempting baits! Blessed for ever be that love, which hath rescued me from this bewitching darkness! § 11. Draw yet nearer, O my soul! with thy most fervent love. Here is matter for it to work upon, something worth thy loving. O see what beauty presents itself! Is not all the beauty in the world united here? Is not all other beauty but deformity? Dost thou now need to be persuaded to love? Here is a feast for thine eyes, and all the powers of thy soul; dost thou need entreaties to feed upon it? Canst thou love a little shining earth, a walking piece of clay? And canst thou not love that God, that Christ, that glory, which is so truly and unmeasurably lovely? Thou canst love thy friend, because he loves thee; and is the love of a friend like the love of Christ? Their weeping or bleeding for thee, do not ease thee, nor stay the course of thy tears or blood: But the tears and blood that fell from thy Lord, have a sovereign healing virtue. O my soul! if love deserves, and
  • 51. should beget love, what incomprehensible love is here before thee? Pour out all the store of thy affections here, and all is too little. O that it were more; O that it were many thousand times more! Let him be first served, that served thee first. Let him have the first- born, and strength of thy soul! who parted with strength and life in love for thee. O my soul! Dost thou love for excellency? Yonder is the region of light; this is a land of darkness. Yonder twinkling stars, that shining moon, and radiant sun, are all but lanthorns hung out of thy Father's house, to light thee while thou walkest in this dark world: But how little dost thou know the glory and blessedness that is within?—Dost thou love for suitableness? What person more suitable than Christ? His godhead and humanity, his fulness and freeness, his willingness and constancy, all proclaim him thy suitable friend. What state more suitable to thy misery, than mercy? Or to thy sin and pollution, than honor and perfection? What place more suitable to thee than heaven? Does this world agree with thy desires; hast thou not a sufficient trial of it?—Or dost thou love for interest and near relation? Where hast thou better interest than in heaven, or nearer relation than there? § 12. Dost thou love for acquaintance and familiarity? Though thine eyes have never seen thy Lord, yet thou hast heard his voice, received his benefits, and lived in his bosom; He taught thee to know thyself and him; he opened thee that first window through which thou sawest into heaven. Hast thou forgotten since thy heart was careless, and he awakened it; hard, and he softened it; stubborn, and he made it yield; at peace, and he troubled it; whole, and he broke it; and broken, till he healed it again? Hast thou forgotten the times when he found thee in tears; when he heard thy secret sighs and groans, and left all to come and comfort thee; when he took thee, as it were, in his arms, and asked thee, poor soul, what ails thee? Dost thou weep, when I have wept so much? Be of good cheer; thy wounds are saving, and not deadly; It is I have made them, who mean thee no hurt; though I let out thy blood, I will not let out thy life. I remember his voice. How gently did he take me up? How carefully did he dress my wounds? Methinks I hear
  • 52. him still saying to me, poor sinner, though thou hast dealt unkindly with me, and cast me off; yet I will not do so by thee. Though thou hast set light by me and all my mercies, yet they and myself are all thine. What wouldst thou have that I can give thee? And what dost thou want that I cannot give thee? If any thing I have will pleasure thee, thou shalt have it. Wouldst thou have pardon? I freely forgive thee all thy debt. Wouldst thou have grace and peace? Thou shalt have them both. Wouldst thou have myself? Behold I am thine, thy Friend, thy Lord, thy Brother, Husband, and Head. Wouldst thou have the Father? I will bring thee to him, and thou shalt have him, in and by me. These were my Lord's reviving words. After all, when I was doubtful of his love, methinks I yet remember his overcoming arguments. Have I done so much, sinner, to testify my love, and yet dost thou doubt? Have I offered thee myself and love so long and yet dost thou question my willingness to be thine? At what dearer rate should I tell thee that I love thee? Wilt thou not believe my bitter passion proceeded from love? Have I made myself in the gospel a lion to thine enemies, and a lamb to thee, and dost thou overlook my lamb-like nature? Had I been willing to let thee perish, what need I have done and suffered so much? What need I follow thee with such patience and importunity? Why dost thou tell me of thy wants; have I not enough for me and thee? Or of thy unworthiness; for if thou wast thyself worthy, what shouldst thou do with my worthiness? Did I ever invite, or save, the worthy and the righteous; or is there any such upon earth? Hast thou nothing; art thou lost and miserable, helpless and forlorn? Dost thou believe I am an all-sufficient Savior, and wouldst thou have me? Lo, I am thine, take me; if thou art willing, I am; and neither sin, nor Satan, shall break the match. These, O these, were the blessed words which his Spirit from his gospel spoke unto me, till he made me cast myself at his feet, and cry out, My Savior, and my Lord, thou hast broke, thou hast revived my heart; thou hast overcome, thou hast won my heart; take it, it is thine; if such a heart can please thee, take it; if it cannot, make it such as thou wouldst have it. Thus, O my soul! Mayest thou remember the sweet familiarity thou hast had with Christ; therefore, if acquaintance will cause affection, let out thy
  • 53. 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! ebookultra.com