Latest 0.1.5
Homepage https://github.com/GDXRepo/OSXTableKit
License MIT
Platforms osx 10.10, requires ARC
Authors

Swift 4.2 compatible
CocoaPods compatible
Platform OS XLicense: MIT

NSTableView wrapper for managing single-column tables. Supports macOS 10.10 or above.

Inspired by https://github.com/maxsokolov/TableKit/

Overview

This library helps you to manage iOS-like tables in code. No XIBs, no storyboards, no pain. Pure code only. Simple example of creating table:

...
tableView.backgroundColor = .darkGray
let director = TableDirector(with: tableView)
director.clear()
let sections = [ // some sections with rows arrays inside
    [0, 1, 2, 3].map { "Row ($0)" },
    [0, 1, 2, 3, 4, 5].map { "Row ($0)" },
    [0, 1].map { "Row ($0)" }
]
// fill the table
for (i, item) in sections.enumerated() {
    let view = SampleTableHeaderView()
    view.title = "Section (i)"
    let section = TableSection(headerView: view)
    for subitem in item {
        section += TableRow<SampleTableCell>(with: subitem).on(.click) {
            print("clicked ($0.cell!)")
        }
    }
    director += section
}
director.reload()

Installation

Can be installed via CocoaPods (or by manual dragging source code files to your project, of course).

CocoaPods

OSXTableKit is available through CocoaPods. To install it simply add the following line to your Podfile:

pod 'OSXTableKit'

then run in Terminal the following command:

$ pod install

Discussion

Pros

  • Displays single-column iOS-like style table view.
  • Supports non-fixed sections.
  • Strictly typed table sections, rows and actions. Completely safe table structure coding.
  • Automatic sections and rows height calculation.

What’s not supported?

  • Fixed sections.
  • Sections with empty headers. Workaround: create a view with height equal to 1 with background color equal to table view’s background color.
  • Multiple columns like macOS native table views.
  • For now supports only click, select and deselect table actions. Other actions may be added later.

License

MIT

Latest podspec

{
    "name": "OSXTableKit",
    "version": "0.1.5",
    "summary": "NSTableView wrapper for managing iOS-like tables on OS X and macOS.",
    "homepage": "https://github.com/GDXRepo/OSXTableKit",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "Georgiy Malyukov": "[email protected]"
    },
    "source": {
        "git": "https://github.com/GDXRepo/OSXTableKit.git",
        "tag": "0.1.5"
    },
    "social_media_url": "https://habr.com/ru/users/gdxrepo/",
    "platforms": {
        "osx": "10.10"
    },
    "swift_version": "5.0",
    "requires_arc": true,
    "source_files": "OSXTableKit/Pod/Classes/**/*"
}

Pin It on Pinterest

Share This