Category: Programming

  • No such module Cocoa

    No such module Cocoa error message is displayed when the type of playground file selected is iOS instead of OS X. Make sure to select Playground under OS X if you want to use Cocoa framework and go for UIKit incase of iOS Another alternate way is to change the template using the Playground Settings.…

  • Binary search

    After a simple bubble sort algorithm (not the most efficient sorting algorithm), let us try to implement Binary search in Swift Programming Language. Binary search algorithm can be applied only on sorted arrays. So let us first generate random numbers and store them in an array. Then call the bubble sort function to sort the…

  • Bubble Sort

    The best way to practice a new language is to write more programs using that language. Here is a Bubble Sort program written in Swift Programming language. Data to be sorted = {12, 56, 32, 23, 67, 87, 45, 23,10, 11} Bubble Sort Bubble Sort is performed by comparing two number starting from the left…

  • Regular Expressions Cheat sheet

    Regular Expressions form sequence of characters which can be used for pattern matching. They are quite powerful tool for finding or matching combination of characters. Special Characters in Regular Expression backslash ( \ ) – Used for matching special character by proceeding with backslash Eg:- For matching period in a string use backslash before period…

  • Generate random numbers – Example of motion and touch event

    Let us see how to use motion and touch event in iOS by looking through a simple project that displays random number. This project displays random number on a label for a touch and motion event. Check out this link for more about events in iOS After creating a single view application, add a new…

  • Java version 1.7 required to Google Plugin on Eclipse

    This is not related with iOS development but I have deployed the backend service for my iOS app on Google App Engine. This is about the steps for resolving the “JRE version is 1.6.0 1.7.0 or later is needed to run Google Plugin for Eclipse”. 1. Download the latest JDK from oracle website – http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html.…

  • Decode job advert posted in Swift Language

    I came across this unique Swift job advert in stackoverflow.com posted by Criteo. (Need to add override for the init function, missed in the original job post) var hello = “Hello, I am a Swift Program, paste me in the playground” var doyouswift = “You think you have what it takes to build the next…

  • Simple UITableView and UIAlertView example

    In this article, we are going to see how to create a simple UITableView for displaying data. And display an alert on selection of any row using UIAlertView. Launch Xcode, Click File > New Project and select Single View Application as the project template. Enter the project details for Product Name, Organization Name, Company Identifier…