Found 208 Articles for IOS

Hang Up Your iPhone with the Click of a Button

Smita Kapse
Updated on 30-Jul-2019 22:30:26

154 Views

When you’re on a call, you can hang up the phone by pressing the Side button on your iOS device. This button is also called as sleep/wake up or lock button.The devices and iOS are specifically designed the way that pressing the power button while on a call will immediately disconnects the call.

Generic way to validate textField inputs in Swift

Anvi Jain
Updated on 30-Jul-2019 22:30:26

2K+ Views

How often you develop an application and you write same validation for every input fields. One such example is User registration, Login screen or Registration screen or any other screen. It becomes tedious to write same line of code for every input field moreover you may tend to mistake the same.As per the design it is never recommend to write validation for each field, rather you should be writing generic validation functions.So in this blog we will be writing generic validation library of input Text Fields.Advantages of writing genetic validation library.Reuse able code for all functions.Chances of human error getting ... Read More

How to request Location Permission at runtime on iOS

Nishtha Thakur
Updated on 30-Jul-2019 22:30:26

1K+ Views

To request location Permission we will be using Apple’s CLLocationManager class. You use instances of this class to configure, start, and stop the Core Location services.You can read more about CLLocationManager class here. https://developer.apple.com/documentation/corelocation/cllocationmanageriOS apps can support one of two levels of location access.While using the app − The app can access the device’s location when the app is in use. This is also known as “when-in-use authorization.”Always − The app can access the device’s location either when app is in use or in the background.Here we will be using when-in-use authorization: Request authorization to use location services only when your ... Read More

Create circular Progress Bar in iOS

Smita Kapse
Updated on 30-Jul-2019 22:30:26

2K+ Views

It is very important to know how to create a circular progress bar for iOS developers, almost every application have this.This is mainly used in showing the downloading status, loading status or any other progress related thing.Creating Circular Progress bar may become very tedious for new programmers and they might struggle working with it.There are multiple way one can create circular progress bar. In this post we will be seeing one of the simplest and easiest way to create circular progress bar.So let’s get startedStep 1 − Open Xcode, Single View Application, name it CircularProgress.So we will be creating an ... Read More

How to check which notifications are active in status bar in iOS?

Anvi Jain
Updated on 30-Jul-2019 22:30:26

160 Views

To get the list of notifications which are active on your status bar tray we are going to use getdeliverednotifications, you can read more about it here.https://developer.apple.com/documentation/usernotifications/unusernotificationcenterhttps://developer.apple.com/documentation/usernotifications/unusernotificationcenter/1649520-getdeliverednotificationsWhile it is know that we cannot get the notifications from all apps as that would be a privacy violation, but we can get the notification for our applicationApple provide getDeliveredNotifications(completionHandler:)Which returns a list of the app’s notifications that are still displayed in Notification Center.You can write the following code depending upon your need.UNUserNotificationCenter.current().getDeliveredNotifications { (notifications) in    print(notifications) }Read More

How to check notifications status for the iOS App

Nishtha Thakur
Updated on 30-Jul-2019 22:30:26

2K+ Views

Notifications communicate important information to users of your app, regardless of whether your app is running on the user's device.For example, a sports app can let the user know when their favourite team scores. Notifications can also tell your app to download information and update its interface. Notifications can display an alert, play a sound, or badge the app's icon.You can read more about notification status here https://developer.apple.com/documentation/usernotificationsApple recommend to user UserNotifications framework, So let’s get started. We will be seeing very simple and easy solution to get the notification status.Step 1 − Firstly you need to import the UserNotifications ... Read More

How to detect user inactivity for 5 seconds in iOS?

Smita Kapse
Updated on 30-Jul-2019 22:30:26

863 Views

While designing any iOS Application you might come across a scenario where you have to do some sort of action if the screen is inactive for some amount of time.Here we will be seeing the same, we will be detecting user inactivity for 5 seconds.We will be using Apple’s UITapGestureRecognizer you can read more about it herehttps://developer.apple.com/documentation/uikit/uitapgesturerecognizer.So Let’s get started! We will be designing a basic application where we will start the timer as soon as the application is launched. If the user fails to touch the screen or does not perform any operation till 5 seconds we will be ... Read More

How to make a background 25% transparent on iOS

Anvi Jain
Updated on 30-Jul-2019 22:30:26

857 Views

Apple provides backgroundColor which is an instance property, Changes to this property can be animated. The default value is nil, which results in a transparent background color.To make background 25% transparent we should  set the view to the UIColor with alpha 0.25view.backgroundColor = UIColor(white: 1, alpha: 0.25)You can write the following code in your ViewController’s viewDidLoad method.Your code should look like below.override func viewDidLoad() {    super.viewDidLoad()    view.backgroundColor = UIColor(white: 1, alpha: 0.25) }

How do I access SQLite database instance on iPhone

Nishtha Thakur
Updated on 30-Jul-2019 22:30:26

798 Views

Storing data is one of the most important thing when we design any application. There are numerous way to store data one such way is SQLite databse.There are multiple ways to access SQLite database on iPhone, We will be seeing the most easiest way to do so in Swift.SQLite is a relational database management system contained in C programming library embedded to an application.In this tutorial we will be creating one sample application which will have a text field to enter the name, we will store the name in our SQLite database and will print the same when user taps ... Read More

How to run a timer in background within your iOS app

Smita Kapse
Updated on 30-Jul-2019 22:30:26

1K+ Views

If you wish to run a timer in background within your iOS Application, Apple provides beginBackgroundTaskWithExpirationHandler method, you can read more about the same https://developer.apple.com/documentation/uikit/uiapplication/1623031-beginbackgroundtaskwithexpiration.We will be using the same for writing our code for running the timer in background.So let’s begin.Step 1 − Open Xcode → Single View Application → Let’s name is BackgroundTimer.Step 2 − Open AppDelegate.swift and under method applicationDidEnterBackground write the below code.backgroundTaskIdentifier = UIApplication.shared.beginBackgroundTask(expirationHandler: {    UIApplication.shared.endBackgroundTask(self.backgroundTaskIdentifier!) }) _ = Timer.scheduledTimer(timeInterval: 1,  target: self,  selector: #selector(self.doSomething), userInfo: nil, repeats: true)Step 3 − Write new function doSomething()@objc func doSomething() {    print("I'm running") }Finally your code should look like belowfunc applicationDidEnterBackground(_ application: UIApplication) {    backgroundTaskIdentifier = UIApplication.shared.beginBackgroundTask(expirationHandler: {   ... Read More

Advertisements