iOS Articles

Page 11 of 19

Generic way to validate textField inputs in Swift

Anvi Jain
Anvi Jain
Updated on 30-Jul-2019 3K+ 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

Hang Up Your iPhone with the Click of a Button

Smita Kapse
Smita Kapse
Updated on 30-Jul-2019 408 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.

Read More

How to answer incoming call programmatically in iOS?

karthikeya Boyini
karthikeya Boyini
Updated on 30-Jul-2019 541 Views

Apple iPhone SDK doesn’t allow this feature. If you really wish to achieve it you can use some private api such as CTCallAnswer(call);This will result in your app store rejection.

Read More

How to enable/disable data connection in iOS programmatically?

Mohtashim M
Mohtashim M
Updated on 30-Jul-2019 507 Views

User can turn on or turn off mobile data from settings of an iOS device, but it’s practically not possible to disable or enable the same programmatically. It is only possible if you jailbroke an iOS device.. Apple does not allow any apps developer to access wifi or Bluetooth.There are some private API’s which may aid this but eventually result in app rejection from the app store.

Read More

Where are the app cookies stored on the iPhone?

Smita Kapse
Smita Kapse
Updated on 30-Jul-2019 4K+ Views

Cookies are small files which are stored on a user's device while browsing internet.When we talk about cookies in iPhone we usually talk about application using the Web Views or the browser applications.A normal iOS application does not contains cookies. An app will have cookies only if the application has one or more web views.To check where are the app cookies stored on iPhone, On an iPhone, go to Settings -> Safari -> Advanced -> Website Data and you will see all cookies stored on your device.For iOS Application using web view The UIWebView will automatically store the cookies in the sharedHTTPCookieStorage.

Read More

How to execute a task repeatedly after fixed time intervals in iOS

Anvi Jain
Anvi Jain
Updated on 30-Jul-2019 344 Views

Apple has predefined class Timer, that fires after a certain time interval has elapsed, sending a specified message to a target object.To read more about the Timer class you can check official apple documentation herehttps://developer.apple.com/documentation/foundation/timerTo execute the task repeatedly after fixed interval of time we are going to use timer class. We are going to develop a sample application where the application prints hello Tutorials Point after every 5 seconds.So let’s get started, Step 1  − Open Xcode → New Project → Single View Application → Let’s name it “HelloTutotrialsPoint”Step 2  − Open ViewController.swift and write one method doSomething() below ...

Read More

How to Ping External host from Swift in iOS?

Smita Kapse
Smita Kapse
Updated on 30-Jul-2019 1K+ Views

Sometime you may require to ping an external website and check whether it’s up and running before you do any processing or fire request on the same.Here we will be seeing how to check whether the external website is up and running.Let’s being by Creating new projectStep 1 − Open Xcode → New Project → Single View Application → Let’s name it “PingMe”Step 2 − Open ViewController.swift and add the function checkIsConnectedToNetwork() and add the following code.func checkIsConnectedToNetwork() {    let hostUrl: String = "https://google.com"    if let url = URL(string: hostUrl) {       var request = URLRequest(url: ...

Read More

How to make a background 25% transparent on iOS

Anvi Jain
Anvi Jain
Updated on 30-Jul-2019 1K+ 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) }

Read More

How to detect user inactivity for 5 seconds in iOS?

Smita Kapse
Smita Kapse
Updated on 30-Jul-2019 1K+ 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 check notifications status for the iOS App

Nishtha Thakur
Nishtha Thakur
Updated on 30-Jul-2019 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
Showing 101–110 of 182 articles
« Prev 1 9 10 11 12 13 19 Next »
Advertisements