# iOS API 2.0 changes

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.

## API 2.0

Names of events, properties and methods updated

## Data types

`String</api/data_types/string>`, `Variant</api/data_types/variant>`, `DateTime</api/data_types/datetime>`, `Pair</api/language/pair>`, `Dictionary</api/language/dictionary>` (see notes on this page)

## Mobile UI classes

- `iOSCountdownPicker</api/ios/ioscountdownpicker>`
- `MobileButton</api/user_interface/mobile/mobilebutton>`
- `MobileCanvas</api/user_interface/mobile/mobilecanvas>`
- `MobileContainer</api/user_interface/mobile/mobilecontainer>`
- `MobileDateTimePicker</api/user_interface/mobile/mobiledatetimepicker>`
- `MobileHTMLViewer</api/user_interface/mobile/mobilehtmlviewer>`
- `MobileImagePicker</api/user_interface/mobile/mobileimagepicker>`
- `MobileImageViewer</api/user_interface/mobile/mobileimageviewer>`
- `MobileLabel</api/user_interface/mobile/mobilelabel>`
- `MobileLocation</api/mobile/mobilelocation>`
- `MobileMapViewer</api/user_interface/mobile/mobilemapviewer>`
- `MobileMessageBox</api/user_interface/mobile/mobilemessagebox>`
- `MobileMotion</api/mobile/mobilemotion>`
- `MobileMoviePlayer</api/user_interface/mobile/mobilemovieplayer>`
- `MobileOval</api/user_interface/mobile/mobileoval>`
- `MobilePopupMessage</api/user_interface/mobile/mobilepopupmessage>`
- `MobileProgressBar</api/user_interface/mobile/mobileprogressbar>`
- `MobileProgressWheel</api/user_interface/mobile/mobileprogresswheel>`
- `MobileRectangle</api/user_interface/mobile/mobilerectangle>`
- `MobileScrollableArea</api/user_interface/mobile/mobilescrollablearea>`
- `MobileSegment</api/user_interface/mobile/mobilesegment>`
- `MobileSegmentedButton</api/user_interface/mobile/mobilesegmentedbutton>`
- `MobileSeparator</api/user_interface/mobile/mobileseparator>`
- `MobileSharingPanel</api/user_interface/mobile/mobilesharingpanel>`
- `MobileSlider</api/user_interface/mobile/mobileslider>`
- `MobileSwitch</api/user_interface/mobile/mobileswitch>`
- `MobileTextArea</api/user_interface/mobile/mobiletextarea>`
- `MobileTextField</api/user_interface/mobile/mobiletextfield>`
- `MobileToolbar</api/user_interface/mobile/mobiletoolbar>`
- `MobileToolbarButton</api/user_interface/mobile/mobiletoolbarbutton>`
- `iOSMobileTable</api/ios/iosmobiletable>`
- `iOSMobileTableRowAction</api/ios/iosmobiletablerowaction>`
- `MobileTableCustomCell</api/user_interface/mobile/mobiletablecustomcell>`
- `MobileTableCellData</api/user_interface/mobile/mobiletablecelldata>`
- `iOSMobileTableDataSource</api/ios/iosmobiletabledatasource>`
- `iOSMobileTableDataSourceReordering</api/ios/iosmobiletabledatasourcereordering>`
- `iOSMobileTableDataSourceEditing</api/ios/iosmobiletabledatasourceediting>`
- `PointerEvent</api/user_interface/mobile/pointerevent>`

## <span class="title-ref">MobileScreen</span>

- `MobileScreen</api/user_interface/mobile/mobilescreen>`
- `Show<mobilescreen.show>`(parent As MobileScreen = Nil)
- `ShowModal<mobilescreen.showmodal>`(parent As MobileScreen, style As ModalPresentationStyles = ModalPresentationStyles.Automatic, animate As Boolean = True)
- `TabBarVisible<mobilescreen.tabbarvisible>` As `Boolean</api/data_types/boolean>`

## <span class="title-ref">MobileApplication</span>

- `MobileApplication</api/mobile/mobileapplication>` - IconBadgeNumber, AddShortcutItem, HandleShortcutItem, HandleURL

## More UI-related changes

- `MobileUIControl</api/user_interface/mobile/mobileuicontrol>` - SetFocus(), ClearFocus()
- `iOSTabBar.BadgeAt()<iostabbar.badgeat>`
- `iOSSplitView.DisplayMode<iossplitview.displaymode>` and DisplayModes enum

## Framework

- `XMLDocument</api/text/xml/xmldocument>` and related classes
- `RegEx</api/text/regular_expressions/regex>` and related classes

## <span class="title-ref">Database</span>

- `SQLiteDatabase</api/databases/sqlitedatabase>` - iOS references
- `RowSet</api/databases/rowset>`
- `DatabaseColumn</api/databases/databasecolumn>`
- `DatabaseRow</api/databases/databaserow>`
- `Database</api/databases/database>`
- `DatabaseException</api/exceptions/databaseexception>`

## Global methods

- `System.GotoURL<system.gotourl>`
- `System.Speak<system.speak>`
- `Clipboard</api/user_interface/clipboard>`

## Networking

- `URLConnection</api/networking/urlconnection>`
- `TCPSocket</api/networking/tcpsocket>`
- `SSLSocket</api/networking/sslsocket>`
- `UDPSocket</api/networking/udpsocket>`
- `Datagram</api/networking/datagram>`
- Internet Encoding
- `EncodeBase64</api/text/encoding_text/encodebase64>`, `DecodeBase64</api/text/encoding_text/decodebase64>` methods

## <span class="title-ref">System</span>

- `System.Device<system.device>`
- `Random</api/math/random>`

## <span class="title-ref">Graphics</span>

- `Graphics</api/graphics/graphics>` Methods - RestoreState, SaveState, Translate, ClipToPath, ClipToRectangle
- `GraphicsPath</api/graphics/graphicspath>`
- `Picture</api/graphics/picture>`
- Brushes

## <span class="title-ref">Files</span>

- `FolderItem</api/files/folderitem>`
- `SpecialFolder</api/files/specialfolder>`
- `TextInputStream</api/files/textinputstream>` - iOS references
- `TextOutputStream</api/files/textoutputstream>` - iOS references
- `BinaryStream</api/files/binarystream>`
- `Readable</api/files/readable>`, `Writeable</api/files/writeable>` interfaces

## <span class="title-ref">Encodings</span>

- `TextEncoding</api/text/encoding_text/textencoding>`
- `Encodings</api/text/encoding_text/encodings>` module

## Miscellaneous

- `EndOfLine</api/text/endofline>`
- `MemoryBlock</api/language/memoryblock>`
- `Bitwise</api/language/bitwise>`
- `WeakRef</api/language/weakref>`
- `Font</api/graphics/font>`
- `Sound</api/os/sound>`
- `Timer</api/language/timer>`
- Plugin support for non-UI controls

## 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</api/mobile/mobileapplication>`.
- The Supers on iPhoneScreen and iPadScreen from iOSScreen to `iOSLayout</api/ios/ioslayout>`.
- The Supers of your Views from iOSView to `MobileScreen</api/user_interface/mobile/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 `` MobileScreen</api/user_interface/mobile/mobilescreen>`s you need to switch to using :doc:`MobileToolbarButton</api/user_interface/mobile/mobiletoolbarbutton> ``.

## Deprecations

- Most iOS\* classes
- Xojo namespaces and their members
