This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class MyOutlineDelegate: NSObject, NSOutlineViewDelegate { | |
| //The cell we'll use for calculating sizes, should be the same cell used in the outline | |
| lazy var sizingCell: MyCell = { | |
| let cell = MyCell(frame: .zero) | |
| cell.translatesAutoresizingMaskIntoConstraints = false | |
| return cell | |
| }() | |
| lazy var sizingCellWidthAnchor: NSLayoutConstraint = { | |
| return self.sizingCell.widthAnchor.constraint(equalToConstant: 1000) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // tl;dr: FileManager.default.url(for:in:appropriateFor:create:) has unexpected behavior in Simulator and creates temporary folders outside the tmp/ directory. | |
| let tmpDirClassic = NSTemporaryDirectory() | |
| print("tmpDirClassic: \(tmpDirClassic)") | |
| // This is the same code, just syntax sugar for NSTemporaryDirectory() | |
| // https://github.com/apple/swift-corelibs-foundation/blob/master/Foundation/FileManager.swift#L1420-L1422 | |
| let tmpDirClassicNewShim = FileManager.default.temporaryDirectory | |
| print("tmpDirClassicNewShim: \(tmpDirClassicNewShim)") | |
| // Simulator: /Users/steipete/Library/Developer/CoreSimulator/Devices/31C05637-B9C9-482C-A6CE-D063A7CECF64/data/Containers/Data/Application/A68D11A4-88BA-4FCF-A8B1-D102945D0740/tmp/ |