This site uses cookies.
Click here to find out more.
Continue

SHARE

ALTableViewHelper: Framework


Use the App to get this framework

ALTableViewHelper

With text describe the contents of your NSTableView. ALTableViewHelper then keeps your TableView matched to your data.

Objective-C

import "ALTableViewHelper/ALTableViewHelper.h"

[self.collectionGrid setHelperString:@""
     "section\n"
     " versionItem * model.versions.all |filter{ model.versions[@].state == 'p' }\n"
     "  $.title <~ @.description\n"
     "section\n"
     " endItem\n"
     "  $.title <~ 'No Upload’\n”,
         context:self];

Swift

collectionGrid.setHelperString("""
     section
        versionItem * model.versions.all |filter{ model.versions[@].state == 'p' }
            $.title <~ @.description
     section
        endItem
            $.title <~ 'No Upload’
     """, context:self)

The context gives where values come from, so model refers to self.model.

TableViewDescription

section
// to define header text
headertext "The Title"    // or any other expression
// to define a header view
    header LoginHeader (44 /* or a calculation for the height */)
        // bindings for LoginHeader
    body
        UserName
            //bindings for UserName
        Password
            // bindings for Password
        DiscoveredAccount * accounts
            // bindings for DiscoveredAccount’s
footertext "There were \\(total) in all"
    footer LoginFooter (52)
        // bindings for LoginFooter
section
        // contents for the second section
section * extraLoginTypes
        // contents for these sections

The description is line-based, with spaces at the beginning of lines to give structure. The description is a list of sections - these define the NSTableView's sections. Within each section a there can be:

  • an optional header or headertext
  • a body
  • an optional footer or footertext

The header or footer describe a view to use, whereas headertext and footertext just give text. With header and footer, the height is optional, in which case the view's header and footer heights are used.

ALTableViewDescription

header StrikingHeader (56)
    $.title <~ "My Descriptions"
    $.subTitle <~ "are read often"
footer StrikingFooter
    $.viewWithTag(1).text <~ 'By \\(count) people'

Inside the body the list of items/cells within the section should be listed. Each item/cell and supplementary view can have a number of ALBind bindings.

A section or item/cell can be single, or multiplied by the contents of an array or number:

ALTableViewDescription

section
    MyLoginPassword
section * contactsByFirstLetter
    ContactView * 5

When multiplying by an array or number, one section or item/cell is created for each member or value. The value for each section or item/cell is available as @ in the bindings, and $ is the item/cell:

ALTableViewDescription

section
    AddressBookEntry * addresses |sort{@.surname < $.surname}
        $.itemFromAddressBook <~ @

The items and supplementary views are nibs, classes or the prototype cells in the storyboard.

What's New in Version 1.2.0 4th Oct. 2018

Support using supplementary views for section headers & footers

Version 1.1.0 18th Sept. 2018

Use ALMultiDelegate to improve inter-working with client applications
Add headertext and footertext for sections

Version 1.0.1 11th Sept. 2018

Stop translating thrown exceptions into assert(false)'s when inserting table rows

Version 1.0.0 17th July 2018

Bump version to show ready-for-use.

Version 0.0.4 20th March 2018

Adjust SDK versions back for increased compatibility.

Version 0.0.3 23rd Feb. 2018

Ensure correct FAP adjustments have been applied.

Version 0.0.2 14th Nov. 2017

Update framework versions used.

Version 0.0.1 2nd Nov. 2017

Change Deployment Targets back to iOS 8.0.

Version 0.0.0 16th Oct. 2017

Initial version