WWDC 2017 Day 2 was eventful for the development community. If you had missed the updates of the first day, check them out here. Cocoa Touch, the UI framework for building software programs which can run on iOS, watchOS, and tvOS, got a whole new set of features making it one of the best frameworks available for developing apps.
Some of the important upgrades and new features in Cocoa Touch are:
- Drag and drop API– We can pick up items, and drag it around, and we can tap to add additional items. All of it while the system is fully responsive and active, even allowing us to drag data between applications. What’s even better is that Apple would be giving about four sessions to the developers to brief them about a few key components of this API. For using it, you only have to create a UI drag interaction which is basically a new subclass of UI interaction and attach it to the view where you need this functionality. Similar to Gesture Recognizer, a UI interaction needs a delegate to be set on it, attached to a view, and the system takes care of everything else. Pretty easy, right? Thank Apple. The UIDragInteractionDelegate protocol gives the developers a lot of opportunities to customize the drags. After providing the data for the item to be dragged, the developers can customize lift animation and preview. After drag is defined, we define drop. Drop has to be defined to the superview instead of individual views. The UIDropInteractionDelegate protocol gives you a whole new set of opportunities to be creative. It allows you to update UI as the drag moves, and to receive data on drop, and also to customize drop animation. Additionally, it has built-in support for TableView, CollectionView, TextView, TextField, WebView and many other existing features. It can be easily integrated with UIPasteConfiguration.
- File Management– The latest update allows for easier access of not only locally accessible documents but also the ones on the cloud. It uses a class called the UIDocumentBrowserViewController which handles this API. It is highly customizable, and it can coordinate file access using NSFile Coordinator as well as UIDocument.
- UI Refinements– We see a lot of UI refinements in the latest Cocoa Touch, the most visible being a larger title. But wouldn’t that give lesser space for content? Apple took care of that too. The search bar collapses, followed by the title which now shifts to the a smaller navigation bar with smaller text size so that maximum space is available for content. Pull to refresh feature is automatically included in the view. UI ScrollView now comes with a lot more features to have the perfect UI and response. It automatically takes care of much of the functionalities you had to define previously. UI TableViews now have a new unified swipe delete feature just like the one you’ve used in mail app, as well as a lot of other features which make the UI more appealing and interactive.
- New APIs for Swift and Foundation– We can now archive swift native types. Foundation has also added support for archiving to JSON and property lists. Another great addition is the new KeyPath type with literal syntax, and getters and setters, instead of hardcoding strings. A new block based KVO makes your code shorter and more optimised, yay! We can also save the edges from system responses so that we have an uninterrupted experience while using the apps. The interaction between AutoLayout and ScrollViews has also been improved. Dynamic Type has also seen some improvements ensuring a better overall experience for the users.
- Asset Catalogs– One of the best new features is that when the system detects a username and password, the candidate bar shows a key icon. Upon clicking the key icon, we get a list of all saved usernames and passwords which allows us to choose the username and password we want without typing it all out. Asset Catalogs now come with the feature to make named colors. Asset Catalogs would now have wide gamut color support, wide gamut colors for icons, as well as the feature of app thinning for icons. It also comes with PDF-backed images. There is support for variable screen refresh rates too.
We hope this information is useful to you. Let us know what you think about it in the comments section below. Don’t forget to share it if you felt someone you know could benefit from this knowledge.