Website Logo. Upload to /source/logo.png ; disable in /source/_includes/logo.html

Hacker School Log

Laura Skelton | Summer 2014 Batch

Hacker School Day 0: Swift Playgrounds

First day of Hacker School! It was amazing to meet so many people who shared interests and had new ideas about programming.

I had planned to get to work on Machine Learning and getting comfortable with neural networks, but since the announcement of the new Swift language for iOS, there was a lot of interest in diving into learning that.

I learned about algebraic data structures from some other Hacker Schoolers over lunch, which was cool. I could see the recursive tree structure being a useful way to set up a decision tree in another language and will have to learn more about whether the data structures available in some other programming languages would make the machine learning algorithms possible to be coded in a more obvious, intuitive way than they are generally set up in Python.

I got together with a group in the afternoon to learn about Swift and the new Playgrounds Apple introduced in XCode 6. Playgrounds are cool because you can copy a snippet of code you’re working on and see how the variables are being set and the values are changing over time as it runs through a loop.

I paired with Denise on getting some Swift code working. We figured out the brand-new syntax for hooking up variables to Storyboard outlets so we could generate a simple app with a button and some labels that changed text. We learned that every variable in Swift is public, as opposed to Obj-C which lets you set only certain parameters to be accessible from other classes. Once we got things going, the syntax seems much simpler and faster than all of the boilerplate code you have to write to do the same things in Obj-C.

Later in the afternoon I worked on copying some simple demo apps I’d written previously in Obj-C into Swift so I could get more comfortable with the new syntax. Translating the very basic apps was relatively straightforward.

Coolest thing from Day 0: Emoji as variable and function names in Swift! Cutest language ever?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import UIKit

class MyViewController: UIViewController {

    @IBOutlet var ๐Ÿถ: UILabel
    var ๐Ÿ˜ป = "๐Ÿถ๐Ÿท๐Ÿน๐Ÿฐ๐Ÿฑ"

    @IBOutlet var ๐Ÿน: UIButton

    override func viewDidLoad() {
        super.viewDidLoad()

        ๐Ÿถ.text = ๐Ÿ˜ป

    }

    @IBAction func ๐Ÿญ() {
        ๐Ÿถ.text = "๐Ÿฐ๐Ÿฏ๐Ÿต๐Ÿฎ๐Ÿจ"
    }

}