
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 516 Articles for Swift

152 Views
In this tutorial we will be focussing on how to send text message from your iOS application in Swift, where we will be sending a text message from your user’s phone number. While we cannot do this directly without the content of your user’s but we can display a precomposed message for the user to send which user can modify later if he wants to.So let’s get started, We will be using “MFMessageComposeViewController” class object to display the standard message composition interface inside your application.Before we present the composition interface, we will populate the fields with the basic initial message ... Read More

438 Views
Social logins in applications have become a very common thing these days. Facebook login is one of them, in this article we’ll see how we can make use of facebook login, to access basic user information and login to the application.Implementing facebook login in an application is a series of multiple steps, out of which even a single step can not be skipped.The first step is to register as a developer on: https://developers.facebook.com/Once you sign up as a developer and complete the required steps to sign up, you will be taken to dashboard. Which at present looks like as shown ... Read More

469 Views
To hide a keyboard on screen we need to make use of some internal functions that are predefined in the iOS SDK. The keyboard appears on screen when we are typing in a text Field or textView. We need to make use of internal function according to the text field.For example if the current text field is tfOne, we can hide the text field using the code below:tfOne.resignFirstResponder()This code will hide the keyboard when ever called, we may call this on an action for a button or for gesture recognizer.This method is good for limited textFields, but we need to ... Read More

3K+ Views
To resize an image in iOS using swift we’ll make use of frame.Let’s see this with help of an example.Create an empty project and add an empty Image view.Create its outlet.Add an image to your project and assign the image to image view.Initially when we run the application, it looks something like this.Now, let’s add code to resize the image.override func viewWillLayoutSubviews() { let frame = CGRect(x: 10, y: 10, width: self.view.frame.width - 20, height: 300) self.imgView.frame = frame }We will run this code in our viewWillLayoutSubviews method. This is how it looks on the device when we ... Read More

766 Views
To load an image in iOS using swift we’ll make use of simple data Task session. The image needs to be loaded in background because it may be of any size and we don’t want it to stop our main view’s operations.Let’s see this with help of an example. Create an empty project and add an empty Image view.Create its outlet and then we’ll write the code to get image from an URL. This is how our application looks at the moment.Now, let’s add code to get image from an URL.func getData(from url: URL, completion: @escaping (Data?, URLResponse?, Error?) -> ... Read More

1K+ Views
To make an http request in iOS we’ll make use of DataTask and sessions. We’ll create configuration, sessions, url, request, and dataTask objects. Let’s see the steps that we’ll go through.First of all we need to create a session object, which default configuration.let configuration = URLSessionConfiguration.default let session = URLSession(configuration: configuration)Then we need to create an URL Request of The type we need, it can be get, post, delete or put. In this example we are seeing ”POST” type.let url = URL(string: URLString) //let url = NSURL(string: urlString as String) var request : URLRequest = URLRequest(url: url!) request.httpMethod = "POST" ... Read More

422 Views
To check any services related to location in ios with swift we can use the CLLocationManager.In this example we’ll see how to check if the location manager is running or not. We’ll do this with help of an sample project. So, create a new project. First we need to create a locationManager object, so in your view controller.var locationManager = CLLocationManager()Now, we first of all we need to check if the location services are enabled on the device or not. To check this we’ll useCLLocationManager.locationServicesEnabled() function, which returns a Boolean value showing whether the location service on device is active ... Read More

875 Views
To make an http request in iOS we’ll make use of DataTask and sessions. We’ll create configuration, sessions, url, request, and dataTask objects. Let’s see the steps that we’ll go through.The HTTP request can be of different types, it depends on what kind of request we want to make to our server. Below are the basic types of requests.“GET”, ”POST”, ”PUT”, ”DELETE” , we can make use of any of these according to our API. The basics remain same for each kind of request, which are shown below. Let’s see these examples with DELETE type of request.First of all we ... Read More

7K+ Views
To change the height of tableView cell in ios dynamically, i.e resizing the cell according to the content available, we’ll need to make use of automatic dimension property. We’ll see this with the help of an sample project.Create an empty project and go to it’s viewController class, conform it to UITableViewDataSource and UITableViewDelegate.Now, In the below code, we will first create a table, then register a cell for that table, and add some table properties.We’ll set the table view delegate and table view datasource.Finally we’ll add the table view to view. Then we’ll call this function inside the viewDidLoad method ... Read More

2K+ Views
To remove the border from a navigation bar in swift, we just need to add a few lines of code. Let’s see how the navigation bar looks when we run it without changing anything.Now let’s try to hide the line/ border shown in the above result.The navigation bar has two things that give it the default view of a grey shadow along with bottom line as shown above. One is the background image, and the other is the shadow image.First, we’ll hide the shadow image, by setting it to empty image and see how it looks.In your viewDidLoad add the ... Read More