Viewing: Develop

Assertions supported in XCTest

Here you can find the list of Assertions supported by XCTest and it is essential to know all these assertion if you are practicing Test Driven Development in IOS. You can get this list from XCTestAssertions.h XCTFail(<#format...#>) - This unconditionally fails the test. XCTAssertNil(<#a1#>, <#format...#>) - Failure message when object is not nil. XCTAssertNotNil(<#a1#>, <#format...#>) […] Read More

Closures, Extensions and Generics in Swift

Closures are self contained lines of code that can be passed around the application and similar to blocks in Objective-C. A typical closure syntax in Swift looks as shown below In the above code example, a closure has been assigned to a variable. The purpose of this closure is to concatenate the string parameters and return […] Read More

Tuples, Enums and Protocols in Swift

Tuples in Swift allows user to assign group of values to a variable, constant and even return parameter of a function. In the below example, a employee constant is assigned Int and String values. And to access these parameters, we need to use .0 and .1Now let us say you want to assign proper name […] Read More

How to display line numbers in Xcode

Listed below are the steps to display line number in Xcode editor window. This is quite useful when you are working in a ground and want to communicate the line number of statement to other members. Click Xcode menu option and select Preferences from the menu list In the Preferences window, click Text Editing tab. […] Read More

How to record and play sound in Swift

In this tutorial, we are going to see the required steps to record and play sound in Swift Programming language using AVAudioRecorder and AVAudioPlayer Download source code from github (SoundController.swift) User Interface The user interface for this demo is simple with two buttons, one for recording and another for playing sound. Create corresponding IBAction and […] Read More

UITextFieldDelegate in Swift

This is a beginners tutorial on UITextFieldDelegate in Swift. We are going to see how to use UITextFieldDelegate by writing a Simple Interest Calculator. Download the source code from here This calculator uses UILabels and TextFields for displaying and accepting amount and interest. We are going to use the UITextFieldDelegate method to navigate from "Principal […] Read More

Test Driven Development in Swift

Here is a beginner tutorial on TDD in Swift by writing a program that checks for a prime number. Let us start by creating a new project, selecting template as Single View Application. Though we won’t be adding anything to the storyboard as we will focus only on the business logic. After creating the project, […] Read More

Enum in Swift

Enum group of related values to a single data type. Swift enum has lot of new features compared to its predecessor Objective-C. Let us see this with an example enum type for all Months in a year. enum Months { case January, February, March, April, May, June, July, August, September, October, November, December }   […] Read More

Remove Apple Mach-O Linker directory not found

Listed below are the steps to remove Apple Mach-O linker warning directory not found warning message. 1. Navigate to Project Navigator, select the Project then navigate to Build Settings. 2. Under Build Settings, scroll down to Search Paths and double click on Library Search Paths. 3. Select the missing folder paths and remove them using […] Read More

Integrating Stripe in Swift for iOS development

Stripe is payment gateway that can be integrated with any website and mobile apps. In this tutorial we will see a quick and simple integration of Stripe in Swift for iOS development using Stripe documentation for iOS.This hands on tutorial will help you to familiarise yourself in Validating and creating token using Stripe IOS SDK […] Read More

1 2 4