Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 

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...

Handling Click Events On SKSpriteNode

Hi,   Like UIButtons we don’t have IBActions for SKSpriteNode and what if we have to trigger the click event on SpriteNodes. Solution comes here by handling touch methods provided by UIResponder class. Start by creating a subc...

Autolayout: Content hugging VS Content compression resistance priority

Hi All, We have properties to set content according to content length and device screen size which help us to manage user interface of an application. Content hugging priority and content compression resistance priority helps you to maintain U...

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...

Learn Basics of Functions in Swift with Example [Video Tutorial]

Hi, Functions are chunks/module of code that can be reused in a program. Function in swift are unique and flexible enough to work with simple to complex style.  In this video we’ll be learning basics of functions, various function ...

Unit testing of swift project - User experience (UX)

Hi All, In iOS , We have two type of testing one is UI testing (User interface) and UX testing (User experience). In this tutorial we will learn UX testing of an ios app. User experience (UX)  is the internal experience that a person h...

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...

Making UIImageView Clickable Using UITapGestureRecognizer

Hi,   We all know that buttons has their own IBActions that can be drawn easily via xibs/storyboard and codes. But what if the view type is UIImageView or UILabel or any other. In that case we can use UITapGestureRecognizer which is a...

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 ...

How to Integrate Google Login in iOS App Using Swift?

Login with google is very common functionality in iOS applications. We can Implement google login in swift 3.0 either by using pods or google SDK. We need to install the following pod- pod 'Google/SignIn' Then register your app on the ...

Install CocoaPods and Dependencies in Swift

Hi,   CocoaPods is a dependency manager built on Ruby. It has thousands of libraries and more than a million of apps which helps to scale our project in a graceful and stylish manner. It saves a lot of time when dealing with various de...

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...

Operators in Swift - Video Tutorial for Beginners

Hi, In this Video Tutorial on Swift Basic, we will learn about Operators in Swift. Based on fundamentals of C and objective-C,  Swift offers various operators to check, change, compare and combine value. These operators can b...

Swift Programming Basics for Beginner [Video Tutorial]

Hi All, We all are aware that Swift is new programming language launched by apple for iOS, MacOS, WatchOS and TVOS app development. Although many parts of swift will be familiar to you if you've experience on developing in C and ...

Email Password Validation

Hello Coders, It’s always a need to validate email at user end. Not only this but strong password is also suggested to secure accounts. Here are snippets to validate if correct email and strong password are entered or not.   ...

Dictionary to JSON String

We often come across a condition where JSON string is to be sent to server. for example parameters like username & password is to be posted as JSON String for validating credentials from server. Best practice is to create an extension of N...

Rescale UImage to New Size

We may be using image sets where few images are pretty big or small in size(say big 500X500 for instance). And if you want to resize the image to your desired size then it’s easiest by creating an extension of UIImage that will draw the ima...

Find Current month,Day,WeekDay from Date in Swift

Hi, To get the current Year, Current month, Current WeekDay, and current day if the date you can use the following code. To use this create a Extension of the NSDate and call the method with NSDate Object. And call the method like CURREN...

Use Collection View in swift

Hi, Step's required to use collectionView in Swift 1- Add collection View in your project 2- Set the delegate for collection view in controller 3- Collection view has a prototype cell, you can design accordingly you want. 4- Cr...

User default in swift

Hi , To use userDefault in swift we can use below code to 1- Save value in userDefaults for a key 2-  Fetch value for a key 3- Remove value for a key 4- Remove all value Here is the code -   //Save a value in NSU...

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() ...

How to cancel all request from Alamofire

Hi Readers, If you are using Alamofire framework to implement API service classes and you need to cancel all the request which are fetching data from server. You can use following Swift code snippet: if #available(iOS 9.0, *) { ...

How to filter array in Swift

Hi Readers, In iOS app many times we have to filter our results according to requirement. We can filter array of results same as following example. Let say we have an array(articleArray) like: ( { Read = 0; Save...

Open Date picker on textField begin editing in Swift

To open a date picker in textFieldShouldBeginEditing we can use the inpuView property of the textField. To open a datePicker when text Field start editing we can follow these steps. 1- On your View Controller add a view that contains the our ...

Create a textField with left Side image and bottom border line in swift

1- Create a new class subclass of UITextField. 2 -Write down code below in new created class 3- Add a textField in ios Your viewController. 4- Chnage th class of your TextField with the new class that you created. 5- Change the attrib...

UiSplitView Controller in Swift

To Create a SplitViewController in swift follow the steps:- 1- Create a new Project. 2- Add a splitViewController. 3- Create a cocoaTouch Class inherits from UIViewController named as DetailViewController 4- Create another CoCoatouchC...

Show a pdf file in ios WebView in swift

Hi to load a swift file in webView in ios :- 1- Add a WebView in your viewController 2- Create an IBOutlet for this. 3- set the delegate fro webView. 4- if you want to load the pdf from server or from an url use the function loadFromU...

Create a extension class in swift of singleton

Hi, To Create a extension class in swift Please follow the steps below. 1- Add a new Swift file in your project and add the following code import Foundation //MySingltonClassSwift is a singletonClass or you can use any class for which...

Create a Singleton class in swift

Hi, To Create a Singleton class in swift follow steps below: 1- Add a Cocoa Class file subclass of NSObject named it as MySingleton and now write down the code as .   import UIKit class MySingleton: NSObject { static let ...

Unwind to ViewController in swift

To Use Unwind Segues in swift please follow the steps:- 1- Create two ViewController using storyBoard 2- Create a segue from FirstViewControleller to secondViewController 3- Write a function in FirstViewController like this @IBAction func...

How to shuffle an array

Hi all, Shuffling an array means randomly re-arranging the content of an array .Shuffling algorithm can be used in many places now days like in card games, music player , media player etc. Shuffling of an array can be done in two ways. ...

Tic-Tac-Toe

Hi all, Tic-Tac-Toe is simple game in which you will try to mark your sign in three blocks to make a row , column or diagonal.   RULES FOR TIC-TAC-TOE 1. The game is played on a grid that's 3 squares by 3 squares. 2. You a...

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...

Protocols in Swift

Hi All, Protocol : - A protocol defines a representation of methods and properties that suit a particular task or piece of functionality. The protocol can then be adopted by a class, structure, or enumeration to provide an actual implementatio...

Convert String to NSData and NSData to String Swift

Hi All, In coding we have secure some information while we are sending it to server and vice versa ,In this case we use encoding and decoding . You can encode your information by using any method of encoding and when you will receive informati...

Fetch Phone Contact Using Contacts Framework

Hi all, Apple has introduced new Contacts Framework in iOS 9, which replaces the AddressBook framework. Accessing contacts information using AddressBook framework was very tough task for developer. But new Contacts framework of iOS 9 provides ...

One Way Binding In Swift

Hi All, One Way Binding :- In one way bindings, data flows only from object to UI and not vice-versa. For instance, you can have a UITextField called as nameTF which is binded with an object having property nameValue. So when the object value...

How to print without newline in swift 2.0

Hi Readers! In swift 2.0, print() statement adds a new line character automatically, where as in swift 1.2, println() and print() were 2 separate functions. Apple in 2.0 has given only 1 statement for print() with different parameters. T...
prev 1
Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: