Tag: Xcode
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…
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…
How to disable arc for specific classes in Xcode
Xcode provides option to disable arc only for specific classes by providing a compiler flag. This is quite useful when you are including framework written prior to iOS 5 in your project. Let us see the steps required for specifying the compiler flag in Xcode. In the above screenshot, you can see errors rested ARC…
Quickly copy photos in to photos album in iOS Simulator
Photos Album in iOS Simulator is generally empty and if you are writing apps using Photos functionality then you might need some photos in them. Listed below are the steps for placing photos under the Photos Album in Simulator. Step 1: Access the Home screen on iOS simulator. (Hardware > Home) If you tap Photos…