Every now and then there’s a post (on Stack Overflow, Delphi Praxis, Facebook etc) asking about developing cross-platform (usually specifically mobile) apps with Delphi, for example the “current state” of the product and whether there’s anything they should be aware of. This article details some of the things to be aware of when choosing Delphi.
Why Delphi? (aka the “Pluses”)
This part of the topic has probably been “done to death”, so I’ll just summarize the main points:
- Cross-platform support for macOS, iOS, Android, Windows and Linux
- Implementation of functionality using a number of frameworks is done for you
- Compiles to native code
- Single source
- The timeliness of support of platform changes is improving, over time
The 2nd point needs a little expansion:
In Delphi, in the RTL and FMX, Embarcadero has made a monumental effort to implement functionality that developers using Android Studio and Xcode (for example) would have to implement themselves, or find third party code that does it. For example (and these are just a few):
- TLocationSensor (and other sensor components)
Also bear in mind that many implementations are done for all platforms. Admittedly, they’re not perfect (is anything?), however this saves developers many, many hours in development time, and some tend to take this for granted.
For most developers, what is provided in Delphi out of the box most of the time is close to meeting their demands for cross-platform development.
Things to consider (aka the “Pitfalls”)
As I indicated above, the cross-platform implementations are not “perfect”, and there may be times when they need “tweaking”. Occasionally I will blog about a tweak, or I will publish code in the Kastri library, that fulfils the need. Other good sources for finding tweaks etc are on StackOverflow, Delphi Praxis, the Delphi Developer Facebook group, and Embarcadero’s Quality Portal.
Implementing frameworks or functionality that is not included in Delphi
There may also be times when you want to use a particular framework or functionality that is not implemented in Delphi. There may be an implementation done for you in Kastri, on Grijjy, in Loki’s Alcinoe project, or other sources. If there is yet to be an implementation for Delphi, perhaps you might seek my services? I have a Slack workspace that you can invite yourself to, so you can ask!
Implementing functionality that is yet to be possible in Delphi
A particular example of something that is yet to be possible in Delphi is implementation of descendants of Java classes. In some cases it is required that you to create a descendant of a particular class and override one or more of its methods, then pass an instance of that descendant to the method of a class that uses it. I’ll leave the discussion of how this can be done for another article, and/or you can leave a comment if you are curious.
Another example is the use of iOS app extensions. There is a way of using iOS app extensions from Delphi, however currently the extension itself must be developed in Objective-C using Xcode. If this takes your interest, there are articles here and here that cover the subject.
iOS simulator support
In the past, Delphi had support for compiling for iOS simulator. When Apple changed to having only 64-bit versions of the simulator, this all changed. There are plans to re-introduce simulator support in Delphi.
As indicated above, for most developers, pretty much all of their needs are catered for when developing cross-platform for Delphi. They can take comfort in the fact that Embarcadero are committed to expand the development of Delphi, and that there’s a thriving community to support them also. Developers are proving time and time again that Delphi is still an excellent choice. Here are some references that may help encourage you about what you can do with Delphi (particularly for mobile):
PushIt (also my own app) one you can modify yourself if you wish
Idle Western game
Travel app design (Indonesian)
Camera surveillance app (from 6 years ago!)
These are just a few mobile apps built with Delphi.. A more definitive list is being compiled that I’ll share in the future.