Optional Value In Swift

Posted by on Mar 22, 2016 in Swift | No Comments

An optional provides a variable that can be assigned to contain a value, or left or assigned as nil. The pattern below creates and optional variable (note the ?), assigns it a value, then checks if that value has been assigned.

//create optional 
var optionalName: String?
//assign value
optionalName = "Billy"
// check for value
if let name = optionalName {
    greeting = "Hello, \(name)"

Recursion in Swift

Posted by on Mar 21, 2016 in Apple, apps, code, programming, Swift | No Comments

Recursion is when a method or function calls itself.

//depending on what number you give to N, the function will call itself that many times, subtracting 1 from the original N each time through to pass as an argument.

func thisFunctionCallsItself(thisManyTimes: Int) {
    //The next few lines are to set up the proper suffix on the printed result string
    var mySuffix = String()
    //let's get the last two digits from thisManyTimes
    let lastTwoDigits = thisManyTimes % 100
    switch lastTwoDigits {
    case 10...20:
        mySuffix = "th"
        //get the last digit 
        let lastDigit = thisManyTimes % 10
        switch lastDigit {
        case 1:
            mySuffix = "st"
        case 2:
            mySuffix = "nd"
        case 3:
            mySuffix = "rd"
            mySuffix = "th"
    //OK that it.
    //below is where the function calls itself
    if thisManyTimes != 0 {
        thisFunctionCallsItself (thisManyTimes - 1)
        print("This is the \(thisManyTimes)\(mySuffix) time that this function has called itself.")

//call the function.


Fire and Ice, documentary created with EPYX Productions

Posted by on Jun 27, 2014 in film, Video | No Comments

Siemens Energy Channel presents
“Fire and Ice”
(Fossil Power Documentary)

Documentary film shot in Bangkok Thailand.

I was DP on this one.

This documentary produced for Siemens is about power distribution in Thailand. The story is told by following electrical power from it’s source generated at a Siemens equiped plant, to the end users at an ice factory and fish market.

Music Videos produced in Bangkok

Posted by on Jun 21, 2014 in animation, modeling, photography, Video | No Comments

A couple of music videos produced with EPYX Productions. I did the photography and VFX.

Music videos produced in Bangkok, Thailand. Hong Hoon was created to support the feature horror film Hong Hoon starring Ananda Everingham. Alone was a music video for an up and coming Thai hard rock band called System Sucker.

Promotional images rendered for Thailand Comic Con

Posted by on Jun 18, 2014 in gallery, Maya, modeling, rendering | No Comments

Yaksa, The Protectors, is a project by Oliver Wolfson, in development. These renders were created to promote my VFX at Thailand Comic Con 2014.




Contact me if you need CG or Visual effects produced in Bangkok Thailand.

Fixing Gmail outgoing server (offline) issue in Mac Mail

Posted by on Jul 4, 2013 in how to | No Comments

In Mac mail, my Gmail accounts outgoing server “Gmail” was constantly offline. This last page of this About.com article: How to Access a Gmail Account in Mac OS X Mail did the trick for me. I needed to switch the outgoing server port setting to 465.


NSUserDefaults tutorial, on icodeBlog

Posted by on Jun 29, 2013 in Apple, apps, code | No Comments

Check out this article if you need information on using NSUserDefaults in Xcode.

iPhone Programming Tutorial – Saving/Retrieving Data Using NSUserDefaults

If you have any trouble saving and retrieving the defaults, try synchronizing:

    [[NSUserDefaults standardUserDefaults] synchronize];

Why we will be drooling over the new Mac Pro

Posted by on Jun 16, 2013 in Apple | No Comments

It looks like something out of a science fiction movie (and apparently it looks a lot like a Japanese trash can too), but the Mac Pro will be a piece of reality in a few months.


People who love Apple hardware, and use computers for graphics rendering or video will be dying to get their hands on this device. Here are the top five reasons why we will want to see the new Mac Pro on our desktop:

1. The Design. What is it? A coffee grinder? It’s a bit weird for a computer, but increadibly sleek at the same time. It reminds me a bit of the SGI O2, but way cooler. This device will probably be a major iconic design in the Apple’s historical lineup. The current Mac Pro is a beautiful machine, but the new Mac Pro makes the old cheese grater look retro.

2. Power. With up to 12 cores of Xeon 5 processor and 40 GB per second PCIe bandwidth, the new Mac Pro can deliver cpu performance up to 2x the current Mac Pro.

3. Speed. The new Mac Pro will support up to 128GB of ram and feature 60GB per second memory bandwidth, 2x the current bandwidth. The storage is “Next generation PCIe flash storage” that can read/write at 1250MB per second. 20Gb per second thunderbolt expansion ports. Super fast.

3. Graphics. The new Mac Pro will have, standard, two AMD FirePro GPUs with up to 6GB of dedicated VRAM graphics. The machine supports 4k video and up to three 4k displays.

4. Size. It’s like an eighth the size of the current Mac Pro.

Gradients v2.1 is available

Posted by on Apr 26, 2013 in Apple, apps | No Comments

Gradients is a photo effects app that allows users to build their own effects with gradient images. Over 40 template effects are included. I think this is a rather unique app. Please check it out. It’s only a buck: Gradients v2.1.


Gradients On The App Store

XCode breakpoint tip

Posted by on Mar 9, 2013 in Apple, apps, code | No Comments

Use breakpoints to replace NSLog statements while debugging your code.

Screen Shot 2013-05-09 at 9.08.49 AM


1. Add a break point.
2. Hold option + command and click the break point to edit it.
3. Tap the add action button.
3. Add an action or expression like below.

LLDB (debugger) action

po myVar


expr (void)NSLog(@"myVar = %d", myVar)

Select “Automatically continue after evaluating” to continue without stopping the code.


1. Easier to manage: e.g. you can view all the breakpoint and more in the breakpoint navigator (second button from the right in the navigator pane).

2. You can edit the actions or expressions, or add breakpoints while the code is running.

Source: 2012 WWDC video: Debugging in XCode. Much more information in this video.

Load More