TNSwiftyCheckboxGroup, create checkbox groups in Swift

TNCheckboxGroup

Last year I published TNCheckboxGroup for Objective-C, but I had a few comments it didn’t work when using with Swift. So I just published a Swift version on Github. This versions leverages UICollectionView to handle big sets of checkboxes. TNSwiftyCheckboxGroup, create checkbox groups in Swift.

Introducing TNSwiftyCheckboxGroup – checkbox groups in Swift

Overview image of the different styles of TNSwiftyCheckboxGroup

All the details about implementing the view controller are explained in the README of the Github project. There is an example project which shows you the different options.

Prerequisites

  • Xcode
  • iOS8+
  • Swift project

Features

  • 3 predefined styles (checkbox, radio button, image)
  • Possibility to add your own checkbox styles
  • Delegate object to get informed when your checkbox group changes
  • Storyboards & programmatic approach
  • Works in both orientations (landscape / portrait)
  • AutoLayout behind the scenes

Options

There are quite a few ways to customize the existing styles.  Here is a brief overview:

  • CollectionViewWidthOfCell : The width of the checkbox cell. Default: 150
  • CollectionViewBackgroundColor : The background color of the collection view. Default: White
  • FontOfNameLabel : The font of the name label. Default: System 12pt
  • FontColorOfNameLabel : The font color of the name label. Default: #333333
  • PreferredWidthOfNameLabel : The preferred width for the name label. Default: 100
  • CheckboxOuterColor : The outer color for the built-in checkbox types. Default: #333333
  • CheckboxInnerColor : The outer color for the built-in checkbox types. Default: White
  • CheckboxPadding : The padding between the inner and outer views of the build-in checkbox types. Default: 5
  • CheckboxUncheckedImageName : The image name for the unchecked image (defined in your image assets catalog), if you are using the TNSwiftyImageCheckboxView style. Default: unchecked-image
  • CheckboxCheckedImageName : The image name for the checked image (defined in your image assets catalog), if you are using the TNSwiftyImageCheckboxView style. Default: checked-image

To use these options, you just have to implement the style datasource method.

I hope you will like it. If you have any requests, please post them via the comments below or add an issue on Github.