Let’s start with iOS:
- 3D Touch & Apple Pencil Events
- WatchOS2 Swift Template
- ListView Insertion Control & Drag Events
- Tab Icon Insets
- Updating User Activities
- Small but not forgotten
- Renamed APIs
The last remaining new UI component added in this release is Ti.UI.iOS.MenuPopup which implements UIMenuController. In TextFields and TextAreas these popup automatically with edit options like cut, copy, paste etc. Alloy support is under way, so open the menupopup.js controller to see how we instantiate and configure this menu to show with any view.
3D Touch & Apple Pencil Events
We’ve added new events to the touch*,
dblclick events for use with 3D Touch and Apple Pencil. Playback the above video to see how the touch.xml view allows you to try them out with some nice visual feedback using
WatchOS2 Swift Template
When you add an WatchOS2 extension to your Titanium iOS app using
appc create you will now get a Swift template. The Objective-C template is still available by using
appc create -t applewatch --template watchos2-objc. We’ve also cleaned up the template to include nothing more than Xcode does, except for some icons and an example of how to initiate a Watch Connectivity Session.
The sample comes with the default WatchOS2 extension and the watchos.js controller lets you confirm the Watch Connectivity Session has been established.
ListView Insertion Control & Drag Events
As the video demonstrates, you can now enable the Insertion control just like you could already enable the Deletion control. Identical to delete, you will need to listen to the (undocumented)
insert event to do the actual insert as demonstrated in the listview.js controller.
There’s two more new events. Like TableView and ScrollView, ListView now also has
dragend events. The sample demonstrates both.
Tab Icon Insets
If you don’t give your tab a title, the icon would still show at the same place to line up with other tabs that might still have a title. You can now set insets to shift the icon:
Updating User Activities
Finally, we need to talk about
Ti.App.iOS.UserActivity. Originally we modelled this very close to the iOS API. To update an activity you would do set its
needsSave property to
true and then wait for the
useractivitywillsave event to do the actual update. We’ve now simplified this. You’ll make the changes right away and then set the
needsSave property to inform iOS, as demonstrated in index.js.
Small but not forgotten
But let’s not forget that with Titanium 5.2.0 for iOS you can also:
- Set the color of the uncompleted track of an
- Set the backgroundColor of
Ti.UI.iPad.Popoverso that its arrow can match the backgroundColor of the ContentView.
- Prevent a
Ti.UI.iOS.NavigationWindowto be closed by swiping form the left edge of the screen.
- Use a
Ti.Contacts.Personfor the icon of
Ti.UI.iOS.ApplicationShortcutsto display their photo or initials.
- Listen to the scroll-event of a
Ti.UI.ScrollViewto get the
contentSize, just like with a TableView.
- Use two new keyboard-types and a a new Continue return key type in TextFields and TextAreas.
We’ve also deprecated and renamed some APIs to improve the consistency of our APIs. The old will be removed in Titanium 6.0.
Code Strong ?