iOS API 2.0 Changes
From Xojo Documentation
2020 Release 2 adds API 2.0 support to iOS projects, plus a whole lot more.
On a high level, the String and Variant data types are now available for use to replace the now deprecated Text and Auto data types. There are many new controls and classes that have been added, which you can see in the list below.
Contents
API 2.0
Names of events, properties and methods updated
Data Types
String, Variant, DateTime, Pair, Dictionary (see notes on this page)
Mobile UI classes
iOSCountdownPicker, MobileButton, MobileCanvas, MobileContainer, MobileDateTimePicker, MobileHTMLViewer, MobileImagePicker, MobileImageViewer, MobileLabel, MobileLocation, MobileMapViewer, MobileMessageBox, MobileMotion, MobileMoviePlayer, MobileOval, MobilePopupMessage, MobileProgressBar, MobileProgressWheel, MobileRectangle, MobileScrollableArea, MobileSegment, MobileSegmentedButton, MobileSeparator, MobileSharingPanel, MobileSlider, MobileSwitch, MobileTextArea, MobileTextField, MobileToolbar, MobileToolbarButton, iOSMobileTable, iOSMobileTableRowAction, MobileTableCustomCell, MobileTableCellData, iOSMobileTableDataSource, iOSMobileTableDataSourceReordering, iOSMobileTableDataSourceEditing, PointerEvent
MobileScreen
- MobileScreen
- Show(parent As MobileScreen = Nil)
- ShowModal(parent As MobileScreen, style As ModalPresentationStyles = ModalPresentationStyles.Automatic, animate As Boolean = True)
- TabBarVisible As Boolean
MobileApplication
- MobileApplication - IconBadgeNumber, AddShortcutItem, HandleShortcutItem, HandleURL
More UI-Related Changes
- MobileUIControl - SetFocus(), ClearFocus()
- iOSTabBar.BadgeAt()
- iOSSplitView.DisplayMode and DisplayModes enum
Framework
- XMLDocument and related classes
- RegEx and related classes
Database
- SQLiteDatabase - iOS references
- RowSet
- DatabaseColumn
- DatabaseRow
- Database
- DatabaseException
Global Methods
Networking
- URLConnection
- TCPSocket
- SSLSocket
- UDPSocket
- Datagram
- Internet Encoding
- EncodeBase64, DecodeBase64 methods
System
Graphics
- Graphics Methods - RestoreState, SaveState, Translate, ClipToPath, ClipToRectangle
- GraphicsPath
- Picture
- Brushes
Files
- FolderItem
- SpecialFolder
- TextInputStream - iOS references
- TextOutputStream - iOS references
- BinaryStream
- Readable, Writeable interfaces
Encodings
- TextEncoding
- Encodings module
Miscellaneous
Notes
Your old projects should work with little or no changes. It is possible you will have to update some older code to be compatible with the above changes.
- If Use Simple References was turned on for your iOS project, you may get compiler errors as the compiler might confuse things from the Xojo namespaces with classes that are now available with the same name (such as Dictionary). Adding the fully qualified name when there is confusion (such as Xojo.Core.Dictionary) will resolve the compile error.
- You might also consider turning off Use Simple References and then manually add the necessary Using clauses to your project items as necessary.
- If you have your own extension methods that replicate functions now built into the framework, you'll need to remove them to avoid confusing the compiler.
To migrate existing projects to API 2.0, you will need to manually change the following:
- The Super on your App object from iOSApplication to MobileApplication.
- The Supers on iPhoneScreen and iPadScreen from iOSScreen to iOSLayout.
- The Supers of your Views from iOSView to MobileScreen.
- The Supers of controls on these MobileScreens from their iOS versions to their Mobile counterparts.
- Switch use of any Xojo namespace classes to their corresponding API 2.0 classes.
You can mix and match iOS controls and Mobile controls on the same views and screens, so you should not have to update everything all at once. In many cases you can continue using the older control and only switch to the newer control when you are ready.
- iOSToolButtons can only be on iOSViews. To put toolbar buttons on MobileScreens you need to switch to using MobileToolbarButton.
Deprecations
- Most iOS* classes
- Xojo namespaces and their members