Being In A Software Developer Book Club — November 19, 2015

Being In A Software Developer Book Club

First, a little background…

The book club I am currently in is made up of 8 people, 3 iOS developers and 5 .Net developers. Typically we read around 20-30 pages a week in our own time and then meet for 20 minutes or so after lunch to discuss what we read that week.

But why do it in the first place? Here are a select few of my reasons (I have a lot more!)

article-1294306779303-0ca714e3000005dc-110102_304x183
Lots of people have book clubs

We all want to get better at what we do but for one reason or another some struggle to read a book past the first few chapters. Reading with other people is a great way to make yourself read a book, as you will at least want to keep up with the group but you may also find solidarity with your group through the tough chapters.

Naturally the group will be made up of different skill levels so you may find yourself soon reading a book that you may never have picked up because you considered it out of your depth. This can also help to broaden team knowledge and cohesion by finding out who is knowledgeable on certain subjects and learning from other’s anecdotes on the topic of discussion.

Looking up concepts born in conversation is also regular occurrence. For example while reading The Art Of Unit Testing, which is all in C#, a discussion erupted on the difference of unit testing with Swift and Objective C. This then evolved into questions regarding what Objective C and Swift compile down to and the Objective C runtime. Needless to say much research was carried out afterwards.
Most importantly, keep the book selection fun. We tend to read tech book then a more abstract book so that everyone gets to change gear a little. When I mean abstract I mean books that can relate to software development but cover a much wider scope of thought, for example Conceptual Blockbusting.

The benefit of more abstract books is to make everyone think on another level about their thought process and how they tackle problems, as well as broadening people’s horizons into areas they may not normally have ventured. Personally I also find these books stimulate a lot of conversation in the group, perhaps because it transcends skill level and equals the playing field for conversation?

Unknown
You never know how popular your book club may become

Tips

  • Someone should really lead the group, prompting talking points and scheduling meet ups.
  • Ideally at least one person will have a small grasp of the topic if a tech book is being read to help lead conversation.
  • Some books are easier to read than others, change pages/chapters per week to suit.
  • Meet up after lunch, as people tend to be less busy.
  • It should be fun, not a monologue or lecture.
Easy Expanding/Collapsing TableViewCells — November 6, 2015

Easy Expanding/Collapsing TableViewCells

I noticed when using an app the other day that its UITableViewCells were increasing in size when touched, with the height increase also animated. I thought this would be quite difficult to achieve but after digging around it turns out that its quite simple. By the end of this quick post we will have something like the below.

giphy

Start by creating a new single view project in Swift. Navigate to the storyboard view and change the default UIViewController for a UITableViewController. Then create a new prototype cell that is 140 points in height. Place the label you want visible when the cell is small in height (44 points) and then place some labels and buttons below. The latter views will be visible when the cell has been touched.

Screen Shot 2015-11-06 at 12.39.55

Create a new class called TableViewController and paste the code beneath inside it.

import UIKit

class TableVIewController: UITableViewController
{
    var selectedCellIndex = -1
    
    override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell
    {
        return tableView.dequeueReusableCellWithIdentifier("Cell")!
    }
    
    override func tableView(tableView: UITableView, heightForRowAtIndexPath indexPath: NSIndexPath) -> CGFloat
    {
        return (indexPath.row == selectedCellIndex) ? 140 : 44
    }
    
    override func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath)
    {
	selectedCellIndex =  (selectedCellIndex == indexPath.row) ? -1 : indexPath.row

        self.tableView.beginUpdates()
        self.tableView.endUpdates()
    }
    
    override func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int
    {
        return 4
    }
}

Add the new TableViewController to the UITableViewController in the Storyboard using the Identity Inspector and hit run. Select a row and its size should increase with a nice animation. So how does this work?

BeginUpdates and endUpdates allows you to make changes to the tableView, such as inserting and deleting rows without needing to call for a reload. To make this process look nicer to the user it is animated. Although we don’t perform any insertions/deletions between beginUpdates and endUpdates the animation is still triggered as well as heightForRow, where we set the new height of the selected row.

If you don’t want the animation to happen just do this

UIView.setAnimationsEnabled(false)
self.tableView.beginUpdates()
self.tableView.endUpdates()
UIView.setAnimationsEnabled(true)