Skip to content

Instantly share code, notes, and snippets.

@malcommac
Created April 22, 2018 14:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save malcommac/e3390a7ab0b5d94f26720af5c14fa8d4 to your computer and use it in GitHub Desktop.
Save malcommac/e3390a7ab0b5d94f26720af5c14fa8d4 to your computer and use it in GitHub Desktop.
// Register adapter to show contacts
let contactsAdapter = TableAdapter<Contact,ContactCell>()
manager.register(contactsAdapter)
contactsAdapter.on.dequeue { ctx in
ctx.cell?.fullNameLabel.text = (ctx.model.firstName + " " + ctx.model.lastName)
}
let groupsAdapter = TableAdapter<ContactGroup,GroupCell>()
manager.register(contactsAdapter)
contactsAdapter.on.dequeue { ctx in
ctx.cell?.groupLabel.text = ctx.model.name
}
let groupSection = TableSection(header: "GROUPS", items: groupModelsArray)
let peopleSection = TableSection(header: "PEOPLE", items: peopleModelsArray)
manager.addSections([groupSection,peopleSection])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment