Day 13: Lucky number 13.. not really an app but more an update

October 9, 2015 Will Lam

So today was a bit of a slog because I had to get some stuff back for a review I was writing for Staples. You can check out my latest review over at Staples Tech Hub.

After that I met up with some friends to discuss how I can help them with their website, online marketing and distribution. I’m only considering these guys now because I really like what they’re doing and the unique approach they bring to the table compared to other competing solutions on the market. Will be more of part-time endeavour to feel each other out, but I have a good feeling about them.

After wrapping it all up, it was nearly 3:30 in the afternoon when I tried to cobble something together. Then I drew a blank. I felt as if I ran out of gas for the day, because I had a hangout scheduled with a good friend of mine, Brandon Chu over at Shopify. Then a bit overwhelmed about knowing the mountain of work and learning I need to surmount to get ready for the Lighthouse Labs bootcamp I was admitted to.

Fears and doubt of taking the more practical route of going back to marketing or product management. But in my heart of hearts, I know I want to do this. To be able to dive into something and immerse myself fully. The other option would be not to pursue it at all. Then I’d be filled with regret, not having the opportunity like this pop up again.

It was great to reaffirm and remember why I wanted to learn programming in the first place. To build useful things and create value in the world. And maybe add another feather to my cap in terms of another thing I’ll be able to do.

I’ve come to accept that I probably won’t ever fit the mould of being a specialist. Like a TED Talk I recently watched, I’m more of a “multipotentialite”, “polymath”, and renaissance man. I still like the term “T-Shaped Individual” but, that’s just personal taste 🙂

Soo.. what about the app?

Okay, so back to the app. I didn’t finish an app per se, it’s more of a deeper exploration of UIPickerView.

I had the idea that I could create an app using UIPickerView called “Seasons”. It would have four images, one for each season, and leveraging UIPickerView. For each season, the background would change to a picture of that season. That’s it. Not sure if I was to use an image array or simply add images to Xcassets and call them in a switch or if/else statement.

It turned out to be trickier than anticipated because I’m still learning how to properly use Apple’s documentation to figure out how to use protocols properly.

In any case, I could only get as far as implementing  UIPickerView, with the colours, white, red, green and blue.

import UIKit

class ViewController: UIViewController, UIPickerViewDataSource, UIPickerViewDelegate
    
{
    @IBOutlet weak var pickerView: UIPickerView!
    
   
    var pickerDataSource = ["White", "Red", "Green", "Blue"]

    
    override func viewDidLoad() {
        
        super.viewDidLoad()
        self.pickerView.dataSource = self
        self.pickerView.delegate = self
    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }

    
    func numberOfComponentsInPickerView(pickerView: UIPickerView) -> Int {
        return 1
    }
    
    func pickerView(pickerView: UIPickerView, numberOfRowsInComponent component: Int) -> Int {
        return pickerDataSource.count
    }

    func pickerView(pickerView: UIPickerView, titleForRow row: Int, forComponent component: Int) -> String? {
        return pickerDataSource[row]
    }
    
    func pickerView(pickerView: UIPickerView, didSelectRow row: Int, inComponent component: Int)
    {
        if(row == 0)
        {
            self.view.backgroundColor = UIColor.whiteColor()
        }
        else if(row == 1)
        {
            self.view.backgroundColor = UIColor.redColor()
        }
        else if(row == 2)
        {
            self.view.backgroundColor =  UIColor.greenColor()
        }
        else
        {
            self.view.backgroundColor = UIColor.blueColor()
        }
    }
    

}

I feel kinda tired, going into Day 14. I knew it wasn’t going to be easy, but since it’s long weekend.. I think it’ll do me some good to be able to head into the remaining 80% of this challenge with a fresh brain, solid attitude and in good spirits.

Previous Article
Day 14: Kind of back on track and yet another tip calculator app…
Day 14: Kind of back on track and yet another tip calculator app…

So this past weekend was a bit worrisome in terms of keeping up with the challenge. Without getting into th...

Next Article
Day 12: Movie Database app with Tuples
Day 12: Movie Database app with Tuples

Okay, while it doesn’t hook into IMDB, Flixster, APIs or anything cool like that (yet), today I went throug...