Replies: 2 comments
-
Sorry it take a while to get to this, but thanks for this perspective. Many of those points are actionable, so leaving this open until they're turned into issues. |
Beta Was this translation helpful? Give feedback.
0 replies
-
I think most of these have been addressed in the reboot. Closing this, but I'd love you to try the latest version and give more feedback! :D |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hey folks.
I've been using MacDriver for a couple days and it's been really fun (thanks for that). This is the first time I've ever done any Cocoa/ObjC, so it was a bit of a learning curve. After I understood how it works, it went great (except for, you know, Cocoa). :)
My use case was to write a little status bar app that pops up a webkit window. One of the things I want is to be able to dynamically draw the icon, and that's the part missing so far. But I think I'll get there eventually.
My process mostly involved adding a bit of functions all over the place on MacDriver (so far I have
11 files changed, 59 insertions(+), 3 deletions(-)
, plus a couple new files. I will publish the fork at some point), but I also had to create a sideextra.m
to include some things that I couldn't figure out how to do otherwise (for example, how to overloadacceptsFirstMouse
onWKWebView
to return true), which now I think maybe can be done with a macdriver Class.I wanted to share some mental notes I had while I was learning how to do things. They may not be particularly insightful, and may be very specific to me learning Objective-C while doing this, but I hope they can be useful as a "what a newcomer to MacDriver may encounter":
Being very noob on any objc bridging, it took me a while to realize that the
objc
package is where the magic happens and everything else is more or less simple as far as "calling objective-C" goes. Once I realized that the other libraries were mostly "API sugar", and that most things went around an opaqueobjc.Object
that sends messages, things went much smoother.the hardest part of the early process was to find some Objective-C (or Swift) code on StackOverflow and figure out how does this translates do MacDriver. Realistically, there are only a few of those patterns (setting values, getting values, delegation, subclassing, calling, etc), and I could see how a single document could explain 90% of the generic use cases.
It also took me a bit to figure the whole Class thing, and I'm not sure I understand it 100%. I get that it allows me to create classes and instances on ObjC. And that the use case is to do delegation. It allows for subclassing, but not protocols, is that it? Is it because protocols are superfluous? Is this just a fancy reflection on ObjC? Is it identical to creating an
.m
file with an@interface
? What are the limitations?Is there any way to do code blocks like for
NSImage imageWithSize:flipped:drawingHandler:
? Is there an alternative?There are two things I haven't figure out and I think they may be related: the first is memory management. I have no idea when I'm supposed to use
NSAutoreleasePool
or when things are supposed to "just work". Am I leaking memory like a crazy person? What can or can't be leaked? Related: retain/release. When should I use them? Why?The second is basic types. Things mostly "just work", except when they don't. Why sometimes I can do
Send('whatever:', true)
and sometimes I need to doSend('whatever:', core.False)
? Same for strings and numbers. Both on sending and returning values.Side note: being the first time I'm doing any Cocoa-related stuff: what the hell is that documentation? This feels like "job security by obfuscation". Completely unrelated things mess up with each other in very unexpected ways. I was having trouble using mouse over on WebView (it wouldn't work before the first click on the webview) and also the app was crashing when a popup would close. It all worked 100% fine once I changed the apps' activation policy and
applicationShouldTerminateAfterLastWindowClosed
(I kinda get how "popover is a window, the default policy is to close the app when there are no windows left", but how does this change webview first click hover?). Like WTF.Anyway, sorry for the long post. It's mostly a dump of things. But thanks for MacDriver. It really really helped. :)
Beta Was this translation helpful? Give feedback.
All reactions