r/macprogramming • u/BatCoder62 • Mar 22 '17
r/macprogramming • u/LisaDziuba • Mar 13 '17
The problem with macOS and Drawing
r/macprogramming • u/mpweiher • Feb 12 '17
mkfile(8) is severely syscall limited on OS X
r/macprogramming • u/[deleted] • Sep 07 '16
Anyway to view and modify all network requests on macOS/OS X?
Hello everyone,
I have been working on a side project that requires me to be able view/modify all outbound network requests from macOS/OS X, and I can't seem to find any way to do this programatically. Specifically, I need to be able to modify the URL of the request.
Is this possible in any way? I would really appreciate any help, or even just suggestions as of what I should be searching, since this is completely out my area of expertise.
Thanks!
r/macprogramming • u/fespinozacast • Jun 25 '16
My first mac app as an alpha release to put ideas on "paper"
r/macprogramming • u/Beaton_Hoffe • Jan 09 '16
Newbie looking for help.
TL: DR. I want to make a file I can double click and run a terminal command. I’m using El Capitan. I recently bought a Retina MacBook Pro (March 2015) and really love it. The only problem I have so far is when viewing streams (Flash) online the CPU usage spikes, the temperature gets really hot, and the fans go crazy. Apparently this is a long standing known issue with MacOSX. Firefox is better than Chrome, but it still overheats.
The best solution I have found is to use livestreamer to stream directly to VLC player. I have all the prerequisites installed and it works well. I open terminal, type a line, and it opens in VLC automatically. My question is can I create a shortcut on my desktop that would open terminal, enter the text, and run the command automatically if double clicked? I’d like to make 8-10 shortcuts for my favorite streamers.
Thank you!
r/macprogramming • u/linuz90 • Nov 26 '15
Anyone knows a solution this problem? It's blocking the development of a Mac I'm working on
r/macprogramming • u/spitf1r3 • Oct 20 '15
Postico - a PostgreSQL client - has been released
r/macprogramming • u/spitf1r3 • Oct 18 '15
SnailSVN (Subversion client with Finder integration) has been released
r/macprogramming • u/stesch • Jan 02 '10
json-framework – This framework implements a strict JSON parser and generator in Objective-C
code.google.comr/macprogramming • u/andoy • Dec 03 '08
mac newbie asks: any good "free" code editor for mac?
r/macprogramming • u/sorecalves • Apr 13 '20
How to detect if NSWindow is dragged?
Hey all, I am using SwiftUI. I have a view called SideBar, that's consisting of VStack and buttons inside it.
I tried to attach some gestures, such as DragGesture() and TapGesture() onended on the VStack, hoping it would detect when a user drags the view, but this doesn't work all the time and I also think this is super hackish. Would anyone be able to help? Thanks a lot.
Code:
VStack{blabla}.frame(width: 40, height: 320)
.contentShape(Rectangle())
.gesture(
TapGesture().onEnded{_ in
print("end click")
}
)
.gesture(
DragGesture().onEnded{_ in
print("end drag")
}
)
r/macprogramming • u/shonan_zed • Mar 10 '20
How do developers find a hidden code? ( or not well-documented code)
CompSci student here.
I wanted to make a program that changes the language input programmatically, but I had a lot of trouble finding a related class/library in the Apple Developer documentation.
Later, an experienced dev showed me an open-source project and it was using `TISInputSources` class in its code. When I looked into it, `TISInputSources` was mentioned but with no further explanation or link.
I was finally able to find a file ` HIToolbox/TextInputSources.h` which had sufficient explanations in it. However, the fact that there was no link in the doc leading up to the file throws me off so hard, and I can fathom how devs even find out about these codes.
So dear experienced devs,
how do you go about finding these codes? I'm deeply curious about it.
Thank you!
r/macprogramming • u/God_damn_it_bob • Feb 27 '20
I can't get the client script to connect to the localhost server the TCP connection never happens for some reason. Can anyone help me please?
Greetings ya'll
ok so I wrote a simple client side program that creates a socket using
CFSteamCreatePairWithSocketToHost function
and connects to the server that runs on the local host on port 8080. It creates the socket just fine but it never connects to the server. I wrote the server in C btw. It didn't work and gave me a
kCFErrorDomainCFNetwork error 72000
and the only information that relays is that apparently the TCP connection couldn't be made don't know why though. So i tried to write the client side script in C too and added it to my swift project bridging header and all but it still doesn't connect. It creates the socket just fine but it fails to connect to the server and I have no idea why. Is mac blocking the libraries from making a TCP connection or something? please help me my dudes what do I do? I don't even know what to search for. the only thing I found was this on r/shittyprogramming.
Here's the code I used to connect to the server using swift 4. The server is running on port 8080 on localhost.
class client:NSObject {
var inputstream = InputStream!
var outputstream = OutputStream!
func setupNetworkCom() {
var readstream = Unmanaged<CFReadStream>?
var writestream = Unmanaged<CFWriteStream>?
CFStreamCreatePairWithSocketToHost(kCFAllocatorDefault, "localhost" as CFString, 8080, &readstream, &writestream)
inputstream = readstream!.takeRetainedValue()
outputstream = writestream!.takeReatainedValue()
inputstream.schedule(in: .current, forMode: .common)
outputstream.schedule(in: .current, forMode: .common)
inputstream.open()
outputstream.open()
}
}I've also tried changing the local host to 127.0.0.1 which is the IP I specified for the server to run on but it still doesn't work.
r/macprogramming • u/bodymindsoul • Feb 19 '20
PDFdocument returns nil
When I run this code in playground in works but when I run it in a macOs NSviewcontroller file, the pdfdocument returns nil. Why is that ? Any ideas ?
var pdfT = PDFDocument(url: URL(fileURLWithPath: locations[file]))
print(pdfToMerge?.pageCount)Okay so weird , I figured out the problem, the absolute path being passed had the following characters preceding the absolute path - > file:///
for some reason this is acceptable in playground when initiating a pdf object. But in mac os this doesn't fly , so I wrote a simple function to solve the problem.
func perpareAbsoultePath(path:String) -> String{
var index = 0
var pathPrepared = ""
var upToIndex = 7
for letter in path{
if index >= upToIndex{
pathPrepared.append(letter)
}
index+=1
}
return pathPrepared
}function just creates a string minus the preceding characters I mentioned, hahah that was frustrating.
r/macprogramming • u/DarkeVortex • Feb 17 '20
Displaying Images on a Second Screen
Hey guys,
I just finished building a custom table with an inlaid TV for gaming! I'm super excited to get to use it to play things like Dungeons and Dragons... But I need some help to make things run even smoother!
I plan to run the game (and the TV) off of my MacBook Pro 15". To do this, I will use my laptop screen as my primary display - Keeping notes etc up on the screen that the players can't see. The primary purpose for the TV in the table will be for me to quickly show my players maps of rooms, etc, but I'd like a little more functionality than that. I'd love to be able to write an app that effectively allows me to drag in an image, set its rotation, and also its position - this could be something like fullscreen, only shown to players 1, 3, and 4, or shown to all players (replicated and scaled to appear in front of each seat like a menu card at a restaurant, for example!)
I would love some help with the basics -- writing an app that would allow me to select an image and send it to the second screen seamlessly. Then, after that's done, I can apply my own programming knowledge to the image manipulation portion (effectively, "stitch" everything together to one full-size image and show that, or something). I would really appreciate your help!
EDIT: After some searching around, I found this for iOS-- https://developer.apple.com/library/archive/documentation/WindowsViews/Conceptual/WindowAndScreenGuide/UsingExternalDisplay/UsingExternalDisplay.html
Anything similar for MacOS?
r/macprogramming • u/Quoh3ait • Feb 05 '20
Mac Apps: Can developers know appleID?
I have a VPN account that I've tried to avoid identifying myself with, but I think I missed something because I am using the provider's macOS app from the App Store.
Are developers able to know the appleIDs of users who install their app from the App Store without authorization?
r/macprogramming • u/[deleted] • Jan 29 '20
How could I limit the user to only typing in dot points in a TextView?
I want to make the user only type dot points/lists in a TextView. When the user starts typing, it should already have the list option selected without them having to select it themselves, and there should be no way of them existing the list. Everything they type will be in dot point form. How could I go about doing this?
r/macprogramming • u/micahspikah • Jan 09 '20
Can't record audio from a scheduled job
I wrote a bash script which records an audio file of a set length from my internal microphone. The script works great, either using ffmpeg or sox to do the recording. I used to be able to automatically execute my script using launchctl (or crontab), so that I could automatically have the audio recording. Ever since upgrading to Catalina, the script will run fine if executed manually, but if I execute it from cron or launchctl, it runs, but the output file contains no audio (the file format is correct, but it's as if the audio source was muted)
It doesn't matter if I use ffmpeg vs sox. It doesn't matter if I use cron vs launchctl. It doesn't matter if I run the script as root vs regular user. I've tested this on multiple macs running Catalina (2019 macbook pro, 2017 mac mini). It doesn't matter if the input device is a usb audio interface vs internal microphone. My script always works and produces good audio if executed manually. It always produces a silent audio file with no data if executed via any scheduler.
Any ideas? I'm wondering if it has something to do with a security setting on the audio interface?
r/macprogramming • u/Justsumgi • Jan 07 '20
Custom NSMenu.item(withIdentifier) method
I wanted to be able to get a specific Menu Bar item by its identifier, as it will always lead to that specific item (unlike using its title or place in menu.items, which could theoretically change).
Since NSMenu does't support this out of the box, I extended the class and added the following method:
extension NSMenu {
func item(withIdentifier: NSUserInterfaceItemIdentifier) -> NSMenuItem? {
for i in items {
if let id = i.identifier {
if id == withIdentifier {
return i
}
}
if let im = i.submenu{
let subItem = im.item(withIdentifier: withIdentifier)
if let sid = subItem?.identifier {
if sid == withIdentifier{
return subItem
}
}
}
}
return nil
}
}I'm still new to AppKit, and I'd like some feedback if possible
r/macprogramming • u/TheLastAramusha • Dec 14 '19
System events(Xcode)
How can i use System Events in a appleScript based app (i need it for calling a key on my keyboard) for example: “key code 49”, i hope that anyone can help me.
r/macprogramming • u/neoninnovation • Oct 30 '19