Lambda Labs Week V

3 minute read

Individual Accomplishments

This week I built out the UI for the “song chooser” on the alarm setup view. I added an alert that lets the user know when they are posting a piece of data with very little information, because we are only allowing one piece of daily data per day now. I made some minor adjustments to the layout of the alarm manager view, so that it would fit on smaller phones better. I added an explanation screen that is presented when the user starts the alarm, to show them where to place the phone. I improved how sleep quality is calculated, so that it takes both the length of sleep and the amount of ‘deep sleep’ into account. I added the ability to delete a piece of daily data from the stats view, and made some improvements to the stats page view controller to handle adding/removing data better. I fixed a couple of bugs, I added some timers to update the alarm setup view if the user sits on it for a while, and I added some sample data to display if the user doesn’t have any.

Explanation Screen Warning Popup Screen

Detailed Analysis

I think the most interesting thing I worked on this week was building out the UI for the song selection. I borrowed a pattern for modeling state from John Sundell and encapsulated everything having to do with choosing a song into that one class. Then all I have to do in the AlarmSetupViewController is add the SongSelectViewController as a child, put it in a container view, and get a reference to it’s selected song whenever I need it. I also built out this view entirely programmatically, to make use of all the helper functions I wrote in the last couple of weeks.

override func viewDidLoad() {


        if state == nil { transitionToState(.none) }

    enum State {
        case none
        case selected(MPMediaItem)


    func transitionToState(_ state: State) {
        self.state = state
        switch state {
        case .none:
        case .selected(let mediaItem):

And when it is all put together, it looks like this:

Song Select View with no song selected Song Select View with song selected


I think the 90-90 rule is a very real thing. During the first few weeks of this project, I felt like I was flying through stuff, adding features left and right. The question “What are we going to do with all this time?” floated through my head more than once. But the last couple of weeks have been a totally different pace. We have been polishing, and fixing bugs, and tweaking the UI. Not really adding features at all. It wasn’t all that exciting. And I spent a good amount of time tracking down bugs in my careless code from the first two weeks. I didn’t really feel like I was making much progress at all. I think that was the toughest part for me, the slog of working on dumb little problems. Every day I sat down at the computer and worked on making some improvement or other, and none of them felt that important.

But now that I have a moment to stop and look back at it, the app as a whole does feel a lot more cohesive and less fragile than it did two weeks ago. It’s not perfect. I have a long list of things I would like to work on if I had the time. But I think it is shippable, and that feels good.