Book Image

Swift Cookbook

Book Image

Swift Cookbook

Overview of this book

Table of Contents (18 chapters)
Swift Cookbook
About the Author
About the Reviewers

Creating HTML manually

HTML started as a simple format for displaying web pages and links. Nowadays, this format has become very common and it is used everywhere. There are even frameworks such as PhoneGap that create applications with this file type.

In this recipe, we will create HTML using only strings; the main idea is to know about string manipulation. In this case, we will create the HTML code for a visiting card.

Getting ready

Open your Xcode and create a single view project called Chapter2 HTML.

How to do it...

Let's create HTML manually by following these steps:

  1. Let's click on the storyboard and add the following layout:

  2. Then, connect the text fields with the following properties on the view controller:

    @IBOutlet var nameTextField: UITextField!
    @IBOutlet var addressTextField: UITextField!
    @IBOutlet var postCodeTextField: UITextField!
    @IBOutlet var phoneTextField: UITextField!
  3. Link these properties with the corresponding text field on the view, and before creating an action button, we will...