Category Archives: Swift

Swift is the new language introduced by Apple and is used for developing application in iOS platform.

Fatal error: unexpectedly found nil while unwrapping an Optional value

fatal error: unexpectedly found nil while unwrapping an Optional value This error is caused by unconditionally unwrapping an optional  which had nil. Optional is a type in swift which can either contain a value or no value nil. When a optional variable or constant which contains nil is forced unwrapped… Read more »

Add Custom Font in iOS Application Xcode 9

      No Comments on Add Custom Font in iOS Application Xcode 9

Adding custom font of your choice or of your business theme, in your iOS app is quite important. Custom fonts can enrich your app and transform it from just and app to an awesome app. Adding custom font in iOS application is a step by step process. In this article… Read more »

Swift: Split a String into an array

      No Comments on Swift: Split a String into an array

In Objective-c we used componentsSeparatedByString NSString *stringToSplit=@”str0,str1,str2,str3,str4,str5″; NSArray *arrayFromString = [str componentsSeparatedByString:@”,”]; In swift we can split a string into array simply by calling split() method var stringToSplit = “str0,str1,str2,str3,str4,str5” let arrayFromString = stringToSplit.split(separator: “,”) Less code.. 🙂

Passing Data between View Controllers

      No Comments on Passing Data between View Controllers

A ViewController in an application is seldom standalone in nature. They require data from ViewControllers in front and from those behind them, this leaves us with two types of data passing Forward Data passing Backward data passing For discussing both kinds of data passing we have two ViewCotrollers ASViewController ASViewControllerB… Read more »

String length in Swift

      No Comments on String length in Swift

To get the string length in swift we have two options depending on swift version Swift 3 yourString.characters.count //EXAMPLE if yourString.characters.count == 0{ //do something } 2. Swift 4 yourString.count //EXAMPLE if yourString.count == 0{ //do something }      

Swift 3 UIColor utilities : Random Hex color codes, Random UIColor

Simple  to use swift 3 functions which are very useful in development and testing. 1.Generating random UIColor in Swift 3: Function returns random UIColor each time func randomUIColor(alpha:CGFloat!)-> UIColor { return UIColor.init(red:(CGFloat(arc4random_uniform(256))/255.0), green:CGFloat(arc4random_uniform(256))/255.0, blue: (CGFloat(arc4random_uniform(256))/255.0), alpha: alpha) } 2.Random HEX Color code in Swift 3 : Function returns random 3 char… Read more »

Apple into BLE and WiFi aided indoor positioning

In WWDC 2014  session 708 Apple gave a introduction about indoor positioning. The indoor positioning is a area which cannot be covered using GPS as the signals are not expected to be accurate enough inside steal and concrete structure.So the the available signals were WiFi and beacons using BLE.

UITableView Tutorial : Creating a simple app in swift

This article has been updated for Swift 3 One of the most versatile UI elements which you come across in iOS development is UITableView.With a combination of custom cell and animation its possibilities are endless.From fancy menu to image scroll you must have found it at many places. In fact… Read more »