Professional Documents
Culture Documents
Textbook Learn Ios 11 Programming With Swift 4 Craig Clayton Ebook All Chapter PDF
Textbook Learn Ios 11 Programming With Swift 4 Craig Clayton Ebook All Chapter PDF
Craig Clayton
Visit to download the full and correct content document:
https://textbookfull.com/product/learn-ios-11-programming-with-swift-4-craig-clayton/
More products digital (pdf, epub, mobi) instant
download maybe you interests ...
https://textbookfull.com/product/ios-11-programming-fundamentals-
with-swift-swift-xcode-and-cocoa-basics-4th-edition-matt-neuburg/
https://textbookfull.com/product/ios-11-by-tutorials-learning-
the-new-ios-apis-with-swift-4-1st-edition-the-raywenderlich-
tutorial-team/
https://textbookfull.com/product/ios-11-swift-programming-
cookbook-solutions-and-examples-for-ios-apps-1st-edition-vandad-
nahavandipoor/
https://textbookfull.com/product/learn-swift-by-building-
applications-explore-swift-programming-through-ios-app-
development-1st-edition-emil-atanasov/
iOS 14 Programming Fundamentals with Swift Covers iOS
14 Xcode 12 and Swift 5 3 7th Edition Matt Neuburg
https://textbookfull.com/product/ios-14-programming-fundamentals-
with-swift-covers-ios-14-xcode-12-and-swift-5-3-7th-edition-matt-
neuburg/
https://textbookfull.com/product/ios-10-programming-fundamentals-
with-swift-swift-xcode-and-cocoa-basics-3rd-edition-matt-neuburg/
https://textbookfull.com/product/ios-12-programming-fundamentals-
with-swift-swift-xcode-and-cocoa-basics-5th-edition-matt-neuburg/
https://textbookfull.com/product/ios-13-programming-fundamentals-
with-swift-swift-xcode-and-cocoa-basics-1st-edition-matt-neuburg/
https://textbookfull.com/product/ios-12-programming-fundamentals-
with-swift-swift-xcode-and-cocoa-basics-5th-edition-matt-
neuburg-2/
Learn iOS 11 Programming with Swift 4
Second Edition
Craig Clayton
BIRMINGHAM - MUMBAI
Learn iOS 11 Programming with
Swift 4 Second Edition
Copyright © 2018 Packt Publishing
All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or
transmitted in any form or by any means, without the prior written permission of the publisher,
except in the case of brief quotations embedded in critical articles or reviews.
Every effort has been made in the preparation of this book to ensure the accuracy of the information
presented. However, the information contained in this book is sold without warranty, either express
or implied. Neither the author, nor Packt Publishing or its dealers and distributors, will be held liable
for any damages caused or alleged to have been caused directly or indirectly by this book.
Packt Publishing has endeavored to provide trademark information about all of the companies and
products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot
guarantee the accuracy of this information.
ISBN 978-1-78839-075-0
www.packtpub.com
mapt.io
Mapt is an online digital library that gives you full access to over 5,000
books and videos, as well as industry leading tools to help you plan your
personal development and advance your career. For more information,
please visit our website.
Why subscribe?
Spend less time learning and more time coding with practical eBooks
and Videos from over 4,000 industry professionals
Improve your learning with Skill Plans built especially for you
After we have a solid foundation of using Swift, we will start creating the
visual aspects of our Let's Eat app. During this process, we will work with
storyboards and connect our app's structure together using segues. With our
UI complete, we will go over the different ways in which we can display
data. To display our data in a grid, we will use Collection Views, and to
display our data in a list, we will use Table Views.
We will also look at how to add basic and custom annotations on to a map.
Finally, it's time to get real data; we will look at what an Application
Programming Interface (API) is and how we can get real restaurant data
into our Collection Views, Table Views, and Map.
We now have a complete app, but how about adding some bells and
whistles? The first place we can add a feature will be on the restaurant
detail page where we can add restaurant reviews. Here, users will be able to
take or choose a picture and apply a filter on to their picture. They will also
be able to give the restaurant a rating as well as a review. When they are
done, we will save this data using Core Data.
Since we built our app to work on both iPhone and iPad, we should add the
ability to make our app support iPad Multitasking. Doing this will allow our
app to be open alongside another app at the same time.
Finally, let's create a quick access for our app using 3D touch where, by
tapping our app icon, the user can quickly jump to their reservations. Now
that we have added some bells and whistles, let's get this app to our friends
using TestFlight,
and finally get it into the App Store.
Who this book is for
This book is for beginners who want to be able to create iOS applications. If
you have some programming experience, this book is a great way to get a
full understanding of how to create an iOS application from scratch and
submit it to the App Store. You do not need any knowledge of Swift or any
prior programming experience.
What this book covers
Chapter 1, Getting Familiar with Xcode, takes you through a tour of Xcode
and talks about all the different panels that we will use throughout the book.
Chapter 2, Building a Foundation with Swift, deals with the basics of Swift.
Chapter 6,Starting the UI Setup, is about building the Let's Eat app. We will
focus on getting our structure set up using storyboards.
Chapter 7, Setting Up the Basic Structure, deals with working on our Let's
Eat app in a storyboard.
Chapter 10, Designing Cells, is about designing the table and collection view
cells in storyboard.
Chapter 11, Designing Static Tables, teaches how to work with a static table
view.
Chapter 12,Designing a Photo Filter and Review Form, teaches you how to
design a basic form.
Chapter 13,
Getting Started with the Grid, is about working with Collection
Views and how we can use them to display a grid of items.
Chapter 14, Getting Data into Our Grid, is about getting data into our
Collection Views.
Chapter 15,Getting Started with the List, teaches us to work with Table
View and takes a deep look at dynamic Table Views.
Chapter 16,Where Are We?, deals with working with MapKit and learning
how to add annotations to a map. We will also create custom annotations for
our map.
Chapter 17, Working with an API, is about learning how to use a JSON API
within our app.
Chapter 18, Displaying Data in Restaurant Detail, teaches you how to pass
data using segues.
Chapter 19, Foodie Reviews, talks about working with the phone's camera
and library.
Chapter 20,Working with Photo Filters, takes a look at how to apply filters
to our photos.
Chapter 21, Understanding Core Data, teaches us the basics of using Core
Data.
Chapter 22, Saving Reviews, wraps up Reviews by saving them using Core
Data.
Chapter 23,Universal, deals with multitasking on the iPad, and how we can
get an update to be supported on all devices.
Chapter 24, iMessages, is about building a custom message app UI. We will
also create a framework to share data between both apps.
Chapter 25, Notifications, provides learning on how to build basic
notifications. Then, we will look at embedding images into our notifications
as well as building a custom UI.
Chapter 26, Drag and Drop, is about learning how to add drag and drop both
within the app and accepting drag and drop from other apps.
Chapter 27, Just a Peek, looks at 3D touch and how to add quick actions to
our app. We will also look at how we can add peek and pop to our
restaurant list.
Chapter 28, SiriKit, teaches how to use Siri to create money requests.
Chapter 29, Beta and Store Submission, is about how to submit apps for
testing as well as submitting apps to the App Store.
To get the most out of this book
You need to have Xcode 9 installed in your system. To download Xcode 9
visit https://developer.apple.com/xcode/.
Download the example code
files
You can download the example code files for this book from your account
at www.packtpub.com. If you purchased this book elsewhere, you can visit www.
packtpub.com/support and register to have the files emailed directly to you.
Once the file is downloaded, please make sure that you unzip or extract the
folder using the latest version of:
The code bundle for the book is also hosted on GitHub at https://github.co
m/PacktPublishing/Learn-iOS-11-Programming-with-Swift-4-Second-Edition. We
also have other code bundles from our rich catalog of books and videos
available at https://github.com/PacktPublishing/. Check them out!
Another random document with
no related content on Scribd:
manufacture of gas, and from 12,000,000 to 15,000,000 pounds
sterling expended in its production. In London alone 500,000 tons
of coals are annually used, producing 4,500,000,000 cubic feet of
gas, and 500,000 chaldrons of coke; of the latter, 125,000 chaldrons
are consumed in manufacturing the gas, and the remainder sold for
fuel. Upwards of half-a-million houses in London burn gas, and the
length of the main arteries for conveying it is 1,600 miles. The capital
employed in the metropolis is 4,000,000l. The manufacture of coal-
gas for the purpose of illumination affords one of the most striking
instances of the triumphs of science when enlisted in the divine
cause of civilization. Looking at it as a whole, and regarding the
ingenuity evinced in the construction of apparatus, the chemical skill
and beauty displayed in the process, and the very valuable purposes
to which it is applied, it forms one of the most beautiful, curious, and
useful of our manufactures; and probably there is no subject of a
manufacturing character in the present day which more engages
public attention, coal-gas having now become not a mere luxury, or
even convenience, but an absolute necessary. In the words of my late
colleague and friend, Dr. Hofmann, ‘The extent to which the use of
gas has affected the arts and manufactures in this country, can only
be conceived by those who are aware of its innumerable applications
in the double capacity of giving light and heat. To our experimental
chemists the benefits afforded by gas cannot be overrated, more
especially in England, where the price of spirits of wine is so
exorbitant. But for the use of gas in the laboratory, the progress of
chemistry in this country must have been greatly retarded.’
“In speaking of the general influence of the manufacture of coal-
gas, it is impossible to leave unnoticed the number of hands daily
engaged in raising whole strata of coal, in loading and navigating the
fleets employed in conveying it, not only to the different parts of this
kingdom, but to foreign countries, which consume a larger quantity
of English coal for the production than is generally known. The
extension of the gas enterprise produced a sensible effect on the
ironworks, by the vast number of retorts, the stupendous gas-
holders, and endless pipes required for generating, storing, and
conveying it.
“Several other branches of trade were also forced into increased
activity, and even new trades sprung up in consequence of the
extended use of gas. The substances produced in the purification of
gas naturally attracted the attention of the gas manufacturer; and
chemistry soon pointed out valuable purposes to which they might
be applied. The oily matter, which separates as a secondary product
in the distillation of coal, yielded, when purified in its more volatile
portion, the most convenient solvent for caoutchouc; another part of
it was found to be an efficient preservative of timber, and the pitchy
residue formed the chief ingredient of an excellent substitute for the
flag stones of our pavements; while the ammoniacal liquors were
found useful in improving the fertility of land. Thus, after the lapse of
countless ages, was the nitrogen of petrified fern forests resuscitated
in the ammoniacal liquors of the gas-works, to vegetate once more
and increase the produce of our corn fields.”
“There is a path which no fowl knoweth, and which the vulture’s eye hath not
seen; the lions’ whelps have not trodden it, nor the fierce lion passed by
it.”—Job.
We now take our leave of the Palæozoic period, and enter upon the
investigation of other and more recent geological epochs in the
history of the crust of our planet. This division is known by the
names Secondary or Mesozoic,[64] and is inclusive of the New Red
Sandstone, Oolitic, Wealden, and Cretaceous groups. If, in our
previous survey, we have had our minds filled with wonder as we
looked at the disinterred relics of past creations, and have gazed at
these fossil forms of ancient life with almost a loving interest in their
still remaining beauty; so, as we now study higher types of life, and
behold how “other wonders rise, and seize the soul the prisoner of
amaze,” we shall find reason upon reason for the penetration of our
minds with the profoundest adoration of Deity. No man turning up a
tumulus, and there finding coins, weapons, beads, vases, or other
such historical relics, would venture to say such things were created
there; on the contrary, he would acknowledge that they were Roman,
and that he had come to that conclusion by perceiving their
resemblance to other and similar ancient Roman relics, discovered
where there could be no doubt of their origin and history. Or if a
traveller were to visit the cities of Herculaneum and Pompeii, and
there find buried beneath the overwhelming torrent of once burning
lava, all possible kinds of human memorials, not only in human
works, but also in the skeleton remains of human beings, would he
not come to the conclusion that these were indubitable evidences of
those cities having once been inhabited by man, and that these
skeletons were once covered with warm flesh, and that they had
lived, and moved, and had their being, even as we do now, amidst the
activities and enjoyments of actual life? We apply this to geology.
There are persons who never judge by evidence, (though what else
have we to judge by?) but rashly jump to conclusions about
geological facts, that have not a particle of common sense to sustain
them. They never think that every rounded pebble they meet with
has been so rounded by the action of water; they imagine sand to
have been created as sand, instead of taking the geologist’s proof,
that all sand has been produced by the action of moving water on
solid rock. They believe that fossils were created, and that God put
encrinital remains, and dead ammonites, and bones of saurians, and
teeth and bones of great mammals, in the earth, just as we find them
in the cliffs and caves of this and every country; and they imagine
that thus to account for the wonders of creation redounds to the
glory of that God whom thus they ignorantly worship. Even our great
publishing society in Paternoster Row,[65] that has published about
everything in natural history but geology, has acknowledged to me
that it declines to undertake a work on this science, because of the
theological difficulties connected with the subject. Why, what is this
but the very way to breed infidelity? The man who studies nature and
who studies his Bible, is not ashamed to say he believes them both;
though two books, they are both given by inspiration of God. Man
may be a liar, but neither nature nor the Bible can lie; and while one
tells us the history of man, the other reveals to us the history of the
creation, and succession of those beings which preceded the advent
of man.
We now come to the New Red Sandstone, which must occupy our
attention both on account of the unique fossil remains found in it,
and also on account of its economic use and value in commerce. Few
formations, small as it is, possess so many points of interest to the
beginner as the new red sandstone; for, lying just above the
carboniferous, and between it and the oolitic group, we find in it
certain curiosities of very olden time, that are full of marvellous
power to fill us with amaze. Every one remembers Robinson Crusoe’s
surprise at finding “the print of a man’s naked foot on the shore,
which was very plain to be seen in the sand,” and how he “stood like
one thunder-struck, or as if he had seen an apparition;” and then
how he “went again to see if it might not be his fancy, but there was
no room for that, for there was exactly the very print of a foot, toes,
heel, and every part of a foot;” and then how, after “innumerable
fluttering thoughts, and out of himself,” he went home terrified to his
fortification.
Equally surprising are the discoveries made in the old red
sandstone. Large slabs of this rock have been discovered in England,
in Scotland, and in the United States, on which are left, as Robinson
left the impression of his foot, the undisturbed footmarks of pre-
Adamite animals; the ebb and flow of the tide of those distant ages;
the ripple-mark showing the direction of the wind; and casts of the
rainprints made by showers, long long ages ere man had taken
possession of the “deep places of the earth.” “Romantic nonsense!”
says a grave friend; “let us go to something practical, instead of
losing ourselves in such idle speculations.” Now, you are just the
person whose ear we want to catch; and to you we say, just listen to
the evidence of these assertions. “The casts of rainprints below
project from the under side of two layers; the one a sandy shale, and
the other a sandstone presenting a warty or a blistered surface, and
affording evidence of cracks formed by the shrinkage of subjacent
clay on which rain had fallen. The great humidity of the climate of
the coal period had been previously inferred from the nature of its
vegetation, and the continuity of its forests for hundreds of miles;
but it is satisfactory to have at length obtained such positive proofs of
showers of rain, the drops of which resembled in their average size
those which now fall from the clouds. From such data we may
presume that the atmosphere of the carboniferous period
corresponded in density with that now investing the globe and that
different currents of air varied then as now in temperature, so as to
give rise, by their mixture, to the condensation of aqueous
vapour.”[66]
CASTS OF RAIN-PRINTS.
Again, let us hear the words of Professor Ansted. “It may appear at
first sight that nothing can be more fleeting, or less likely to be
handed down to future ages, among the fossils of a bed of sandstone,
than the casts of the impressions of the footsteps of an animal, which
by chance may have walked over that bed when it existed in the
condition of loose sand forming a seashore. A little consideration,
however, will show that it is in fact a very possible occurrence, as, if
the wet sand should be immediately covered up with a thin coating of
marl, and another layer of sand be superimposed, such an
impression will be permanently preserved. In after ages, also, when
the soft sands have become sandstones, and are elevated above their
former level, the stones split asunder wherever a layer of different
material occurs; and thus it happens that the casts of the footsteps
may be preserved and exhibited, although all other traces of the
former existence of the animal have been lost.”[67]
FOOTPRINTS OF A TRYDACTYLE
BIRD, AND IMPRESSION OF RAIN.
(Nat. size.)
The lines in this drawing are merely to indicate the direction, the
line of progress, of these bipeds, and the reader by following the lines
will find the illustration all the more interesting.
But the most remarkable footprints preserved on slabs of
sandstone are those of a quadruped, whose hinder feet were much
larger than his fore feet. Some of our marsupial[70] quadrupeds, such
as the opossum and kangaroo, and many species of batrachian[71]
reptiles, are distinguished by the same peculiarity. Below is a copy of
this slab, which is in the window recess of the same room of the
British Museum.
The animal that left these impressions on the soft sandy shore,
that are now converted into hard stone, was originally named the
Cheirotherium,[72] and, indeed, this name is still retained by many
writers, the hand-like footprints being quite a sufficient reason for so
appropriate a name; but latterly the teeth of a fossil animal,
supposed to be the same as the Cheirotherium, having been
examined, and disclosing a peculiarly labyrinthine character, the
animal has been called Labyrinthodon.[73] Professor Owen, the great
comparative anatomist of geology, has fairly established the real
character of this animal. He says it is a huge frog, a gigantic
batrachian, with hinder feet at least twelve inches in length,
combining a crocodilian with a frog-like structure; and although the
actual shape and proportions of such an animal must remain greatly
an enigma, it is one of the wondrous marvels of geology to pause over
these extinct huge creatures, and mark in them the exhaustless
resources of creative power.
“So reads he nature, whom the lamp of truth
Illuminates,—thy lamp, mysterious Word!
Which whoso sees, no longer wanders lost,
With intellects bemazed in endless doubt,
But runs the road of wisdom. Thou hast built
Worlds that never had been, hadst thou in strength
Been less, or less benevolent than strong.”
“Hast thou perceived the breadth of the earth? declare if thou knowest it all.”—
Job.
NAUTILUS (FOSSIL),
SHOWING THE SIPHUNCLE.