Is there any way to keep an NSWindow always on top of other windows (inside an app)?
I want to create a "preview" window for pictures and videos with it not taking up space in the main window.
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
Instruments reveals that the following simple code leaks memory on each delegate invoke:
- (void)start {
[_urlSession dataTaskWithURL:_url];
}
- (void)URLSession:(NSURLSession *)session dataTask:(NSURLSessionDataTask *)dataTask didReceiveData:(NSData *)data {
[_data appendData:data];
}
I don't have any clue on this leak, it should not happen. What should I do to avoid this?
Is there any way to tell if the user clicked X button in windowWillClose delegate method?
- (void)windowWillClose:(NSNotification *)notification
I need to create timers in another thread (not on main):
@implementation AppDelegate {
NSThread* _worker;
}
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
_worker = [[NSThread alloc] initWithTarget:self selector:@selector(main) object:nil];
[_worker start];
}
- (void)main {
[NSTimer scheduledTimerWithTimeInterval:1
target:self
selector:@selector(timer_tick:)
userInfo:nil
repeats:YES];
[NSThread sleepForTimeInterval:INFINITY];
NSLog(@"**********************");
}
- (void)timer_tick:(NSTimer*)timer {
NSLog(@"%@", NSThread.currentThread);
}
The timer never gets fired. What's wrong with my code?
In XCTestCase, I write data to a file "/tmp/somefile", but the file does not exist in /tmp when I do ls in Terminal.
Where is the file actually created?
NSDate* now = [NSDate date];
// How get midnight time of now?
I don't know when/why my assistant editor opened on bottom. I don't have any idea how to get it back to its original position (on right side). It's annoying.
It seems I can declare variables like below in a source file:
private let var1 = 1234
fileprivate let var2 = "abcd"
class MyClass {
// ...
}
So what's the difference between the 2 vars here?
I came across a useful repo on GitHub:
https://github.com/GianniCarlo/DirectoryWatcher/blob/master/Sources/DirectoryWatcher/DirectoryWatcher.swift
self.queue = DispatchQueue.global()
self.source = DispatchSource.makeFileSystemObjectSource(fileDescriptor: descriptor, eventMask: .write, queue: self.queue)
self.source?.setEventHandler {
[weak self] in
self?.directoryDidChange()
}
self.source?.setCancelHandler() {
close(descriptor)
}
self.source?.resume()
How do I translate this to OC version? I have an app that was written in OC and I plan to incorporate this directory watcher into the project.
I have a weird problem with Xcode v15.4.
For some unknown reasons, it sometimes becomes a zombie process - I cannot even quit it using CMD+Q, nor can I close open projects. I have to forcibly kill the process using Activity Monitor.
The problem will mostly strike after a long time of idle time (hours or even days).
Does anyone else have this same problem? Is there known workaround?
BTW, when it becomes a zombie process, another related com.apple.dt.SKAgent process will begin consuming much CPU time forever.
After upgrading to Xcode 16.3, whenever I open the Documentation window, Xcode started CPU hungry mode, forever.
Does anyone else have the same experience as me? Is there any known remedy so far?
Topic:
Developer Tools & Services
SubTopic:
Xcode
For an initial launch of Xcode, the GatherProvisioningInputs usually takes 60 seconds for a simple project. Subsequent build is fast though.
But the build process seems got stuck at VeryModule of the MyFramework target, which usually takes 15 seconds.
I currently do not want to upgrade to macOS 26, but I still want to install the latest Xcode. Is it required to install macOS 26 if I were to get Xcode 26?
Topic:
Developer Tools & Services
SubTopic:
Xcode
My app observes NSWorkspaceActiveSpaceDidChangeNotification and set wallpaper on the active screen. But I see there is no way to distinguish between spaces on a screen. I'm not sure if I have read the docs thoroughly. I would like to know if it is possible to tell which space is active for the active screen.
I'm not sure what I have missed in the new release, but I cannot set Standard Value in IB anymore like that I did for years.
The Standard Value is disabled in constraint dropdown list. If I clear the hardcoded value, "Standard" will appear but when I press ENTER, the old value comes back.
Is this a known bug or a new 'feature'?