Quantcast
Channel: User Cykelero - Stack Overflow
Browsing index pages (29 articles)

Answer by Cykelero for Getting path to users Library folder in OS X

In Swift, you can also get this path as a URL directly:let currentUserHomeDirectoryURL = URL.homeDirectorylet janeHomeDirectoryURL = URL.homeDirectory(forUser: "jane")

View Article


Comment by Cykelero on filter:blur() is causing glitching in Safari

This also seems to fix the performance issue that occurs when translating an element that's got a filter: blur applied.

View Article


Comment by Cykelero on xcodebuild print errors only

This still outputs “note:” lines, annoyingly, but is already massively quieter than the default.

View Article

Comment by Cykelero on Why is async task cancelled in a refreshable Modifier...

Yeah, there's potential for that task to incorrectly update state when it shouldn't. (e.g. you trigger a refresh of a list, then the list's data source changes; the refresh finishes, and populates the...

View Article

Comment by Cykelero on SwiftUI Fetching data cancelled when refreshing a task

This question is similar to: Why is async task cancelled in a refreshable Modifier on a ScrollView (iOS 16). If you believe it’s different, please [edit] the question, make it clear how it’s different...

View Article


Answer by Cykelero for Convert String.Index to Int or Range to NSRange

You can directly convert between an Objective-C style integer offset, and a Swift string index:// Offset to indexlet string = "Test"let offset = 2let index = String.Index(utf16Offset: offset, in:...

View Article

Answer by Cykelero for How do I check if the shift key is currently being...

Look in NSEvent.modifierFlags:let shiftIsPressed = NSEvent.modifierFlags.contains(.shift)

View Article

Answer by Cykelero for macOS Mojave: Change app icon to match Dark/Light Mode

It seems like your best bet is to handle the icon change yourself: listen to appearance change notifications, and update the icon accordingly.To set the Dock icon:The easiest way is to assign a NSImage...

View Article


Answer by Cykelero for What is the difference between a spindump and a...

(This answer is based on limited personal experience: it's probably very incomplete)A spindump seems to contain much more information than a sample:A sample contains thread stack traces for the threads...

View Article


Answer by Cykelero for Swift Codable struct recursively containing itself as...

Here's Sweeper's Box class, reworked as a property wrapper, to make it even nicer to use:@propertyWrapperclass Boxed<Wrapped: Codable> { var wrappedValue: Wrapped init(wrappedValue: Wrapped) {...

View Article

Answer by Cykelero for In AutoLayout can you combine both horizontal and...

Riffing off of Shehata's answer, with different code formatting:NSLayoutConstraint.activate( ["H:|-0-[view]-0-|","V:|-0-[view]-0-|" ].flatMap { NSLayoutConstraint.constraints( withVisualFormat: $0,...

View Article

Answer by Cykelero for Why is accessing CustomStringConvertible’s description...

As a hint, a previous version of that same piece of documentation reads:Note: String(instance) will work for an instance of any type, returning its description if the instance happens to be...

View Article

Answer by Cykelero for How can I preview a Gist in GitHub?

As of November 2021, there is a preview tab when editing a Markdown Gist.The Gist's file extension has to be set to .md for the tab to be displayed.

View Article


Answer by Cykelero for Is there a way to view the undo stack?

You can print your undo manager's _undoStack private property:let undoStack = object_getIvar(undoManager, class_getInstanceVariable(UndoManager.self,...

View Article

Image may be NSFW.
Clik here to view.

How to hide the letters on a .numberPad keyboard?

By default, when using a .numberPad keyboard on iPhone, the number keys also feature letters at the bottom of each key.The letters are purely cosmetic, to help people with number input; but in my case...

View Article


Answer by Cykelero for tableView.selectRow has no effect when called within a...

In the specific case of a delete action, you can implement the tableView(tableView: cell: indexPath:) delegate method, and perform the selection there; make sure to check that the cell didn't simply...

View Article

tableView.selectRow has no effect when called within a UIContextualAction...

When calling selectRow(at:animated:scrollPosition:) inside a UIContextualAction callback, nothing changes: the specified row doesn't turn gray.Here's the simplest code I could write that exhibits the...

View Article


Answer by Cykelero for tableView.selectRow has no effect when called within a...

One makeshift way to have the selection operation succeed is to use a timer, in order to call selectRow() after the deletion animation is finished:override func tableView(_ tableView: UITableView,...

View Article

Comment by Cykelero on cocoa + context sensitive menu on NSTableView with...

In a nutshell: assign a delegate to your NSMenu, and implement a delegate method such as menuNeedsUpdate(_:). It'll allow you to set the menu's items to whatever you'd like, anytime the menu is shown....

View Article

Comment by Cykelero on Safari iPhone - How to detect zoom level and offset?

This seems to work, in macOS Safari, for computing the amount of Page Zoom (i.e. zooming in and out with ⌘+ and ⌘-). However, it seems to always return 1 in Firefox.

View Article
Browsing index pages (29 articles)


Latest Images