Does Swift support this? Til now my understanding is that reflection only works with public members. Is it possible to get private/static members of a type?
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
I have the following in my .zshrc:
export MY_LIBRARY_DIR=~/bin
In Xcode I can set header/lib search path using something like $(MY_LIBRARY_DIR)/abc.
This works fine in my daily used user account. But today I found that this technique does not work in a test user account (for testing purpose only).
I even reboot my machine but still can't get it working.
Am I missing something very obvious???
BTW, I am using Xcode 14.2 and 14.3.1.
I have a need to optimize reading strategy, based on if the file is on hard disk or SSD. Does macOS provide any low-level API so that I can query such information?
After upgrading to Xcode 15.1 on Sonoma, I get a very weird problem in an on-going project.
This source file has no syntax coloring. No matter how I try "Open As->Source Code" it just won't work. All other files (sources/resources) work fine.
Is this a known bug? Is there any way to get syntax coloring back?
My code is crashing Xcode (or even macOS kernel) during debugging - Xcode just vanishes from screen!
// pseudo code
public func hunt(in directory: URL) {
let fileIterator = fileMan.enumerator(at: directory)
// collect app packages into a list
var packages = [URL]()
for case let fileURL as URL in fileIterator {
if fileURL.pathExtension == "app" { packages.append(fileURL) }
}
// FileWrappers
var wrappers = [FileWrappers]()
for packageURL in packages {
//!!! The line below eventually crashes Xcode (or even macOS kernel once)!
wrappers[packageURL] = try? FileWrapper(url: packageURL, options: .immediate)
// NOTE: I need FileWrapper.matchesContents later in some code
}
}
// unit test case
func test() {}
myObj.hunt(in: URL(fileURLWithPath: "/Applications"))
}
I suspect that the FileWrapper constructor is traversing directories and encounter cyclic symbolic links and eventually it crashes; since it's running at system runtime level, most probably it also crashes macOS kernel!
So my question is that is there any way to detect cyclic symbolic links so that I can design my own logics similar to FileWrapper?
Is there any way to get an unnamed property of a tuple given its position?
Like below:
let record = ("field1", "field2")
func getRecordFieldValue(at: Int, of record: (String, String)) -> Any? {
// pseudo code
record.[at]
}
I have used URL like "macappstore://itunes.apple.com/app/idxxx" in my apps for several years.
Just curious to know if there is any update from this URL scheme? I believe iTunes is not app specific any more (or I am wrong).
Topic:
App Store Distribution & Marketing
SubTopic:
App Store Connect
Tags:
App Store
App Store Connect
Is it possible that I bypass tableView.makeView so that I can create a NSTableCellView on the fly (based on some logics)?
func tableView(_ tableView: NSTableView, viewFor tableColumn: NSTableColumn?, row: Int) -> NSView? {
if NSTableColumn.identifier.rawValue == "labelColumn" {
let myCellView = NSTableCellView()
myCellView.textField.strinValue = "label text"
return myCellView
} else {
let complexView = loadFromNib() // of NSTableCellView
// populate complexView
return complexView
}
}
I calculate cell view's width in func tableView(_ tableView: NSTableView, sizeToFitWidthOfColumn column: Int). I have a need to resize the tableview's width to just match total width of all cell views' (without scrollbars).
But it seems changing tableview's width does not work:
tableView.bounds.size = CGSize(width: w, height: tableView.bounds.height)
I suspect that I should change its clipping view or enclosing scrollview, but don't have any idea on this.
Any help?
I tried many ways but it seems I just cannot get it working.
// AppDelegate
func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool {
true // false does not work either
}
// MainWC
func windowShouldClose(_ sender: NSWindow) -> Bool {
print(#function)
if sender === NSApp.mainWindow {
print("is main window")
sender.setIsVisible(false)
return false
}
return true
}
Once I hide the main window (using setIsVisible or orderOut) the app quits; even if I return false from applicationShouldTerminateAfterLastWindowClosed, NSApp.mainWindow will become nil.
I have an uncommon scenario here.
outer tableview
+--------------------------+
| column 1| inner tableview|
+--------------------------+
Now most often the out tableview has many rows and vertical scrollbar visible.
When user try to scroll vertically in the inner tableview but it has no vertical scrollbar (because it has only a few items), I want the scroll event sink into its parent view or better outer tableview, so that user does not have to move cursor to first column in outer tableview and scrolls.
Is this possible?
I am no expert at coordinate systems. I am kind of aware I can use its enclosingScrollView but don't know the details.
Any suggestions would be appreciated.
I accidentally removed the Fixed Width preset item in the font panel (by dragging it out).
Is there any way to get it back?
Does "natural scrolling" system preference affect NSEvent.scrollingDeltaY?
BTW, I find that "natural scrolling" on my Sonoma (Mac mini m1) stops working; turning on/off has no effect when I scroll in Finder app.
Does Swift/objc provide builtin support for reading/writing xcstrings, like PropertyListEncoder/PropertyListDecoder?