News from the MBS Xojo Plugins Version 22.5
In this article I want to introduce you the new functionalities from the MBS Xojo Plugins in version 22.5.
Scan documents with iOS
Our new class VNDocumentCameraViewControllerMBS provides the ability to scan documents for iOS. The class shows a panel to allow the user to scan a document. You can call this panel with the Present method. If you have scanned the document successfully the event didFinishWithScan fires and gives us the scan result as an object of the class VNDocumentCameraScanMBS. In this object we can then, for example, query the number of pages, adjust the title of the document or handle the individual pages as a Picture. For example, you can generate a PDF from these pages.
If you like to scan an image or document with an application running on your Mac with an iOS device that has the same account and is logged in to the same network, the Continuity Camera topic is a good choice. In this release, the ContinuityCameraMBS class has two new events. The event Allow gives us the information whether to allow the control to receive data. In addition the new event Received is called when data is returned. This data is then available as a memory block from which it can be read.
MongoDB
MongoDB In release 22.3 we already introduced MongoDB to you. You can work with these functions on a MongoDB database. Normally every change in the database is applied as soon as it has been made. But this is not always advisable, e.g. when it comes to security relevant things where several records have to be changed. If in the middle the connection breaks we don't know in which state our database is, which records have been changed, which not. For this there are the so-called transactions, with which we can tell the database to make all changes at the same time. We have now implemented transactions for you in connections with MongoDB. For this we have added the new class MongoSessionMBS to the plugins. With this class you can start transaction sessions, then work on the database and finally decide whether you want to apply the changes in one go or whether they should be discarded.
JSON
In the JSONMBS class there is a new method for working with JSON Object items. With the new method AddOrReplaceItemToObject you can add an item specifying the key and the value in the parameters or change the value of an already existing item.
XML
Already in the last release we introduced the new topic XML in the MBS Xojo Plugins. Essential is the loading of an XML which can take time because of the size of the XML. With the new method LoadXmlMT from the class XMLDocumentMBS you now have the possibility to load XML files with primitive threads. The work is performed on a preemptive thread, so this function does not block the application and can yield time to other Xojo threads. It must be called in a Xojo thread to enjoy its benefits. If it is called in main thread it will block, but keep other background threads running. The XML data input options are MemoryBlock, String, and FolderItem.
Memory Block
For the MemoryBlock class we have added three new methods. The methods: BitwiseAndMBS, BitwiseOrMBS and BitwiseXOrMBS. The names already suggest that the methods are methods that operate bit by bit in memory blocks. In the methods we go through two memory blocks, look at them bit by bit and apply the according boolean operation. Finally we get a memory block as result. In the parameters of this function we first specify the second memory block. Optionally, we can now specify the destination memory block that stores our result. If this parameter is nil, a new memoryblock is created. You can speed up processing with reusing the same memoryblock in iterations.
Mobile Ads
We have some new classes in our MBS iOS Xojo Plugin with which you can use Google Ads in your Xojo iOS applications. Beside doing in-app purchases with our StoreKit classes, this is a second way for you to monetize your applications. For example, use the GADBannerViewMBS class to display a banner ad in your application and set the size of this ad using the GADAdSizeMBS class. This and much more is waiting for you in our new section Mobile Ads. Please have a look at our example AdMob test or try it out in your applications.
Photo Picker
In the iOS section there is an improvement in the image selection in your app. Until now you always had to use the UIImagePickerController class to use images from your photo library for your app. With the new version you now get the possibility to use the new PHPickerViewControllerMBS class for this task. This brings some advantages:
- Deferred image loading and recovery UI
- Reliable handling of large and complex assets, like RAW and panoramic images
- User-selectable assets that aren’t available for UIImagePickerController
- Configuration of the picker to display only Live Photos
- Availability of PHLivePhotoMBS objects without library access
- Stricter validations against invalid inputs
ProgressView
We have a whole new theme section in the MBS Xojo Plugins: ProgressView.
With the classes of this section we can display nice progress bar overlay for iOS applications.
This way you can customize the progress bar according to your wishes.
Be it the color of your progress bar or the background of your progessweel.
You can then display this indicator in your Costumized HUD using the ProgressHUDMBS class.
CallKit
We have also integrated another cool thing for iOS into the new release: CallKit. With the new class CXCallDirectoryManagerMBS we have a programmatic interface to an object that manages a Call Directory app extension. If you write a CallKit extension in XCode, you can use CXCallDirectoryManagerMBS class to manage it. This may include querying the status of the extension or to reload the data after an update.
Calendar
We have a new method calendarWithIdentifier in the class NSCalendarMBS with which you can create a new calendar specified with one of the new identifiers. So you can add many different worldwide used calendar formats to your calendar. For the different identifiers we have added different shared methods to the class. Here you can see a list of calendars that you can use from now on:
- Buddhist calendar
- Chinese calendar
- Republic of China calendar
- Coptic calendar
- Ethiopic (Amete Alem) calendar
- Ethiopic (Amete Mihret) calendar
- Gregorian calendar
- Hebrew calendar
- Indian calendar
- Islamic calendar
- Islamic civil calendar
- tabular Islamic calendar
- Islamic Umm al-Qura calendar
- Japanese calendar
- Persian calendar
- ISO8601 calendar
We also have two new methods PMSymbol and AMSymbol that give us the symbol for PM and AM.
Windows Bluetooth
For our MBS Xojo Plugins we add new class events and methods in our WindowsBluetoothLEDeviceMBS class for Windows. The new GetGattServicesCompleted event fires when the methods GetGattServicesForUuidAsync or GetGattServicesAsync are competed their work. The two methods are new in 22.5 too. The GetGattServicesAsync method queries available GATT services for the device. The GetGattServicesForUuidAsync method queries available GATT services for this device with given UUID. In addition, if necessary, you can specify in both methods whether the data should be in the cache or not. For cache mode, see CacheModeCached and CacheModeUncached constants in WindowsGattDeviceServiceMBS class.
We hope you will also find some interesting new features. We wish you a lot of fun with MBS Xojo Plugins version 22.5.
by Stefanie Juchmes