
- iOS Tutorial
- iOS - Home
- iOS - Getting Started
- iOS - Environment Setup
- iOS - Objective-C Basics
- iOS - First iPhone Application
- iOS - Actions and Outlets
- iOS - Delegates
- iOS - UI Elements
- iOS - Accelerometer
- iOS - Universal Applications
- iOS - Camera Management
- iOS - Location Handling
- iOS - SQLite Database
- iOS - Sending Email
- iOS - Audio & Video
- iOS - File Handling
- iOS - Accessing Maps
- iOS - In-App Purchase
- iOS - iAd Integration
- iOS - GameKit
- iOS - Storyboards
- iOS - Auto Layouts
- iOS - Twitter & Facebook
- iOS - Memory Management
- iOS - Application Debugging
- iOS Useful Resources
- iOS - Quick Guide
- iOS - Useful Resources
- iOS - Discussion
How to make the phone call in iOS 10 using Swift?
In this post we will learn how to load PDF in UIWebView.
Loading PDF in WebView is simple. Just follow the following steps.
Step 1 − Open Xcode → New Project → Single View Application → Let’s name it “PDFInWebView”
Step 2 − Open Main.storyboard and add UIWebView as shown below
Step 3 − Create @IBOutlet for the UIWebView, name it webview.
Step 4 − Add as sample PDF project. We will load this PDF in webivew. I am adding a PDF file named sample PDF.
Step 5 − Add the following lines in viewDidLoad method of ViewController
if let pdf = Bundle.main.url(forResource: "sample", withExtension: "pdf", subdirectory: nil, localization: nil) { let reqest = NSURLRequest(url: pdf) webView.loadRequest(reqest as URLRequest) }
In the above code we are first getting the URL to the sample pdf file, then loading that URL into the webview.
Step 6 − Run the project, you will see the PDF load in webview
- Related Articles
- How to make phone call in iOS 10 using Swift?
- How to make a phone call using intent in Android?
- How to make a phone call using intent in Android using Kotlin?
- How to make an HTTP request on iOS App using Swift?
- How to call a method after a delay in Swift(iOS)?
- How to make an HTTP POST request on iOS App using Swift?
- How to obtain the phone number of the iOS phone programmatically?
- How to integrate PayU Money in iOS using swift?
- How to send an attachment in email using Swift(ios)?
- How to hide the status bar in a iOS App using Swift?
- How to create a WebView in an iOS App using Swift?
- How to get the distance between two geographic locations in iOS using Swift?
- How to make iPhone vibrate using Swift?
- How to answer incoming call programmatically in iOS?
- Adding Navigation Bar programmatically iOS using Swift

Advertisements