[Lazarus] OSX 64 bit Cocoa + Catalina Installer

Anthony Walter sysrpl at gmail.com
Tue Oct 15 18:45:27 CEST 2019


What I've done is created a reference counted class hierarchy to match part
of the Cocoa framework. It's only partially done, but it allows Pascal code
to be written to simplify interaction with native OSX frameworks and APIs
like AppKit in the following ways:

Using NSWindow class as an example:

* TNSWindow mirrors NSWindow and uses an automatic reference counting
scheme to automatically release objects when they are are no longer needed.

* All methods and properties of NSWindow are provided by TNSWindow and
there is no need to pass native objects as handles to functions. It's
implicit in Self and the underlying handle is manged by TNSWindow ->
TNSResponder -> TNSObject  -> and ultimately TFrameworkObject.

* It uses an object oriented hierarchy the same as the Apple frameworks,
only translated to Pascal objects. That is you can pass a derived class to
methods of other object methods which may expect any less specific class.

* Other classes such as CGContext (TCGContext -> TFrameworkObject) are
provided as well as other Apple frameworks classes, all translated to
Pascal classes with all the same benefits as outlined above.

My implementation isn't complete, which is to say I haven't wrapped every
single Apple framework class in the manner described above. For the
extremely limited amount of translations I did complete, I saw a big
benefit in my own personal projects on OSX. Most notably the way of
organizing code I outlined above allowed me to much more easily understand
how to use Apple's frameworks, reduce errors with type safety and automatic
object lifetime management, as well as aid in the discovery when combining
Apple framework object to accomplish programming tasks. I expect if this
were integrated into the Cocoa widgetset it would make development a bit
easier. Certainly there is a lot of work involved in defining every Apple
framework object in this way, but it provides a certain level of
organization and usability that I at least feel makes a big difference when
working with native Apple APIs.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20191015/fed505c0/attachment-0001.html>

More information about the lazarus mailing list