Dec 04, 2016

Debug View for iOS App

It’s a common requirement to tweak different configurations of the app for debug purposes. The general way of doing it is using Settings.bundle where the Settings are located inside Setting of the iPhone. It has a few drawbacks..

  • Setting up Settings.bundle is a hassale and needs some research do to
  • Creating custom pages and changing values on the go are hard
  • There are limitations to what values you can set
  • It’s just cubersome to go back to settings to see how app behavior changes when some configs are tweaked.

**In comes PGDebugView **

Read on  

  Nov 20, 2016

A case for Plist and scripting in Swift

Property List is a convenient and flexible format for saving data. It was originally defined by apple, to use in iOS devices and later extended to various apps. Plist internally is actually an XML file and can easily be converted to JSON file format as well. Xcode provides a nice visual tool to edit and view contents of a .plist file.

Read on  

  Jan 25, 2016

Complex number

Since a complex number is comprised of a real and imaginary component, two complex numbers are equal if and only if their respective real and imaginary components are equal.

Read on  

  Jan 24, 2016

TLDR iOS App

build-status Twitter appStore

TL;DR (iOS Version)

TL;DR is a open source project which maintains a list of man pages. This project is the iOS Client of that.

Read on  

  Jan 24, 2016

Strange Swift Protocol

Swift protocol is very interesting yet very weird. Sometimes it behaves very strangely.

import Foundation

protocol Command {}

struct TLDRCommand: Command {}

// Works
func getOk() -> [Command] {
    return [TLDRCommand(), TLDRCommand(), TLDRCommand()]
}

// Does not work
func getFail() -> [Command] {
    let myArray = [TLDRCommand(), TLDRCommand(), TLDRCommand()]
    return myArray
}

// Casting also does not work
func getFail2() -> [Command] {
    let myArray = [TLDRCommand(), TLDRCommand(), TLDRCommand()]
    return myArray as [Command]
}

// This works, no complain about RHS not being the type of LHS
func getOk2() -> [Command] {
    let myArray: [Command] = [TLDRCommand(), TLDRCommand(), TLDRCommand()]
    return myArray
}

// And this also this works
func getOk3() -> [Command] {
    var myArray: [Command] = []
    myArray.append(TLDRCommand())
    myArray.append(TLDRCommand())

    return myArray
}
Read on