Home     About     Archive

Lazy Thoughts

Why I Love Swift

Because.

This would take a lot more lines in Objective-C, and be less clear.

Here’s the extension for it:

extension Array {
    func partitionBy(predicate: (Element -> Bool)) -> ([Element], [Element]) {
        var left = [Element]()
        var right = [Element]()
        
        for elem in self {
            if predicate(elem) {
                left.append(elem)
            } else {
                right.append(elem)
            }
        }
        
        return (left, right)
    }
  }

N'oluyo TV Guide

Here’s a video of the TV Guide I built for the last app I worked on. It’s a Turkish Beamly/Viggle, a TV companion app about shows and movies.

I really like how the whole view turned out. It uses a UITableView, UIView spring animations, and a lot of view shuffling and custom logic. Let me know if you’re interested and I’ll make a longer post explaining how it all works..