Archive<< June 2019 >>
- TMS WEB Core v1.2 tips & tricks part 7: Get Base64 encoding for images
- TMS WEB Core v1.2 tips & tricks part 6: Exploring new TWebDBGrid features
- TMS WEB Core v1.2 tips & tricks part 5: Accessing microphone and camera
- Something I forgot to say about TMS XData 4.5 regarding URL endpoints
- TMS WEB Core v1.2 tips & tricks part 3 : Handling multiple forms with TApplication
- TMS XData 4.5: Parameter Binding and SwaggerUI
- TMS WEB Core v1.2 first tips and tricks : working with local files
- TMS WEB Core v1.2 Padua is released. Going to Ferrara now!
- TMS WEB Core v1.2 tips & tricks part 4: Display another form as a pop-up
- TMS WEB Core v1.2 tips & tricks part 2 : file access from Electron apps
- Adrian Gallero (20)
- Bart Holvoet (1)
- Bernard Roussely (1)
- Bruno Fierens (221)
- Gjalt Vanhauwaert (1)
- Holger Flick (12)
- Marcos Douglas B. Santos (5)
- Masiha Zemarai (11)
- Nancy Lescouhier (32)
- Pieter Scheldeman (14)
- Roman Yankovsky (1)
- Tunde Keller (3)
- Wagner R. Landgraf (61)
Most Recent Post | Index List
Thursday, February 06, 2014On the road, we carry a smartphone, in a couch we grab the tablet and in the office we sit behind the desk and use a desktop computer. In all scenarios though, we want to use applications that give us access to the same data and functions. Therefore, it is also logical that when we change our parameters for access to this data and functions via the desktop machine application, these same parameters and settings will be reflected (automatically) when we use the smartphone or tablet specific application and vice versa. In the Apple world, the answer to this scenario is persisting our parameters / settings on the iCloud.
As a Delphi developer, we typically like it when we can persist this information with a minimum amount of code so we can focus on the business logic instead of all technical complexities of using the iCloud. Delivering this promise, we've now released two new non-visual components: TTMSFMXNativeiCloud and TTMSFMXNativeMaciCloud. With these components, putting key/value pairs on the iCloud and retrieving them becomes as simple as using a method
to create a key/value pair and using the property:
procedure AddKey(AKeyName: String; AKeyValue: TValue);
to get and set the value of the key.
property KeyValues[AKeyName: String]: TValue
So, when in one application, the user would change a setting, this can be done with:
Thanks to the magic of the iCloud and these non-visual components, the key/value pairs will now automagically be synchronised between applications on different devices coupled to the same iCloud account. If the app wants to react immediately to iCloud pushed value changes, the event TTMSFMXNativeiCloud.OnKeyUpdate is triggered and can be handled like:
var FName: strring; FName := 'TMS'; TMSFMXNativeiCloud.KeyValues['MyAmount'] := 1234; TMSFMXNativeiCloud.KeyValues['MyName'] := FName;
Note that the value is of the type TValue and supports strings, booleans, integers, double and a TMemoryStream. Of course, the component offers several more options like deleting a key/value pair, programmatically forcing a synchronisation of the values on the iCloud, receiving events when iCloud pushed updates to values etc...
procedure TMSFMXNativeiCloud.KeyUpdate(Sender: TObject; AKeyName: String; APreviousValue, ACurrentValue: TValue); begin if (AKeyName = 'MyName') then FName := ACurrentValue; end;
TTMSFMXNativeiCloud is available now in the newest TMS iCL update and TTMSFMXNativeMaciCloud is available now in the newest TMS mCL. A FireMonkey iOS demo in TMS iCL and a FireMonkey Mac OS-X demo in TMS mCL demonstrate this concept by having a customizable set of key/value pairs shared via the iCloud between these applications as shown in the screenshot above.
This blog post has not received any comments yet.
Most Recent Post | Index List