We're continuing our look at lesser-known UIKit functionality today with UITableView & UITableViewCell. Let's see what we can find:

Blur & Vibrancy Visual Effects

We can set UIVisualEffectView backgroundView , and a vibrancy separatorEffect so our table view really shines:

let blurView = UIVisualEffectView ( effect : UIBlurEffect ( style : . Dark )) tableView . backgroundView = blurView tableView . separatorEffect = UIVibrancyEffect ( forBlurEffect : blurView . effect as! UIBlurEffect )

Row Actions

We can get those awesome "swipe-to-reveal" actions from Mail.app in our own table views. We just need to implement one delegate function and return an array of UITableViewRowActions.

override func tableView ( tableView : UITableView , editActionsForRowAtIndexPath indexPath : NSIndexPath ) -> [ UITableViewRowAction ]? { let deployAction = UITableViewRowAction ( style : . Default , title : "Deploy" ) { ( action , indexPath ) in // TODO: Deploy the troop at this indexPath.row } return [ deployAction ] }

Adjusting to State Transitions

We can override the willTransitionToState(state:) and didTransitionToState(state:) functions in our UITableViewCell subclasses to run code when the cell begins or finishes showing the edit control or delete confirmation:

class StormtrooperCell : UITableViewCell { override func didTransitionToState ( state : UITableViewCellStateMask ) { super . didTransitionToState ( state ) if state == . ShowingEditControlMask { print ( "began editing!" ) } } }

Multiple Selection Background View

We can set a special background view on cells that will be shown only when we our table view supports multiple selection: