Titanium News #19
Tags: titaniumsdk, mobile, javascript, news
Published: 2024-07-11 15:15:41

<small>Older posts can be found [here](https://dev.to/miga).</small>

# Intro
It's `Titanium News` time again! This time we will look at 12.3.1.GA, 12.4.0.RC, module updates and how to use ChatGPT to create Titanium iOS modules.

# Titanium 12.3.1.GA
The latest GA release 12.3.1 was published in June and fixed some issues that people reported with 12.3.0. The main part was related to Apples new privacy requirements in case you are using filesystem APIs like `createdAt()` or `modifiedAt()`. Support for iOS multi-scene apps has been removed for now as it introduced some issues for normal apps. It will be revised in future releases.
On the Android side you can now use `switchCamera` again when your app is not using `useCameraX` and `touchFeedbackColor` is fixed for BottomNavigation tabs.
One new features is also included: You can use platform dependend `<id>` blocks in your tiapp.xml now:
```xml
<id platform="android">com.miga.test_android</id>
<id>com.miga.test</id>
```
We all have an app where you had to switch ids and now you can have it in one tiapp.xml file!


# Titanium 12.4.0.RC

A first test version of Titanium 12.4.0 was released this week. Since Google updated their store requirement a bit early you have to target Android API level 34 for new apps now. You can always update the level by hand by adding this to your tiapp.xml:
```xml
<android>
    <manifest>
        <uses-sdk android:targetSdkVersion="34"/>
    </manifest>
</android>
```
but in case you are using `BroadcastReceiver` in your app you have to update to 12.4.0.RC as it required a code change. So in case you see this error `One of RECEIVER_EXPORTED or RECEIVER_NOT_EXPORTED should be specified when a receiver isn't being registered exclusively for system broadcasts` when your build your app for targetSdkVersion 34 you have to update the Titanium SDK.

But 12.4.0 doesn't just include that change, it also has some nice new features and bug fixes.
* add swipe actions support for Ti.UI.TableView ([video](https://github.com/tidev/titanium-sdk/pull/14065))
* Android: add moveToBackground method
* Android: option to hide scrollbars in a WebView
* Android: missing Event.remove() method was added
* Android: parity for OptionBar color properties
![optionbar](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/psn9xuv5avfhifk8d0qj.png)

* Android: track colors in a Switch
![switch](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3onxi1vx4ak561syzfpw.png)

* Android: text alignment for date pickers
![datepicker](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/k31br3wbgfg815ppxdb1.png)
* Android: video playback speed
* Android: `defaultLang` option in tiapp.xml (in case you run an app that doesn't have EN as the first language)
* iOS: iOS 17 symbol effects ([video](https://github.com/tidev/titanium-sdk/pull/13982))
* iOS: backgroundColor for RefreshControl

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3t7c9m8a9yg4c8q3v1p6.png)
* iOS: overrideUserInterfaceStyle a Picker



# Preview
The task list for the next big Titanium release will include iOS 18 support and Android API level 34 by default. There are still plenty of pull requests in the queue https://github.com/tidev/titanium-sdk/pulls like "flatten ListView layout" for Android that improves the performance in complex template setups and bigger changes like the upgrade to gradle 8. 
If you find bugs or need a feature feel free to create an issue at https://github.com/tidev/titanium-sdk/issues so Titanium developers can look at it.

# Modules
Module developers have been busy updating their modules and creating some new ones. Here is a quick list of some of those:

* Review dialog: the Android version has been updated to use the latest play store library. Make sure to get the latest version from https://github.com/hansemannn/titanium-review-dialog/
* in-app update: same for the Android in-app update module. Go to https://github.com/m1ga/ti.inappupdate and grab the latest version with the latest play store libraries.
* Titanium QR Code generator & scanner: a new iOS version with a cancel button is available at https://github.com/hansemannn/titanium-qrcode
* Screen Recording detector: a new iOS module by [Max87ZA](https://github.com/Max87ZA/) that detects when you do a screen recording on iOS. This was created with help of ChatGPT-o! Check it out at https://github.com/Max87ZA/Ti.ScreenRecordingDetector
* Social Share: another new iOS module for native text and image sharing by [emptybox](https://github.com/emptybox/). Download it from https://github.com/emptybox/SocialShareEBM
* in-app-purchasing: [Hans](https://github.com/hansemannn) updated his in-app payment Android module https://github.com/hansemannn/titanium-iap/ to use the latest play billing API 7.0.0
* ti.animation: The Android Lottie library of https://github.com/m1ga/ti.animation was updated.
* PurgeTSS: @maccesar made a big update v6.3.3 for his PurgeTSS library. Make sure to look at https://purgetss.com/ for all the changes and update with `npm install -g purgetss@latest`. 

I'm sure I've missed some :) So feel free to leave a comment for new modules, updates or if you'll need some module updates.

# Spotlight
## Using ChatGPT to create a custom iOS module. 
Multiple Titanium users are leveraging ChatGPT to support them in building apps and modules. As mentioned in the last Titanium News there is also a Titanium ChatGPT copilot at https://chat.openai.com/g/g-ZNwI6zmBi-titanium-copilot.
The following are the prompts that were used to create the Social share module:

> Creating a module for Titanium (Appcelerator) to share an image via text, email, Instagram, Facebook, or save to the local gallery requires several steps. Below is a detailed guide and sample code for creating an iOS module compatible with the latest version of Xcode and Swift.

To get basic instructions to setup a new module, the first code and compile instructions.

> what do I name the new swift file I'm creating and where should it be placed?

Returned detailed instructions where you have to place the files in your directory and what to put in each file.
Even switching to Objectiv-C with

> If I want to use obj-c what would the code look like?

was answered right away with new code.
Even errors like

> I'm having issues with this: - (void)share:(id)args; - I'm getting the following errors: expected ';' at end of declaration list. Expected member name or ';' after declaration specifiers. Type name requires a specifier or qualifier 

or 
> at UIImage I'm getting this error: Definition of 'TiBlob' must be imported from module 'TitaniumKit.TiBlob' before it is required

were fixed with the results by ChatGPT.

Sometimes it will return old `appc ti` commands but it's easy to use `ti` instead.

Have a look at the full conversation at https://www.fromzerotoapp.com/create-a-titanium-ios-module-with-chatgpt/

If you create some new module leave a comment and I'll feature it next time.

# That's it

If you have feedback or some interesting Titanium SDK apps, modules or widgets you would like to share: get in contact with me or leave a comment and I'll add it to the next `Titanium news`.