Access NSProgressIndicator outside of NSTableViewDelegate method

140 views Asked by At

Within one of my tableview delegate's methods I programmatically create and add to the superview an NSProgressIndicator

func tableView(tableView: NSTableView, viewForTableColumn tableColumn: NSTableColumn?, row: Int) -> NSView? {
    let mainview = NSTableCellView(frame: NSRect(x: 0, y: 0, width: tableView.frame.width, height: 48))

    //PROGRESS INDICATOR
    let progAsset = NSProgressIndicator(frame: NSRect(x: 32, y: 0, width: tableView.frame.width - 32, height: 20))
        progAsset.indeterminate = false
        progAsset.wantsLayer = true
        progAsset.layer!.hidden = false
        progAsset.layerUsesCoreImageFilters = true
        progAsset.identifier = "\(val)"

    mainview.addSubview(progAsset)
    progAsset.incrementBy(progRatio)

    return mainview
}

I have been searching for a while in an attempt to find the most efficient method of accessing progAsset in a completely different method but to no avail.

Any advice on how to access this object in a different method would be greatly appreciated.

PS. The tableView I use will be refreshed at many points during the applications runtime using the table's reloadData() method.

0

There are 0 answers