Tag: Apple
Debugging Swift App in Xcode
Any beginner iOS developer should be aware of the NSLog statement. This is quite frequently used to debug Objective-C programs. In Swift you can use println or print statement instead of NSLog to write the debug information to the console log. [code language=”swift”]var primeFlag:Bool = true println("input number is \(number)") if ((number == 2) ||…
Swift Enums
Enumerations, or enums, are a powerful feature in Swift that allow you to group related values under a single data type. Swift enums have significantly more capabilities compared to their counterparts in many other languages, including Objective-C. Let’s explore the various features of Swift enums with examples. Basic Enum Declaration Here’s a simple enum representing…
Swift Tuples
Tuples in Swift are a powerful feature that allows you to group multiple values into a single compound value. They’re particularly useful for returning multiple values from a function or for temporarily grouping related data. Let’s explore how to use tuples effectively in Swift. Basic Tuple Usage At its simplest, a tuple can group two…
How to reduce size of document with images in Microsoft Word
Microsoft Word provides users with the option to reduce the file size of the document with images. In this tutorial, we will see the technique of reducing the file size in Word 2013 and Word 2011 for Mac. Reduce images size in Word 2013 Word 2013 users can use the Compress Pictures option available as…
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…
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…
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…