I already filed a ticket before this posting.
https://feedbackassistant.apple.com/feedback/13633103
But I am not sure if it's publicly viewable.
Post
Replies
Boosts
Views
Activity
Great news for me and other individual developers!
Broadcom acquired VMware.com and now VMware Workstation Pro/Fusion Pro are free for personal use.
Yeah... I found it myself after 15 minutes of digging. It's right there under the "Assistant" menu item.
It's strange. When I tried again, I found the file in /tmp:
- (void)test {
NSError* error;
[@"abc123" writeToFile:@"/tmp/testfile" atomically:NO encoding:NSUTF8StringEncoding error:&error];
if (error) NSLog(@"%@", error);
}
Finally I have to re-invent the wheel to solve this mysterious memory leak which I cannot control without the wheel.
I am not sure if it is too bold to declare that NSData has serious problems with memory footprint, but...
After I devised my own memory management facility (a smart buffer class), the memory footprint drops drastically and stops growing continuously. This is observed for several days.
I also have the same question here.
Again, I found it myself.
override func windowDidLoad() {
super.windowDidLoad()
window?.level = .floating
}
I did much search on the web and found no answer. The only clue to my question is that I have use another "template" tableview that is identical to the inner tableview.
Finally I devised a working solution, I posted here for the purpose of helping others who may have the same/similar problem.
Note there is a little trick about calculating the actually row height - you have to include height of the template tableview's header view.
func tableView(_ tableView: NSTableView, heightOfRow row: Int) -> CGFloat {
if tableView is DetailsTableView { return tableView.rowHeight }
if let rowHeight = rowHeights[row] { return rowHeight }
let item = categorizedItems[row]
if sizingTableView == nil {
var objects: NSArray!
detailsNib!.instantiate(withOwner: nil, topLevelObjects: &objects)
for object in objects {
if let sizingCellView = object as? DetailsCellView {
sizingTableView = sizingCellView.tableView
sizingTableView.delegate = self
sizingTableView.dataSource = self
sizingTableView.isHidden = true
sizingTableView.enclosingScrollView?.setFrameSize(NSSize.zero)
self.view.addSubview(sizingTableView)
break
}
}
}
print("<", sizingTableView.bounds.height)
sizingTableView.row = row
sizingTableView.files = item.files
sizingTableView.reloadData()
print(">", sizingTableView.bounds.height)
var rowHeight = sizingTableView.bounds.height
+ (sizingTableView.headerView?.bounds.height ?? 0.0)
+ summaryTableView.intercellSpacing.height
rowHeights[row] = rowHeight
if rowHeight > MaxRowHeight {
let trailingHeight = (sizingTableView.bounds.height / Double(item.files.count)) * Double(TrailingRowCount)
if rowHeight - MaxRowHeight < trailingHeight {
// Try reserve height for some rows to let scrollbar look more natural.
rowHeight = max(0, MaxRowHeight - trailingHeight)
} else {
rowHeight = MaxRowHeight
}
}
return max(rowHeight, summaryTableView.rowHeight)
}
I found a solution myself, after days of researching and experiments.
It's related to another question "How tell if NSTableView is already displaying its last row entirely?".
// For the inner tableview's scrollview
class MyScrollView: NSScrollView {
var onScrollWheel: EventHandler!
override func scrollWheel(with event: NSEvent) {
super.scrollWheel(with: event)
// In onScrollWheel, determine if vertical scrollbar is hidden or at top/bottom,
// then delegate this event to the outer tableview:
// outerTableView.scrollWheel(with: event)
onScrollWheel?(event)
}
}
At last, I found the answer myself, again. The answer lies in NSScroller.floatValue which inherited from NSControl.
let shouldDelegate = {
if let scroller = scrollView.verticalScroller {
return scroller.isHidden || scroller.floatValue == 0 || scroller.floatValue == 1.0
}
return true
}()
Maybe my question is too general.
I have a need to calculate all width of an NSTableView. However, I found that total width of all columns is far less than NSTableView.bound.width:
let width = tableView.tableColumns.reduce(0) { ac, col in ac + col.width }
print(width, tableView.bounds.width)
This is true even I manually adjust last column so that it fills the gap between the column and tableview right border.
-----------| <- table right border
last column|
-----------|
So I assume NSTableColumn.width and NSView.bounds.width are using different units.
Ah, I found out why, though it's a little embarrassing...
After so many years, I realized that NSApp.mainWindow is dynamic - it can be any window that has the key focus!
I have to create a global variable to keep instance of the initial window (as designed in main storyboard).
var mainWindow: NSWindow? // Set in MainWC.windowDidLoad
class AnotherWC: NSWindowController, NSWindowDelegate {
override func windowDidLoad() {
super.windowDidLoad()
print(self.className, #function)
}
func windowShouldClose(_ sender: NSWindow) -> Bool {
print(self.className, #function)
return true
}
func windowWillClose(_ notification: Notification) {
print(self.className, #function)
print(mainWindow ?? "mainWindow is nil")
mainWindow?.orderFront(nil)
}
}
Please ignore my question. It should be always like this because I set "Host Application" to None in the unit test target.
I have found where the Web entry is. I have to enable CloudKit service in project settings. Now I have another problem - I accidentally created several database containers (long time ago out of curiosity by clicking a button that says "Enable ClouldKit" or something similar). But I cannot find a way to delete the garbage items. The only way is to hide them in the CloudKit management Web UI.
Anyway, I found out the cause.
The error is thrown when initializing XMLDocument with an empty string:
let xd = try XMLDocument(xmlString: "")