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
How to Load an Image from URL with Special Characters in iOS Swift3
Swift#3
If an image URL contains special character which doesn't load image on image view then we need to do more than UTF8 encoding. We usually decode string using Unicode methods but sometimes it is not sufficient to encode special charact...
How to move between Two UIViews Independent of the ViewController in iOS
Before moving on to the topic, first of all, I assume you all are aware of Storyboards, segues plus traveling from one view controller to another. So going from one VC to another is okay what if we need to move between two UiView’s independ...
How to Load an iFrame in WKWebView Locally in iOS App
WKWebView, introduced in iOS 8 and OS X Yosemite which replaces UIWebView in UIKit and WebView in AppKit UI, it is used to open Safari browser outside the app. It loads web pages faster and more efficiently.
So, in...
Present ViewController with Transparent Background in Swift iOS App - Basic Steps
Sometimes we have to show a transparent View on a ViewController, For that we generally use .xib file and add them as subView in ViewController to show the transparency. But we can also give the transparency to view controller while presenting th...
How to Use Guard Statement in Swift iOS Application
Guard statement work as an error handler. If we have to send values to server which can be empty or may not be in that condition we can use guard so that if the value is nil then app will not get crashed.
let&...
How to Capture Screenshot of Particular Screen Via Swift3 Application
Many a time we need to take a screenshot of a screen on an iOS device. So In this blog, we will discuss how to capture a screenshot of a particular screen through an application and with the help of an example this concept can easily be understoo...
6 New iOS Swift-4 Features for Better Programming Experience
Swift programming language is developed by Apple Inc for various operating system iOS, watchOS, macOS, Linux, and tvOS with easiness and advanced features to work on Swift. It is safe, having a modern approach, powerful, have many other features ...
Implement Face Detection Feature in iOS Swift Using Core Image Framework
In popular apps like Facebook, you may notice that while uploading any photo post, it automatically detects human faces. Everyone now knows that the face detection feature has become the hour of need for every Photo Sharing app.
With the face ...
Swift: Get clicked image by camera
Hi All,
Sometime we have to take a picture using camera and use that image , we have to follow these simple steps.
1) Ask permission to access camera and microphone. Add these key and value in your project plist:-
<key>...
Choose Image from gallery
Hi All,
Sometime we have to pick an image/video from device gallery and to open gallery/photos of your device and pick any image , we have to follow these simple steps.
1) Ask permission to access user gallery. Add these key and v...
Hide Status bar in iOS
Hi,
If you want to hide status bar in your application then do following steps to achieve:
1- Go to info.plist file provided in left panel of your application.
2- Add a new key with name “View controller-base...
App Group capability of iOS
Hi All,
In iOS, AppExtension and its containing application and groups of application use App Groups capability to share data between them. For example if keyboard extension app want to share data with its containing application.
Using app ...
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...
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...
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...
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.
...
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...
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()
...
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...
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...
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...
How to declare Sets in Swift
Hi Readers!
Let us first understand what Sets means.
Sets
A set stores unique values of same type in a collection with no ordering. Sets should be used when there is no defined order, such as in Array. Secondly Array can store multiple ...
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
...
Send a request using Alamofire in swift
Use the alamofire in swift first install the pod file in your project using below steps:
1- open the terminal and run following commands
sudo gem update --system
sudo gem install cocoapods
pod setup
change folder to the current proejct ...
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...
Change the button background color when highlighted in swift
To create a button at run time in swift please use the followin code:
this code will help you in creating a button at run time. and also change the background color of the button in highlihted State..
To change the button background at the tim...