
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 2040 Articles for Mobile Development

928 Views
To draw a route between two Locations on map we need to have co-ordinates of both those locations.Once we have the co-ordinates of both locations we can use the below given function to show the line between two points on map. In this example I’ll be using two random location as two points.func getDirections(loc1: CLLocationCoordinate2D, loc2: CLLocationCoordinate2D) { let source = MKMapItem(placemark: MKPlacemark(coordinate: loc1)) source.name = "Your Location" let destination = MKMapItem(placemark: MKPlacemark(coordinate: loc2)) destination.name = "Destination" MKMapItem.openMaps(with: [source, destination], launchOptions: [MKLaunchOptionsDirectionsModeKey: MKLaunchOptionsDirectionsModeDriving]) }We’ll call this function in ViewDidLoad for this tutorial to show the ... Read More

2K+ Views
To add a UISegmentControl in iOS with swift we’ll have to first create a segment control and it’s controller function, i.e. it’s action. Let’s see those steps.Let’s create a function to add a segmented control.func addControl() { let segmentItems = ["First", "Second"] let control = UISegmentedControl(items: segmentItems) control.frame = CGRect(x: 10, y: 250, width: (self.view.frame.width - 20), height: 50) control.addTarget(self, action: #selector(segmentControl(_:)), for: .valueChanged) control.selectedSegmentIndex = 1 view.addSubview(control) }This function may be called in our view controller to add the segmented control, let’s add action for ... Read More

4K+ Views
To change the background color of a button in iOS application we need to access the property ‘ backgroundColor’ of the UIButton. We can do this in two ways, programmatically and using the storyboard.Method 1 − Using the storyboard editorAdd a button on your storyboard, select it Go to it’s attribute inspector and select 'Background' property to choose the color.Method 2 − Programmatically changing the backgroundCreate outlet of the button on the View Controller.In the viewDidLoad() or viewWillLayoutSubview() method add the code to change the background color.btn.backgroundColor = #colorLiteral(red: 0.4392156899, green: 0.01176470611, blue: 0.1921568662, alpha: 1)When we run the method ... Read More

687 Views
In this article we’ll see how to open a pdf file using swift in iOS. Here we’ll do it with an example of opening pdf in webView in iOS. Let’s create a project and add WKWebView to the storyboard.Connect it’s outlet to the ViewController class.Now we’ll see two different thingsOpening a PDF file from a URL on the web.To open a web view from a url, first we need to have a url with a pdf file. In this example I’ll be using a dummy URL https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdfLet’s create a URL first, let url: URL! = URL(string: "https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf")Now the remaining steps ... Read More

2K+ Views
To make an iPhone vibrate using swift we’ll use two different methods. First create a new project and add Four different buttons to the main View controller.Now import the AudioToolbox framework in your view controller class.For the first button add an action and write the following code as shown below:@IBAction func actionButtonOne(_ sender: Any) { AudioServicesPlayAlertSound(SystemSoundID(kSystemSoundID_Vibrate)) }This will generate a long vibrating feedback on your device. Now to create more vibration effects on devices with iOS 10 or more we’ll add methods for all four different buttons.@IBAction func actionButtonTwo(_ sender: Any) { let generator = UIImpactFeedbackGenerator(style: .heavy) ... Read More

978 Views
To replace a character in objective C we will have to use the inbuilt function of Objective C string library, which replaces occurrence of a string with some other string that we want to replace it with.To create a string in objective C we need to write −NSString *str = @"tutori@als";Now we have a choice of replacing characters in this string and creating new one, or modify this same string. In this example we will modify this string and print in the next line.str = [str stringByReplacingOccurrencesOfString:@"@" withString:@""]; NSLog(@”%@”, str);When we run the above code, str is replaced with “tutorials” ... Read More

13K+ Views
To 1 day to a date in swift we need to create a date first. Once that date is created we have to add specific days to it. In this example we’ll see how we can achieve the same.Let’s create a date first, let it be today, let today = Date()Now to modify this date we’ll use the add function with negative value, let modifiedDate = Calendar.current.date(byAdding: .day, value: 1, to: today)!Now to see the difference between both the dates, let’s add print statement for both of these. Our complete code should now look like this.let today = Date() print(today) ... Read More

3K+ Views
To download a video from a URL in swift we need to perform a few steps while keeping a few things in mind.Points to be noted here are, We’ll be making use of internet to download video, hence we need to allow permissions for App transport security in our Info.plistWe’ll need to save the downloaded video to Photos app, hence photos permission is required.Video should always be downloaded in background as it may prevent us from using the app if downloaded on foreground.Now, we’ll use the below code to save a video from a random link in our Device. You’ll ... Read More

835 Views
To add a live camera preview to our default UIView in swift we can either use AVFoundation framework of iOS SDK or native UIImagePickerController(). In this example we’ll be using ImagePicker as our aim is to present camera preview on the UIView and Imagepicker is suitable for that task. AVFoundation can be used when we need a lot of customization on our camera or different types of custom actions.To show a camera preview on the UIView we need to perform the following steps.Create a UIImagePickerController object.Conform our class to UIImagePickerControllerDelegate and UINavigationControllerDelegate.Assign delegates to the object we created in step ... Read More

393 Views
Bitcode – Bitcode is an intermediate reperesentation of how the code looks. This code can not be used by us or can’t be installed on a device. When we upload our application to the app store It is uploaded as an bitcode and later converted to app binary by itunes/Apple.When the Intermediate code is created an uploaded to the App store or run on the device, a program called LLMV takes over the control and converts the Intermediate code to a Binary file which is x86 32Bit or x86 64 bit for the simulator and ARM for the actual iOS handheld ... Read More