Sunday, 26 August 2018

iOS new amazing feature AIRPRINT

Airprint is a technology developed by Apple which wirelessly prints documents when connected with an iOS device.

In this tutorial, a PDF from a url will be printed by using Airprint.



1. Create a Single View Application on Xcode and open it. 

2. Create a Print button and add an action. 

3.  


Add this code block in your IB action and run the application. 
You can see activity controller with printing option. That's it. 



This tutorial is made with Xcode 9 and built for iOS 11.

Thanks for visiting!! 




Friday, 15 June 2018

Using Clousers in Swift

Hello guys in this tutorial I am going to tell you about Clousers.

Clousers are used as an alternative to functions. 

According to Apple , Clousers are self contained blocks of functionality that can be passed around or used in the code. 

Syntax for Clousers in Swift

              Syntax ==  {(parameters) -> (returnType) in }


Here is an example for Clousers : 




Here var clouserExample is the declaration of the clouser
and print is its usage. 


Difference between functions and Clousers : 

Most of the people ask what is the difference between functions and Clousers. Although they offer almost the same purpose but here are some of the key points : 


       FUNCTION
  • has a name 
  • has func keyword
  • has no in keyword

  • CLOSURE
  • has no name
  • has no func keyword
  • has in keyword




And that's it. Hope you have enjoyed the blog !
Thanks :)












Tuesday, 6 September 2016

JSON parsing using GET method in AFNetworking

In this tutorial I will use AFNetworking  to parse JSON data in our iOS application .


For JSON parsing ,  i will use GET method.



So lets move straight to code.



1. Add AFNetworking to your project .

Install pods of AFNetworking or directly add them to your project


2. Don't forget to add AFNetworking.h to your view controller.

#import "AFNetworking.h"


3. Finally add this code to parse JSON data using Get method






Thats it .

For more blogs on JSON parsing visit my another blog


Keep reading  :)

Sunday, 17 July 2016

Get user data from Facebook in iOS

In this tutorial I will tell you about fetching user information from Facebook in your application.


Facebook



First of all you need to integrate Facebook SDK to your project .


For integrating Facebook to your project click on the link  . Facebook provides simple iOS SDK integration .



After integrating Facebook to your project :

1)  Create  a UIButton for login with facebook



2) Login Facebook on button's action and add Facebook details method to get user details



By Facebook details method :-
You can get
1) Social id
2) Full name of user
3) Email of user
4) Profile picture


For uploading image file to server , please visit my blog on image uploading using multipart 


Thanks :) 

Friday, 20 May 2016

Change UISegmentControl color in iOS

How to change color of UISegmentControl in iOS  ?






 To change UISegmentController color add the following code in your viewDidLoad  : 





Result





Cheers !

Happy Coding :)

Monday, 18 April 2016

JSON parsing using GET method in iOS

In this post , we will know about how to send or receive JSON data using GET parameters .



Step 1 : Create a new Xcode project .





Step 2:   Update info.plist in your project.

1)    Add App Transport Security Settings in the plist .

2)    Add Allow Arbitrary Loads to YES as a subtype of App Transport Security Settings.






Step 3 : Add the following code in ViewDidLoad


For JSON parsing using post parameters view my post on JSON using POST parameters 


Thank You :)

Thursday, 14 April 2016

Upload image file to server in iOS.

In this tutorial we will upload the image as a file to JSON server .
For uploading image as a file we use multipart form as our content type .








Now jumping straightforward to our code .

Step 1 :  Add AFNetworking framework to your project .

               How to add AFNetworking to your project ?
               Visit my previous post on AFNetworking .



Step 2:   Import AFNetworking to your project.

             #import <AFNetworking/AFNetworking.h>




Step 3:   Add the following code in viewDidLoad to upload image as a file :




Thats all about file uploading in iOS .

Thank you :) .