Featured
-
Swift Programming Basics for Beginner - A 10 Min Video Tutorial
As we all are aware that Swift is new programming
by sandeep.rawat
Tags
Send Text Message in Swift
Hi,
Here we’ll learn how to send messages programatically in Swift. With the use of provided MessageUI framework we will implement message functionality in our app. This framework has MFMessageComposeViewController class which prov...
Send Email in Swift
Hi,
Here I’m exploring how to send mails programatically in Swift. Apple has provided MessageUI framework to implement mail functionality in your app. This framework has MFMailComposeViewController class which provides an inter...
Convert UIColor to Hexa Color Code
Hi,
If you want to get the HexaDecimal String code for any color then below code will surely help you to come out with the hexa color string.
Here are the steps to get hexa code string for any color.
1- Declare the va...
Function Returning Function in Swift
Hi,
As we all know that Swift comes with new and variety of enhancements over objective C. Returning a function as a return type of a function is also one of them.
Here we are defining two functions which are accepting Int kind of...
Generic Function in Swift
Hi,
Swift has a powerful feature of writing generic function as in Java which was missing in objective C.
It makes our code flexible and reusable for various types, meaning it can work with any data type. For similar logics and prob...
Add InputAccessoryView in Swift for UITextField and UITextView
Hi,
Sometimes we need to show our custom accessory view when UITextField/UITextView is in editing mode or being edited. We can use inputAccessoryView property to assign a view just above the system keyboard.
Input accessory view is ...
Control Flow & Conditional Statement Video Example for Beginner - Swift
Swift provides various Control flow and Conditional Statements. Although these are similar to Objective C but with improved enhancements and usability. These statements can be used to check, iterate over various conditions and values.
In this Sw...
PopOver from storyboard
Hi,
Presenting popover from storyboard is easy and developer friendly. One can handle Popover from storyboard itself with a little code handling.
Following are the steps to present Popover from storyboard.
1- Draw an action seg...
Defer in Swift
Hi,
Swift has introduced a new keyword called 'defer'. Based on its meaning ‘defer’ puts off an action or event to a later time. It runs when the execution is about to leave the code block. You can use ‘defe...
Bounce effect on View
iOS has integrated full physics engine to UIKit. Which not only integrate physics-related capabilities but adds smooth and fascinating animations by using underlying iOS Physics engine and provided dynamic items what we send in API. One can use t...
Providing Extra padding in UITextField
UITextField is an editable area where one can use to get input from user using keyboard.
We often come to a situation where extra padding is required from the left or right depending on requirement. Padding is already provided by UITextField...
Copy Paste in Swift
Apple provides the UIPasteboard class which enables the data to be shared within the app and with another app. To share data we can use pasteboards.
Here is the code snippet depicting how copy and Paste functionality can be achieved in...
Animating images in ImageView
ImageView can be used for animation with a set of multiple images using various properties offered by apple.
Here are I’m going to tell you steps to animate images in ImageView:
1- Initialise an array of UIIm...
NetworkReachability Listener in Alamofire
Alamofire provides a method to check network status reachable on WWAN, Ethernet and wifi. The NetworkReachabilityManager class provided by Alamofire listens whenever there is a change in network.
It can be used to determine background informat...
Adding Properties to Attribute Inspector in Swift
Accessing properties via interface builder is quite easy and more developer friendly.
Here I’m guiding you how to to add new/custom properties to interface builder.
1- Subclass any UIObject, we are considering here UIButton ...
Function inside a function
Functions are small modules or chunk of code. Swift’s function syntax is so flexible that it allows to write a function inside a function.
Here is a syntax:
func firstFunction(arguments) -> returnType{
func secondFunction(arg...
TextToSpeech API provided by Apple
Apple has provided a powerful api to play audio from text and here are the steps to achieve:
1- Import AVFoundation framework
2- Initialise AVSpeechSynthesizer(as below)
let synthesizer = AVSpeechSynthesizer()
...
A simple function returning UIColor from HexaColor String in swift
Here are step-by-step guide to obtain UIColor:
1- Firstly you need to do is to remove all spaces and new line character sets from the string and then covert the string to UPPER Case example AABBCC.
var cString:String = hexColorString.stri...
AVAudioPlayer implementation in Swift
An easy to implement simple swift class working on AVAudioPlayer depicting various features like play, pause and stop.
// creating single instance of class
static let sharedInstance = MyAudioPlayer()
var myAudi...
Fetch the user detail from facebook in iOS 9.0
To fetcht the user detail from facebook like name,first_name,last_name,middle_name,gender etc use the code below :
func fetchUserDetails(useid: String,accessToken:String)
{
let graphRequest : FBSDKGraphRequest = FBSDKGraphRequest...
login to facebook in ios 9.0
to login using facebook in iPhone sdk please use the code below.
install the pods for facebook using
pod "FBSDKCoreKit";
pod "FBSDKLoginKit";
pod "FBSDKShareKit";
pod "FBSDKMessengerShareKit"
import FBSDKLoginKit
...
How to use completion handler in swift
The code below will help you in declaration of completion handler and how to call the completion handler in swift.
To declare a completion handler in swift use the line :
typealias completionHander = (sucess: Bool)->Void
//decalrat...