Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds
Arrow up icon
GO TO TOP
Swift 2 Blueprints

You're reading from   Swift 2 Blueprints Swift Blueprints

Arrow left icon
Product type Paperback
Published in Oct 2015
Publisher Packt
ISBN-13 9781783980765
Length 276 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
 Costa Costa
Author Profile Icon Costa
Costa
Arrow right icon
View More author details
Toc

Table of Contents (15) Chapters Close

Swift 2 Blueprints
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
1. Exploring Xcode FREE CHAPTER 2. Creating a City Information App with Customized Table Views 3. Creating a Photo Sharing App 4. Simulating Home Automation with HomeKit 5. Health Analyzing App Using HealthKit 6. Creating a Game App Using SpriteKit 7. Creating an Apple Watch App 8. AVFoundation Index

Displaying the Wikipedia information


Now, we are going to display the city information by displaying its Wikipedia page. To do it, we need to add a new view controller to our app. So, we will add a new Swift file called WikiViewController.swift to the ViewControllers group.

Right now we are only going to create an almost empty class; nevertheless, we are going to return here after a while to complete its code.

import UIKit
class WikiViewController:UIViewController {
    var cityInfo:CityInfo!
}

Go back to the storyboard and add a new view controller to it. Open the view controller's Identity inspector, and change its class from the default one to WikiViewController. Taking advantage that we are on the Identity inspector, let's also change the Storyboard ID to wikicity as it is shown in the following screenshot:

After this, we can change the view background to gray (FAFAFA) and add two labels and a web view to the layout. Write City Info on the first label, change its alignment to center and...

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 £13.99/month. Cancel anytime
Visually different images