Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Swift Essentials

You're reading from   Swift Essentials Get up and running lightning fast with this practical guide to building applications with Swift

Arrow left icon
Product type Paperback
Published in Dec 2014
Publisher
ISBN-13 9781784396701
Length 228 pages
Edition 1st Edition
Languages
Arrow right icon
Authors (2):
Arrow left icon
Bandlem Limited Bandlem Limited
Author Profile Icon Bandlem Limited
Bandlem Limited
Alex Blewitt Alex Blewitt
Author Profile Icon Alex Blewitt
Alex Blewitt
Arrow right icon
View More author details
Toc

Loading data from URLs


The most common way to load data from a remote network source is to use an HTTP (or HTTPS) URL of the form https://raw.githubusercontent.com/alblue/com.packtpub.swift.essentials/master/CustomViews/CustomViews/SampleTable.json.

URLs can be manipulated with the NSURL class, which comes from the Foundation module (which is transitively imported from the UIKit module). The main NSURL initializer takes a String initializer with a full URL, although other initializers exist for creating relative URLs or for references to file paths.

The NSURLSession class is typically used to perform operations with URLs, and individual sessions can be created through the initializer or the standard shared session can be used.

Tip

The NSURLConnection class was used in older versions of iOS and Mac OS X. References to this class might still be seen in some tutorials, or might be required if Mac OS X 10.8 or iOS 6 needs to be supported; otherwise, the NSURLSession class should be preferred.

The...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image