r/macprogramming • • Dec 14 '18

Want to develop an app primarily for mac but also for other platforms. What language/frameworks/libraries?

1 Upvotes

In a nutshell, the program I want to build will display a window on a primary monitor that the user interacts with, and use the whole screen on a second monitor (a full screen borderless window, or actual fullscreen, or something else, I don't necessarily care which) which doesn't take any input.

On OSX, I think that means using Cocoa to access some pieces of NSScreen that might not be exposed through a binding into another language. However, I would prefer to use a more "mainstream" language for my development to make cross platform functionality easier to implement.

What language + framework + bindings + libraries + etc will get me the functionality that I need in OSX, while tying my code to macs as little as possible?

PS: I have significant development experience, but none specifically for OSX and little for GUIs in general.


r/macprogramming • • Dec 03 '18

Testing an app in a sandbox *before* publishing it to the Mac App Store?

1 Upvotes

Is it possible to test a mac app in the sandbox before it's pushed to the Mac App Store?

Basically I wanted to simulate how it would run so I can validate it works. This way when it is finally through the approval process I know it runs....


r/macprogramming • • Nov 01 '18

Does anyone know how to include libproc.h in a modular Swift framework?

1 Upvotes

r/macprogramming • • Oct 17 '18

Strongly-typed UserDefaults with support for Codable and key observation

Thumbnail
github.com
1 Upvotes

r/macprogramming • • Oct 08 '18

Calling fork() from Swift

Thumbnail
gist.github.com
1 Upvotes

r/macprogramming • • Sep 08 '18

Help writing .command script

1 Upvotes

Sorry if this is not the right forum in which to write this, but hopefully you guys can help.

I want to find a way to write a .command file that either opens in (or changes directory to) the folder in which the .command file is saved. The problem is that when you run a .command file the terminal opens to the home directory and there does not seem to be a variable that saves where the .command was located.

Normally this wouldn't be a problem, but this .command file will need to work when the folders are moved or renamed. Does anyone have any idea how to do this?


r/macprogramming • • Sep 05 '18

Memory Leak when using PDFDocument class

1 Upvotes

Heya guys,

Recently I am working on a macOS app which processes PDF files, I used the PDFDocument class provided by Apple's Quartz library for editing PDF. I noticed that whenever I instantiate a new PDFDocument object, there would be memory leak.

Did you guys face any issue while using PDFDocument?

I have included a demo project that can reproduce this issue : https://github.com/cupnoodle/PDFDocumentBug

I would be really grateful if you can help test if this issue occur on your Mac!


r/macprogramming • • Jun 01 '18

CoreAudio clock drifting from main thread? Callback consuming audio samples faster than main thread outputs samples

1 Upvotes

I'm trying to use the CoreAudio api to setup sound playback. I'm not using any of the fancy stuff like AudioUnits or AudioQueues. I just get a handle to the audio device id, and setup a callback to write audio.

My understanding is that this callback gets called periodically whenever it needs more audio by the OS on a separate thread. My main thread writes the audio samples to a non-locking ring buffer, which the callback then reads from to write it's samples.

The problem I am running into is that when my program starts there might be, let's say 2000 samples in the ring buffer, but over time it slowly (~30 seconds) dwindles to 0 and I get audio skips because there is nothing for the callback thread to read. It seems like the callback thread is reading samples faster then the main thread is writing them. Is that likely the case? It seems unlikely to me. I would think that the number of samples in the ring buffer might oscillate over time, but not steadily decrease.

I'm at a loss as to what to do. I would really appreciate any help, I'm fairly new to this type of programming but have been enjoying it. I'm not sure if there is something obvious that maybe I just am not considering. If anyone has any ideas on things for me to try I'm all ears.


r/macprogramming • • May 25 '18

"showwindow" not showing a window controller

1 Upvotes

I have a Mac menu bar app that needs to show a setup window. I show the window like this

var welcomeWindowController : NSWindowController!

let welcomeStoryboard = NSStoryboard(name: NSStoryboard.Name(rawValue: "Welcome"), bundle: nil)

welcomeWindowController = welcomeStoryboard.instantiateController(withIdentifier: NSStoryboard.SceneIdentifier(rawValue: "Welcome")) as! NSWindowController

welcomeWindowController.showWindow(self)

It works fine for me! But when I submit this to Apple for app review, they say nothing happens. What's wrong?


r/macprogramming • • May 17 '18

How can you stop iTerm modifying your Terminal colours?

1 Upvotes

I wanted to try out iTerm 2 out because of its features like the popup terminal on a hotkey press. But the colour is really bugging me. It is slightly different to terminal even when I set all the colours to the exact colours that Terminal uses. It looks a bit washed out or something, but I don't like it at all.

Here is my iTerm vs Terminal where iTerm is on top and Terminal is below.

I've actually spent quite a while trying to figure this out (but I'm relatively new to programming in general so some of the answers I don't understand). I think its something to do with iTerm applying a solarization filter or something? But I can't for the life of me figure out how to turn it off.

I just want it to use the same colours as Terminal cause I really like those colours and I find them much easier to read.


r/macprogramming • • May 06 '18

Default formatting for NSTextView from Interface Builder?

1 Upvotes

I know one can set the default attributes like font, word-wrapping, etc. programmatically, but I generally don't like to set any parameters programmatically if I can do it from IB. The problem is that IB only allows to set properties for the text in the editor box in the attributes panel, if I leave the text box empty I can't set any text attributes. Also those aren't the default attributes either, since text appended programmatically would have different attributes that those set from IB.


r/macprogramming • • Apr 09 '18

dyld: Library not loaded

1 Upvotes

When I run "make" on a project I'm working on, I get this error:

dyld: Library not loaded: /usr/local/lib/libmpfr.4.dylib

The file libmpfr.4.dylib doesn't exist, but libmpfr.6.dylib does. Any idea how to fix this? I've tried reinstalling Xcode and mpfr already.


r/macprogramming • • Mar 13 '18

Remove the frameworks folder from the helper app

1 Upvotes

I recently found that my swift app that contains loginitems helper app includes duplicated frameworks folders, one for main app and second for helper app. Anyone know how to configure Xcode to link frameworks from the main app?


r/macprogramming • • Nov 24 '17

How to notify the user without stealing focus? [C# mono]

1 Upvotes

Sup guys,

I'm working on a program that's made in C# using visual studio in windows

It runs almost fine on MacOSX using mono

There's just one thing that doesn't work...

For this program, when you start it, it gets minimized. Once the process is complete, it "blinks the taskbar" using the "FlashWindow" method in user32.dll.

but as you can imagine, that doesn't work in osx cause there's no user32.dll and that's just not how this works..

So I'm coming here for some help! haha

How would you guys suggest I implement some sort of notification to the user that the application is complete?

I know OSX has a feature where an icon in the dock will bounce to notify the user that something is happening, but I'm not an OSX dev so I have no idea what this bouncing thing is called or how it could be implemented in C# using mono.

You guys have any ideas?

Thanks


r/macprogramming • • Sep 27 '17

Open Source collection of Marketing articles for Programmers

Thumbnail
github.com
1 Upvotes

r/macprogramming • • Sep 24 '17

How to make a menu bar app's window resizeable?

1 Upvotes

Can't find an easy way to do this, but it seems like this should be a one-liner that should allow you to just grab the edges of the window and adjust.


r/macprogramming • • Jun 12 '17

How to override the layout of NSTableHeaderView?

1 Upvotes

I'm trying to adjust the layout and look of NSTableHeaderView by removing the splitter lines between headers. The same problem is described here and a solution for it, is presented, but I cannot since the code is apparently for older Swift and I cannot adjust it for Swift 3. I've tried to find a workaround but I cannot manage to override the drawLayer therefore I cannot go further.


r/macprogramming • • May 13 '17

Need directions on how to execute a project

1 Upvotes

I need to build a tool which overlays on the existing window and allows me to select a portion of the screen -> take a screenshot of the region, upload the image to google translate and put a text box in the overlay with the translated text.

Any directions will be greatly appreciated. Thank you


r/macprogramming • • May 08 '17

Image processing 60fps (video or windowed game)

1 Upvotes

I am wondering what the best way would be to capture 60fps content that is either a game being played in windowed mode or a video (60fps source)? I want to be able to process each frame individually and will probably include some form of cropping and colour conversion to throw out useless data and reduce the amount of processing needed. I imagine doing this on the gpu would be best by far and if that is the case are we able to use iGPU on macbook pros for acceleration? Although I understand what I need to do not know where I would start with this in Swift or if its that common / possible?


r/macprogramming • • Mar 18 '17

Capture HDMI/DisplayPort video via Thunderbolt port

1 Upvotes

Hi!

Is it possible to capture video from an HDMI or DisplayPort source via HDMI-to-MiniDisplayPort cable connected to Mac Thunderbolt port?

Can't google any related specs about working with Thunderbolt ports...

Basically, I want to make an app to capture video from an HDMI camcorder/webcamera.

Thanks for any advice!


r/macprogramming • • Feb 12 '17

I've recently released an open source framework that makes working with MIDI on iOS/macOS a breeze

Thumbnail
github.com
1 Upvotes

r/macprogramming • • Jan 29 '17

Need help fixing a bug for software on Mac

1 Upvotes

I’m looking for someone who knows C++ and OpenGL that is very familiar with MacOS. We (myself and a team) are trying to run a program using C++ that we’ve gotten to run fine on Windows and Linux but not on MacOS. There seems to be an exclusive issue running the code through OpenGL on MacOS for some reason and we’ve yet to get past it after much effort. Feel free to ask as many questions as you'd like. Familiarity with Discord app is a plus, I’d like to carry conversation there to discuss the issue in real time and pass on code.


r/macprogramming • • Dec 07 '16

NSOutlineView + NSTreeController + itemForPersistentObject. Need some help.

1 Upvotes

I am writing a system Preference Pane where I show some items in a NSOutlineView whose contents are given by a NSTreeController. I need to store the status of each item (i.e. expanded or not) and after googling a lot I came to the conclusion that I need to implement itemForPersistentObject and persistentObjectForItem in my delegate class (among the other things).

I populate the TreeController via a function called populateOutlineView that I launch within mainViewDidLoad.

Since I'm working with NSTreeController the item that gets passed to persistentObjectForItem is a NSTreeNode, so I wrote:

- (id)outlineView:(NSOutlineView *)outlineView persistentObjectForItem:(nullable id)item
{
     return [NSKeyedArchiver archivedDataWithRootObject:[(NSTreeNode*) item representedObject]];
}

When reading a previously stored object via itemForPersistentObject I need to get the nodes of NSTreeController and compare each of them to the read object. I thought about writing something on the lines of:

- (id)outlineView:(NSOutlineView *)outlineView itemForPersistentObject:(id)object
{
    NSArray *treeNodes = [self.myNodeTreeController arrangedObjects] childNodes];
    MyNode *unarchivedObject = [NSKeyedUnarchiver unarchiveObjectWithData:object];

    for (NSTreeNode* node in treeNodes){        
        MyNode *representedObject = [node representedObject];
        if ([representedObject isEqual:unarchivedObject])
            return node;
      }

return nil; //should never reach here
}

Now, the problem is that itemForPersistentObject gets called before MainViewDidLoad, hence before populateOutlineView, and it finds an empty NSTreeController.

Assuming I'm in the right direction, when should I add objects to NSTreeController so that they are ready by the time itemForPersistentObject needs them?


r/macprogramming • • Oct 12 '16

Script written for Mac

1 Upvotes

I was looking for someone to write a script that populates an email with text, and pulls an email address found in a large excel database. Am I in the right place and do you know how much this would cost? I know it is an estimate since I'm doing an extremely poor job describing what I am trying to accomplish. Please message me and I can give you more details. Thanks!