Monthly Archives: June 2016

Swift 3.0: Top 14 Features For iOS Developers

Earlier this month, the third major iteration of Apple’s Swift programming language was released. The first developer preview has been bundled in with Xcode 8.0 beta 1, and there are a fair number of new features and improvements in the latest version of the language (which is still, of course, under active development). Swift 3.0 is also the first update to be launched after the language became open source in December 2015. In the following discussion, we will do a roundup of the best new features in Swift 3.0 for iOS app developers:

  1. Moving to Swift 3.0 – First things first, coders have to migrate to the new Swift platform. To facilitate this, Xcode 8 has been provided with a smart Migration Assistant, which manages most of the API name changes (in Cocoa) at one go. Certain changes, however, have to be made manually – since all the Cocoa APIs need to have separate names for Swift and Objective-C. A minor update – Swift 2.3 – has also been included in Xcode 8, to make the the migration process smoother. Swift 2.3 supports all the new Xcode features and software development kits (SDKs), and developers can use it to submit apps (instead of Swift 3.0) in the stable release of Xcode 8 as well.
  2. More compact coding – The open-source Swift started to ‘omit needless words’, and Swift 3.0 takes significant further steps in that direction. Words that are self-evident and self-explanatory no longer have to be written (for instance, ‘attributedString.appendAttributedString(String 2)’ becomes ‘attributedString.append(String 2)’ and ‘let red = UIcolor.redcolor()’ has to be written as ‘let red =’). As a result of this, word repetitions in strings (in particular) can be minimized.
  3. Swift on Linux and Windows – There were enough hints about Swift coming to platforms other than Apple as soon as the language became open-source. The speculations have been more or less confirmed by Craig Federighi at WWDC 2016. Coders should be able to port Swift 3.0 to Linux to start with, and Windows portability should be coming soon as well (Windows 10 already has Ubuntu Linux in the system). Swift was named in a StackOverflow survey as the ‘most loved language’, and app developers would certainly love the idea of it becoming portable to multiple platforms.

Note: The way in which Swift coding is used to make apps on macOS systems/Xcode will be different from how the language is used on Linux/Windows. Also, the chances of Google ditching Java in favour of Swift as the base language for making Android apps cannot be ruled out.

4. Revamped API design guidelines – In essence, three basic principle frame the new guidelines for API design in Swift 3.0. First, more weightage has to be given by iPhone app development experts on the clarity of their codes (instead of trying to make their codes as brief as possible). At the call site (or, the point of use) too, absolute code clarity has to be maintained. Finally, awareness about the various contextual cues is important, since they would have a vital influence on how the app codes are to be framed. The changes are pretty much easily evident when a code is run in a Playground with the Swift 3.0 migrator.

5. A swift-er Swift – Mobile app developers feel that the upcoming version of Swift will be faster than ever before. There are several solid reasons behind this belief – right from porting objects to the stack from the heap (a speed boost of nearly 25x) and string dictionary brushups (around 4x speed boost), to reduction in the volume of compiled code via Code Size Optimization (a whopping 75x speed boost). In Swift 3.0, multiple files can be cached by the compiler at a single time – and that enhances the performance factor as well. Swift was always a faster language than Objective-C, and with the latest update, the difference is going to increase quite a bit.

6. Mandatory labels for function parameters – Apple is constantly changing the naming convention of labels in methods in the Swift language. In Swift 2.2, those who make apps did not need to provide a label for the first parameter – because the method name already had the name built-in. That has been tweaked around in Swift 3.0, and now every single function parameter (including the first) need to have their own label names. Coders can simply change the last part of the method names to specify the corresponding labels. There is an option to work around this requirement as well. More power to Apple developers!

7. Binary interface stabilization – Another improvement coming to Swift 3.0 that hints at the availability of the language on other platforms. The upcoming version of Swift will be able to seamlessly interact with different operating systems – thanks to the much-improved and considerably more stable Binary interface (ABI). The interaction will take place at the binary level – and that, in turn, will make the portability of Swift 3.0 easier.

8. Lightweight Generics from Objective-C – The lightweight generics of Objective-C could be viewed in Swift 2.x and earlier versions – but the import process was complicated, and the final view was, at times, confusing. This issue has been addressed in Swift 3.0. To cite an example, an iOS application developer working with Swift would see [String], when

NSArray<NSString *> * is declared in Obj-C. The overall implementation of generics (via the libraries) will also be more complete in Swift 3.0. Mistakes while using NSLayoutAnchor can also be bypassed by developers who migrate to the latest Swift version.

9. Simpler handling of Core Graphics – Before Swift 3.0 rolled in, writing Core Graphics in Swift was a frustrating experience for many Apple software and app makers out there. Much to the delight of the developer fraternity, this is no longer the case – with the reworked C API making things a lot simpler. The Grand Central Dispatch (GCD) in Swift, which is mainly used for complicated threading tasks, has been overhauled as well. The process in which the UI can be freed up by using different threads for activities is rather straightforward in Swift 3.0.

10. Line control segments and Attribute arguments – The changes in these will probably be glossed over by many developers, and that would be a pity – for the new guidelines for line control segments and attribute arguments in Swift 3.0 are vital. The #sourceLocation(file:Line) syntax is required to be used in the line control statements. On the other hand, colons have to used in all attribute arguments in the latest iteration of Swift. Mistakes here will lead to errors being thrown, and detecting the same (particularly in a long piece of code) can be a tough ask.

11. C functions can be imported quickly – This is an excellent new feature for the library authors. The new attributes for C-functions in Swift 3.0 allow users to customize the way in which the functions will be imported. The functions now get directly mapped to the property method(s) of their corresponding objects. The new version of Swift does away with the need to call the same function/function name repeatedly, and performs method calls efficiently.The C-function mapping is accurate, time-saving and a handy tool for developers.

12. More focus on English – The latest iteration of the Swift language requires certain changes in how English language is to be used while coding. The imperative of verbs have to be used to name the mutating methods of operations, while for the non-mutating part, a suffix (‘ing’ or ‘ed’) is to be added. Whenever the latter is not possible (i.e., not grammatical), the verb has to be used in its present participle form. App makers, hence, need to be more careful while coding – and stay away from probable confusions while sorting arrays.

13. Arrival of #keyPath() – While writing long key-value observing (KVO) codes in Swift 2.x, there was always the chance of typos being made and remaining undetected. To make the task simpler, Apple has introduced the #keyPath() expression in Swift 3.0. Unlike in previous versions, the new expression allows static-type checking and supports autocomplete as well. A cool way to lower the chances of developer mistakes and resultant program crashes.

14. Properties/enums with lowerCamelCase – In Swift 2.2, certain parameters and properties had to be started with UpperCamelCase. These were more of exceptions, since in general, UpperCamelCase was meant for structs, enums and classes, while lowerCamelCase was to be used for parameters and properties. With Swift 3.0, things have become, thankfully, a lot more consistent. Both enums (which are like properties, anyway) and properties – without any exception – now have to be initiated with lowercase letters. Errors due to mistaken use of Upper/lowerCamelCase have little chance of cropping up.

Like the 2.2 update, Swift 3.0 comes with Apache License 2.0. While Objective-C programmers can migrate to the Swift platform with ease, the language is not going to become interoperable with C++ anytime soon. iPhone developers feel that quite a few other new features will arrive to Swift 3.0, between now and its final release. One thing is for sure though – the Swift language continues to evolve!

What’s New In macOS Sierra?

OS X 10.12 Fuji has a new name, and you are probably already aware of it. At this year’s Worldwide Developers Conference, Apple confirmed the ongoing rumors by rebranding the OS X platform to macOS (in line with the naming convention of iOS, tvOS, watchOS). The latest version is called macOS Sierra, and at the conference, Craig Federighi showcased a gamut of new and interesting features that have arrived on the platform. Here are the top 13 new features present in macOS Sierra:

  1. Unlocking desktop with iPhone – Apple has made use of the cutting edge ‘time of flight networking’ technology to implement ‘Auto Unlock’ in macOS Sierra. This feature would allow users to unlock their their computers with their iPhones and/or even their Apple Watch (bypassing the need to type passwords…yay!). The new ‘Auto Unlock’ feature is somewhat similar to Microsoft’s existing facial recognition technology (Windows Hello) – although Apple’s system comes with a lot less frills.
  2. Universal Clipboard – Cross-device ‘Continuity’ is the marquee arrival on the latest iteration of Apple’s desktop OS. Among the several continuity-related features, the Universal Clipboard has been referred to as the most useful by many software analysts and professional app developers. The clipboard allows people to copy stuff (text, images, quotes, etc.) from their iDevices – iPhone or iPad – and paste it in a text field on their updated Mac systems. ‘Intelligent copying’ at its very best!
  3. Picture-in-picture – That’s what Apple is calling the option of playing video files on top of active windows on macOS Sierra-powered machines. The video window will be removable and resizable (the video box is small in size anyway), and it won’t be disruptive in any way for users. The picture-in-picture feature does away with the need for opening new windows or browser tabs to watch videos – another ‘tick’ mark on the user-convenience box.
  4. Apple Pay arrives on the web – General users as well as Apple app developers have every reason to be excited about this one. The Cupertino tech giant obviously has plans to enhance the accessibility and adoption of its NFC-powered contactless payment system – and that’s precisely why OS X 10.12 has been made compatible with Apple Pay transactions. Pay can combine well with the Auto Unlock feature of the version to make payments more prompt and secure. Apart from Apple Watch or iPhone, the custom fingerprint sensor (Touch ID, maybe?) can also be used for authentication purposes. Non-availability of payment terminals was one of the reasons behind the falling interests in Apple Pay recently (as we reported here). Now that it is on the web, transacting at online retailers and stores will become that much easier.
  5. Siri on Mac – Apple is playing the catch-up game here. It’s two biggest rivals already have their respective digital assistants on the web (Chrome has Google Now and Windows 10 has Cortana) – and it was only a matter of time before Tim Cook and his team brought the much-loved Siri to the Mac platform. Right from playlist creation and conversations, to online search capability and drag-and-drop options – Siri on macOS Sierra is going to be more useful than ever before.

Note: A new Siri API has also been released for third-party iOS app developers at WWDC 2016. Those who make apps will now be able to integrate custom software with the virtual assistant’s features.

6. Improvements in iCloud – With the revamped iCloud Drive in the upcoming version of the Apple desktop platform, syncing documents and folders will be an absolute breeze. Users will be able to store files in folders in a Mac system, and view them on another Mac or a paired iPhone. The overall app-centric nature in which iCloud used to work is a thing of the past, thanks to the option of remote access of documents. Documents saved on a device will be mirrored on another device – that’s pretty cool, right?

7. Optimized Storage – Users who keep running out of disk space on the Apple computers will find the all-new ‘Optimized Storage’ feature on macOS Sierra more useful than most. During the Apple WWDC 2016 keynote, Craig Federighi showed that as much as 130 GB of local storage space can be automatically cleared by this new add-on. In general, ‘Optimized Search’ empties the trash can, and clears the browsing history – but more importantly, it moves all ‘old’ documents to the cloud (redownloading them on the system is simple enough, provided there is internet connectivity). What’s more, users will also be prompted to delete used app installers and other such disposable items. Let’s just say that ‘Optimized Storage’ will make running out of space on upgraded Mac systems very tough!

8. Tabs, reimagined – What are tabs for? If your answer is ‘for browsing the web only’, you have a bit of catching up to do. With Sierra, Apple has made tabs usable for any application that has multiple windows. Apple app developers can use this to come up with larger and more useful desktop apps. For instance, if someone is working on, say, 5 spreadsheets at the same time – all the spreadsheets will be viewable under a single tab (no more rummaging through multiple tabs and windows). The usability of both pre-built as well as third-party apps will be helped by this feature.

Note: iPhone app developers have received a new Tabs API, which they can use to create seamless multi-tab applications.

9. Memories on the Photos app – The built-in Photos app has received a rejig in macOS Sierra. Users will now be able to make beautiful picture montages – which, in essence, means the creation of curated collections of images for special occasions (a birthday or an anniversary, for example). Images can also be displayed on a world map with the help of the Places feature, while People will allow users to group together pictures on the basis of the individuals in them. The location recognition system on the revamped Photos app is smart too.

10. ‘New’ Messages app – iMessages does its job, but many feel that it is just a tad too plain. There have been reports in many online app development forums and portals about how Apple is planning to make the Messages app on Mac more lively – and sure enough, there were mentions about this at the WWDC. Mostly, the changes would reflect the upgrades that have been made in iOS 10. This means more emojis, predictive typing (QuickType) and maybe even custom replies.

11. Tweaks to Gatekeeper – Since its arrival in OS X 10.8 Mountain Lion, the Gatekeeper security tool had remained pretty much unchanged till now. On macOS Sierra though, there will be at least two noteworthy changes. For starters, signed apps will no longer be launched directly from the Applications folder (although users will not realize this), but from another location in the hard drive. This, in turn, would minimize the threats of potential app attacks. Perhaps more importantly, people will be able to download only signed apps from the Mac App Store (disabling Gatekeeper and using unsigned apps is still possible, but the process is a lot more complicated). Clearly, Apple wants users to keep Gatekeeper enabled on macOS Sierra at all times.

12. iTunes will have updated Apple Music – Contrary to the general expectations of Apple software and mobile app development experts, WWDC 2016 did not witness a design overhaul update of iTunes. Apple Music, however, has got a makeover – and all the changes in the Music app of iOS 10 should be present on the upcoming macOS platform as well. According to reports, the updated Apple Music service has the potential to emerge as a worthy challenger of Spotify.

13. Compatibility – The backward compatibility of macOS Sierra is pretty much impressive. All iMac-s and Macbook Pro systems launched in 2009 or later will receive the update, as will all the 2010-and-later Mac Pro, MacBook Air, MacBook Pro and Mac Mini. There is a bit of confusion though – since some of the models left out by Apple actually have advanced hardware configuration (for the requirements of macOS Sierra). Also, on Mac systems released prior to 2012, the Metal Graphics framework will not be available.

The first public beta of macOS Sierra will be released by Apple in July, with the final release being scheduled at the annual fall event. Developer preview (beta 1) of the new operating system has already been seeded at the WWDC event. Over the next couple of months, we will get a clearer idea about the other new features in the rebranded Apple desktop OS – which seems powerful enough to notch up good early adoption rates.

Google I/O 2016: Looking Back At The 12 Biggest Announcements

With more than 7000 live audience, the 10th Google I/O (held from 18-20 May) well and truly lived up to its billing as one of the biggest mobile tech events in the year. Incidentally, two ‘firsts’ marked this year’s event. For starters, the venue was shifted from the bustling Moscone Center to the Shoreline Amphitheater in Mountain View for the first time – a nod to the changing times and the big things that Google has planned, as CEO Sundar Pichai noted. This year’s Google I/O was also a three-day affair – the first since 2012. In today’s discussion, we will take a look at some of the most important announcements made at Google I/O 2016:

  1. Android Wear gets an overhaul – As widely anticipated, Android Wear 2.0 made an appearance at last month’s Google I/O. This was the first major upgrade in the line of Android wearables – since they were first launched in 2014. Just as Apple Watch 2.0 is rumored to be, the second-generation Android smartwatches would be less reliant on paired smartphones and have more in the way of autonomous functionality. While questions remain over how convenient the pint-sized QWERTY keyboard on the smartwatches would be, the other new features (like app-syncing) are interesting. Google has seemingly taken another cue from its arch-rivals – the way in which app data can be displayed on the new watch faces is quite similar to how ‘Complications’ work on Apple Watch.
  2. Smarter Google Assistant – Google Now is a more than efficient text-based Android virtual assistant – and at this year’s Google conference, it got a new ally. The new Google Assistant is a lot like an IM application, and provides excellent contextual search options. The built-in artificial intelligence (AI) of the Assistant allows prompt conversational search – while its ability to accurately parse context and come up with responses is worth a special mention too. Interacting with the new-age Google Assistant is almost like replying to message threads online, according to many Android app developers worldwide.
  3. Messaging on Allo – Hangouts have not quite turned out to be the raging success that those at the Google headquarters might have hoped. In a bid to recover lost ground in the messaging domain (primarily to Facebook), Google has announced an all-new, multi-featured messaging application – Allo. Right from sending/receiving messages through a special ‘incognito’ mode (with conversations getting deleted whenever the app is closed) to smart replies and canned responses (based on the users’ photos and recent conversations) – Google Allo has a host of exciting special features. The font size can be changed (with a slider) at times when a person wishes to ‘shout out something’ in a message, or to tell something in a ‘whisper’. The wide range of bot support (restaurant bookings, for instance) add to the utility factor of Allo. It also has a dedicated Google Assistant search bot.
  4. Android N beta release – Generally, Google showcases the developer preview of new Android versions at each year’s I/O. This year, however, was an exception. With the developer preview of Android 7.0 N (yep, the final name is yet undecided) being already out in the wild for more than 50 days, the event witnessed a full-fledged beta release of the mobile platform. Game developers, in particular, have reasons to feel happy – with the cutting-edge Vulcan 3D all set to raise the quality of graphics higher than ever before. Security features have also been bumped up – and just like in Chromebooks, app updates can now occur seamlessly in the background. The latest Android iteration has top-notch multi-tasking (split window) and notification features as well. Android N has a plethora of new features – and although it will face the usual fragmentation problems during rollout, the platform has enough firepower in it to generate high adoption rates.
  5. A smart home – With the new Google Assistant powering it, Google Home seems to be a promising release from Sundar Pichai and his team. It is a direct endeavour of Google to help users build ‘smart homes’ – with voice-support built in for setting alarms, nesting compatible devices, syncing networks, and several more tasks. The cylindrical Google Home device has a powerful speaker near its base – and it can be connected with more than one device (in different rooms). It will be very interesting to see whether Google Home manages to emerge as a serious challenger to Amazon Echo (the two work rather similarly).
  6. New Virtual Reality platform on Android – This one has got both general Android-fans as well as mobile app development experts all excited. Google has finally stepped into the world of VR in a big way – with a new platform, called Daydream. It will be usable within the Android N ecosystem, and will have its very own home screen – with apps and utilities. The news has already made a splash, with several big players (Electronic Arts, Netflix and NYT, to name a few) having already started making software for Daydream. Headsets, phone specs and applications are the three chief aspects of the Daydream VR platform. The only possible hitch might be that Daydream will only be workable on the upcoming Android phones that have special sensors. It won’t be challenging the likes of Oculus Rift anytime soon.

Note: A VR headset, which draws power from paired smartphones, was also showcased at Google I/O 2016.

7. Video-chatting on Duo – Apple has iMessages and FaceTime – and Google is all set to throw down a challenge with Allo (mentioned above) and Duo. The latter is a smart video chatting application that allows users to check out the videos of others (via a feature called ‘Knock Knock’), even before answering the video calls. It will be a smartphone-only app for now (unlike FaceTime) – and once opened, it will let people check out a full selfie video of themselves. Android app developers have also been impressed by the way Google Duo manages audios/videos when the available bandwidth is fluctuating and when a user is switching from mobile data to wifi (or vice versa).

8. Android Instant Apps for quick previews – Among the demonstrations at this year’s edition of Google I/O, the one involving Android Instant Apps grabbed probably the most eyeballs. Android app development professionals have confirmed that the new feature will let users access select modules of certain applications, without having to download the latter. According to the official announcement by Google, it will take less than 24 hours for app developers to modularize their applications, so that they are compatible with Android Instant Apps.

9.  Update on Project Ara – This was a long time coming. Device analysts and Android app makers alike have been looking forward to Google’s modular smartphone – codenamed Project Ara – ever since its announcement in 2013. Last year’s proposed testing at Puerto Rico also got scrapped. The latest presentation showed off some cool and user-friendly components of the already-much-delayed Project Ara – and it should hit the markets sometime later this year. There is a bone of concern though – with LG already having entered the modular phone domain, is Google’s Project Ara too late to arrive?

10. New Android TV – Apple TV is expected to get an update at WWDC ‘16, and Google has heated up the competition by launching a brand new Android TV – the Xiaomi Mi Box. Support for 4K videos is one of the best (albeit expected) features of the Mi Box, which also has other interesting controls and playback options. At the I/O event this year, it was also announced that RCA and Sony Bravia will be making Android-powered TVs soon.

11. Firebase 2.0 for developers – Given that Google I/O is a developers conference, the number of developer-centric announcements at the event was remarkably low. Of the little there was, the announcement of Firebase 2.0 attracted maximum attention. The new iteration of the realtime database comes with a wide array of tools and infrastructure for building as well as testing Android apps.  Firebase 2.0 is secure, developer-friendly, and should make the task of app development that much easier.

Note: Android Studio 2.2 was also released at Google I/O 2016.

12. Waze in Android Auto – Android Auto has been revamped by Google, with the Waze traffic-tracker application now being available within it. This, in turn, allows drivers to get prompt alerts and notifications on possible speeding traps and accidents. More importantly, Google has taken good strides towards making Android Auto a standalone mobile app – which would be usable even in cars that do not support the technology (let’s face it, not everyone is able to afford Android-supported cars). Drivers can now establish connection to vehicles via wi-fi, bypassing the USB connections that were required previously in Android Auto.

Yet another announcement at this year’s I/O that got the Android app developer community buzzing was the launch of Google Play Awards (for the best applications in Play Store). With the sales of Chromebooks overtaking that of Mac computers for the first time, the news of Chrome OS getting all the new Android applications is also significant. Project Jacquard (which deals with smart clothing) and Project Soli (on the inclusion of radar in Android smartwatch) were also mentioned at the event. The former is eyeing a mid-2017 launch.

Apart from the 7000-odd delegates at the Shoreline Amphitheater, there were millions of people catching up the live streaming of Google I/O 2016 – from more than 100 countries. The event had its fair share of important announcements, and both Android users as well as app makers have plenty of new things to look forward to later this year.