Category: Xcode

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

  • Selection Sort

    Selection Sort algorithm does the same amount of comparison( N*(N-1)/2 ) like bubble sort but the number swaps (N) is reduced drastically. This sort algorithm traverse through all the items, picks the smallest number and swaps it with left most item. Then the step is repeated for the next smallest number until it reaches the…

  • 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…

  • Basic overview of Xcode

    Xcode is the primary tool used for the development of Mac and iOS applications. This is a free tool which can be downloaded from developer.apple.com website. You can use Xcode for Writing code, Building, Testing (Unit test) and for Distribution (Submitting to App Store). Xcode, Apple’s integrated development environment (IDE), has several panes designed to…

  • 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…

  • Test Driven Development in iOS – Beginners tutorial – Part 2

    This is in continuation of the Test Driven Development in iOS – Beginners tutorial and this covers writing XCTest user interfaces in iOS. AddingTwoNumbers app will have following controls 1. Three textfields – For entering the numbers and displaying the result. 2. Two buttons – Add button to perform addition and Reset button to clear…

  • Test Driven Development in iOS – Beginners tutorial – Part 1

    This is a beginner tutorial on TDD in iOS, explained with an example app that adds two numbers. Let us see try to use some XCTest assertions supported in iOS in this project. Create a New iOS project select the template as Empty Application Enter the required details in Choose options for your new project…