Category: Development

Algorithm Heap Sort

Heap Sort algorithm: Swift & Objective-C implementations

Heap sort algorithm is sorting algorithm that uses a data structure called heap. A Heap is a data structure similar to a binary tree (nearly completed) saved into an array. Heap Sort runs in O(n lg n) time. The main property of a heap is that it must maintain the Heap-Property. The Heap-Property depends on the

Read More
Algorithm_ Merge Sort

Merge Sort algorithm: Swift & Objective-C implementations

Merge Sort algorithm is one of the most common algorithms in books. It is the most used example to explain the divide and conquer technique. Furthermore, it is one of the easiest algorithms that has a reasonable running time for a big input => O(n log n). How Merge Sort algorithm works? This graph shows the process: If you

Read More
Algorithm Insertion Sort Objective -C Swift

Insertion Sort algorithm: Swift & Objective-C implementations

When one is starting to learn about algorithms, one of the first examples is Insertion Sort algorithm. The classic example to introduce Insertion Sort algorithm is how a poker player sorts a hand of cards in increasing order: Every time he gets a new card from the deck, he compares it to the cards which are already

Read More

How to make a Today Extension Widget in Swift

Swift Today Extension Widget

We are going to learn how to use the new feature of iOS8: Today Extension (Widget for your notification center screen). We are going to take, as the base project, the one explained here. You will learn:

  1. How to create a Today Extension in Xcode: Target
  2. How to use the method widgetPerformUpdateWithCompletionHandler
  3. How to share data between the Today Extension and the main app

At the end of the post you will have a widget that gets data from its container app. The app gets stock values from Yahoo Finance API and the widgets recovers the last one received from AAPL.

Read More

Swift App Tutorial: Swing Copters Part I

wift Copters Swing Copters

In this tutorial you are going to learn how to use SpriteKit and Swift for iOS8! We are going to make a game like Swing Copters (last game of Flappy Bird creator), in order to choose an easy and well-know example. Here is the full list of features that you will learn today:

  • How to create a SpriteKit+Swift project in Xcode 6
  • How to create a infinite scroll game with SpriteKit and Swift
  • How to use SKNode, SKSpriteNode, SKLabelNode and SKActions in Swift
  • How to use SKPhysicsBody, impulses and gravity with Swift
  • How to make transitions with SKTransion in Swift

See the video with the final app:

Read More

Swift App Tutorial: SwiftStocks (Part II)

SwiftStocks Tutorial Part 2

In the first chapter of this series, we designed a model, created a mockup, and started a swift project, ending up with the first viewController -the tableView- with some hardcoded stocks and values.

In this second post, we are going to explain:

  1. How to create a Swift project (Part I)
  2. How to hide the status bar (Part I)
  3. How to use UITableView in Swift (Part I)
  4. How to use tuples in Swift
  5. How to use switch in Swift
  6. How to use  singleton pattern in Swift (Part II)
  7. How to use web services in Swift (Part II)
  8. How to use the NSNotificationCenter in Swift (Part II)
Read More

Swift App Tutorial: SwiftStocks (Part I)

SwiftStocks Tutorial Part 1
During this tutorial we are going to develop a simple Swift app. We will create and app with swift that will show the value of some stocks. The app will have the following functionalities:

  1. Show a table with different stocks and values
  2. Search for new stocks.
  3. Show an individual stock in detail.

What you will learn:

  1. How to create a Swift project (Part I)
  2. How to hide the status bar (Part I)
  3. How to use UITableView in Swift (Part I)
  4. How to use tuples in Swift 
  5. How to use switch in Swift
  6. How to use  singleton pattern in Swift (Part II)
  7. How to use web services in Swift (Part II)
  8. How to use the NSNotificationCenter in Swift (Part II)

In order to get the stock values, we will use Yahoo Finance API. Hope you enjoy this tutorial!

Read More