Category Archives: apple

Amazon Mobile SDK adds login, data sync, analytics for iOS and Android apps

Amazon Web Services has announced an updated AWS Mobile SDK, which provides libraries for mobile apps using Amazon’s cloud services as a back end. Version 2.0 of the SDK supporting iOS, and Android including Amazon Fire, is now in preview, adding several new features:

Amazon Cognito lets users log in with Amazon, Facebook or Google and then synchronize data across devices. The data is limited to a 20MB, stored as up to 20 datasets of key/value pairs. All data is stored as strings, though binary data can be encoded as a base64 string up to 1MB. The intent seems to be geared to things like configuration or game state data, rather than documents.

Amazon Mobile Analytics collects data on how users are engaging with your app. You can get data on metrics including daily and monthly active users, session count and average daily sessions per active user, revenue per active user, retention statistics, and custom events defined in your app.

Other services in the SDK, but which were already supported in version 1.7, include push messaging for Apple, Google, Fire OS and Windows devices; Amazon S3 storage (suitable for any amount of data, unlike the Cognito sync service), SimpleDB and Dynamo DB NoSQL database service, email service, and SQS (Simple Queue Service) messaging.

Windows Phone developers or those using cross-platform tools to build mobile apps cannot use Amazon’s mobile SDK, though all the services are published as a REST API so you could use it from languages other than Objective-C or Java by writing your own wrapper.

The list of supported identity providers for Cognito is short though, with notable exclusions being Microsoft accounts and Azure Active Directory. Getting round this is harder since the federated identity services are baked into the server-side API.

image

Microsoft repositions for a post-Windows client world

Microsoft CEO Satya Nadella has penned a rather long public letter which sets out his ambitions for the company. It is not full of surprises for those who have been paying attention, but confirms what we are already seeing in projects such as Office for iPad: Microsoft is positioning itself for a world in which the Windows client does not dominate.

The statement that stands out most to me is this one (the highlighting is mine):

Apps will be designed as dual use with the intelligence to partition data between work and life and with the respect for each person’s privacy choices. All of these apps will be explicitly engineered so anybody can find, try and then buy them in friction-free ways. They will be built for other ecosystems so as people move from device to device, so will their content and the richness of their services

Microsoft is saying that it will build work/personal data partitioning into its applications, particularly one would imagine Office, and that it will write them for ecosystems other than its own, particularly one would imagine iOS and Android.

This is a big change from the Windows company, and one that I will expect to see reflected in the tools it offers to developers. If Microsoft is not trying to acquire Xamarin, you would wonder why not. It has to make Visual Studio a premier tool for writing cross-platform mobile applications. It also has to address the problem that an increasingly large proportion of developers now use Macs (I do not know the figures, but observe at some developer conferences that Windows machines are a rarity), perhaps via improved online developer tools or new tools that themselves run cross-platform.

Nadella is careful to avoid giving the impression that Microsoft is abandoning its first-party device efforts, making specific mention of Windows Phone, Surface, Cortana and Xbox, for example.

Our first-party devices will light up digital work and life. Surface Pro 3 is a great example – it is the world’s best productivity tablet. In addition, we will build first-party hardware to stimulate more demand for the entire Windows ecosystem. That means at times we’ll develop new categories like we did with Surface. It also means we will responsibly make the market for Windows Phone, which is our goal with the Nokia devices and services acquisition.

Here is another statement that caught my eye:

We will increase the fluidity of information and ideas by taking actions to flatten the organization and develop leaner business processes.

The company has become increasingly bureaucratic over the years, and that is holding back its ability to be agile (though some teams seem to move at high speed regardless; I would instance the Azure team as an example).

Nadella’s letter has too many flowery passages of uncertain meaning – “We will reinvent productivity for people who are swimming in a growing sea of devices, apps, data and social networks. We will build the solutions that address the productivity needs of groups and entire organizations as well as individuals by putting them at the center of their computing experiences.” – but I do not doubt that major change is under way.

Embarcadero AppMethod: another route to cross-platform mobile, now with C++ support

Embarcadero has updated AppMethod, its IDE for cross-platform mobile and desktop applications. The IDE now supports C++, and as a special offer, you can develop Android phone “free forever”, according to the web site.

AppMethod is none other than our old friend Delphi, combined with the FireMonkey cross-platform framework. The difference between AppMethod and the older RAD Studio product line (current version is XE6) is twofold:

1. AppMethod does not include the VCL, the Delphi framework for Windows applications. It does let you develop for Windows or Mac OS X using FireMonkey.

2. You can buy RAD Studio outright with a perpetual license, from £1342.00 plus VAT for a new user (RAD Studio Professional). AppMethod is only available on subscription.

AppMethod pricing is per developer per platform per year. Currently this is £179.83 plus VAT for individuals (very small businesses up to a maximum of 5 employees in the entire organisation) or £600 for larger businesses (a rather large premium).

C++ support is new in AppMethod 1.14 and supports all target platforms except the iOS Simulator (an annoying limitation). It supports ARC (Automatic Reference Counting) on Android as well as iOS. Mac OS X is supported from 10.8 (Mountain Lion) and up.

There are also a few changes in FireMonkey. You can load HTML into the TWebBrowser component using LoadFromStrings. There is a new date picker component.

Another new feature is in the RTL (run time library). Called App Tethering, it lets applications communicate with each other, for example using TCP. These can be apps on the same device or remote apps. Once paired, apps can run remote actions and share standard data types and streams.

There are also updates to push notifications for iOS and Android, Google Glass support, updated OpenGL and DirectX support on Windows, and more: see here for the complete documentation of what is new.

A Quick Hands-on

I installed the latest AppMethod on Windows 8. The install warns that AppMethod cannot co-exist with RAD Studio XE6, presumably because it is essentially the same thing re-wrapped. The product name is relatively new, but there is plenty of old stuff under the covers. AppMethod still has a dependency on JSharp, Microsoft’s Java implementation for .NET. Java code in the IDE dating back to who knows when?

image

There is a 10-field dialog conforming paths for Android tools, which is a reminder of how many moving parts there are here. It is more complex that most Android development environments because it uses the NDK (Native Development Kit) as well as the usual SDK.

image

Once up and running, you can start a new project such as a FireMonkey mobile application:

image

and then you are in an IDE which would not be entirely unfamiliar to a Delphi user in 1995 (or I suppose, a C++ Builder user in 1997) – I am not saying this is a bad thing, though the IDE feels dated in comparison to Microsoft’s Visual Studio.

image

After coming from a spell of development with XAML it feels odd to have a form builder that defaults to xy layout, but layout managers are available:

image

Compile and run, and after the usual slow initialization of the Android emulator, the app appeared.

image

Why AppMethod?

In the crowded world of cross-platform mobile development, why use AppMethod?

Embarcadero makes a big play of its native development, though it is “native” in respect of code execution but not in GUI fidelity since by default visual controls are custom-drawn by the framework. This is in contrast to Xamarin (the obvious alternative for developers from a Windows background) which does no custom drawing but only uses native controls; however for raw performance AppMethod may have the edge (I have not done comparisons).

Delphi developers should also look at RemObjects Oxygene which also uses a Delphi-like language but is hosted in Visual Studio and, like Xamarin, uses native UI components.

The AppMethod approach does make sense if you prioritise maximum code-sharing over getting exactly the right look and feel for each supported platform, and need better performance or more capability than HTML and JavaScript can get you. There is no support for Windows Phone though; if that is in your plans, Xamarin or HTML and JavaScript development is a better fit.

Review: Sony SRS-X9 high-resolution network music player

Sony’s top of the range wireless speaker grabbed my attention because it is not just a Bluetooth and Apple AirPlay speaker, but also the entry-level device in Sony’s push for high resolution audio, billed as better than CD quality. Get all the ducks in line, and you can play DSD (the format of SACD) downloads directly through this device, or high-resolution PCM at up to 32-bit/192kHz. It has the speaker technology to go with it too: sub-woofer for deep bass (within the limitations of a small box), and super tweeters for extended high frequencies up to a rumoured 40kHz, though I cannot find detailed specification from Sony. Note that this is well beyond what humans can hear.

image

In the box you get the wireless speaker, remote, polishing cloth, mains cable, two odd little sticks which, it turns out, are tools for removing the front grille, and a couple of short leaflets in multiple languages.

image

The remote has functions for power, input selection (Network, Bluetooth, USB-A, USB-B or analogue audio in), volume, mute, play/pause and skip.

image

This unit is flexible to the point of confusion. Here are the ways you can play back music:

  • Apple AirPlay: play from iTunes over an wired or wireless network using Apple’s proprietary protocol.
  • Bluetooth from Bluetooth-enabled devices such as smartphones or tablets. Uses A2DP (Advanced Audio Distribution Protocol) for best quality.
  • From a DLNA-compliant music server on your network. Sony’s free Media Go will do, but there are quite a few of these around.
  • Audio in using an old-fashioned 3.5mm jack cable.
  • Direct attached USB storage. I had limited success with this, but did manage to play some FLAC files from a USB stick. It is designed for just a few files.
  • Direct USB connection to a PC or Mac. In this mode the unit is a USB DAC. This is how you get the very best quality.

image

Supported formats are MP3, AAC, WMA, WAV, FLAC, and DSD via USB after firmware update. ALAC (Apple lossless) is not listed, but an Apple lossless file I created played fine from a USB stick, from which I conclude that it supports that too.

So how is the out of box experience? The first thing you notice is that this thing is heavy – 4.6kg. Despite its relatively small size (about 430 x 133 x 125mm) it is not all that portable; I mean, you can move it about if you like, but as well as the weight there is no handle and it should be moved with care; it is also mains-only.

The introductory manual gives you several ways to get started. It covers only wi-fi connection; if you want to use a wired network, Bluetooth or USB connection, you are referred to the online manual here. Otherwise, you are offered instructions for iOS, Android, PC or Mac. I have a Sony Xperia (Android) smartphone so I took that option; possibly a mistake.

I tried to follow the setup guide. I have a Sony Xperia (Android) smartphone. I downloaded the recommended SongPal app and successfully paired the phone with the speaker with NFC (tap to connect). The app prompted me to enter my home wifi password, but I was not successful; it just did not want to connect and kept on prompting me. I got hold of an iPhone, tried SongPal on that and was able to connect. Odd.

Once up and running it was time to play some music. I was able to play direct from the phone (Bluetooth streaming) without any problem. My results with DLNA were mixed. I have Logitech Media Server on the network which supports DLNA. Bizarrely, this usually shows up as a source when using the Android SongPal, but not when using the iOS SongPal. It worked at first, but then I started getting “Playback failed”. I had better luck with Windows Media Player over DLNA, and also Sony’s own Media Go.

That said, even when it is working I don’t much like the DLNA option. There is no search option and if you have a lot of music you do endless scrolling. This seems to be a feature of DLNA rather than the fault of SongPal, and a reason why it will never catch up with iTunes/AirPlay or Sonos.

SongPal also supports various apps such as Tunein (internet radio), Music Unlimited and Deezer. You can also add apps such as Google Play. This is a tad confusing though. Tunein seems to be built-in; you can select a radio station, play, turn off your smartphone and it keeps going. Choose Google Play though and it plays over Bluetooth from your phone; disconnect the phone and the music stops.

image

Since Tunein appears to be baked it, it is a shame that you cannot use the radio from the remote without needing SongPal.

If SongPal is not working for you, or if you have a non-supported phone such as Windows Phone, you can connect over the network. The manual suggests that you do a direct connection to a PC using an Ethernet cable, in which case the unit will likely show up in a web browser on 169.254.1.1. However if you connect the Ethernet cable to a switch (such as a socket on the back of your broadband router) it will show up on whatever IP number is allocated by the router; you can find it by looking at DHCP allocations, a bit tricky. There is also a WPS button for instant connection if your wireless router supports it (mine is disabled for security reasons).

Wireless configuration through a web browser, once you get there, is really easy. You can even set a fixed IP address if you want. However, the browser configuration does NOT give access to all the features of the unit; it is mainly for network configuration. The SongPal app has additional settings, including EQ, a setting called ClearAudio+ which does who knows what, and DSEE HX which is meant to enhance lossy audio files such as MP3. That’s unfortunate; not everyone uses iOS or Android. That said, SongPal is not much fun to use anyway so you are not missing too much.

image

Once the unit was up and running I tried a few other modes. I ran up Apple iTunes and tried AirPlay, which works great, though with the usual AirPlay annoyance of a pause when connecting. When using AirPlay, you can use the pause, next and back buttons on the supplied remote. These don’t work in all modes, another point of confusion.

What about playing high resolution music or DSD? I was excited about this possibility so keen to get it working. I even have some DSD downloads to try. Discovering how was a bit of an adventure. You need to do two things.

First, update the firmware, by connecting over wifi and using the otherwise undocumented update button on top of the unit (check Sony’s site for full instructions). You need at least firmware 2.05.2.01.

Second, find and install the Hi-Res Audio Player for PC or Mac on Sony’s site. Third, get a USB cable (not supplied) and connect it to a PC.

The downloads to get this working are here.

image

I was rewarded with excellent sound quality, though the audio player software is basic. On my DSD downloads I could see, for example, 2.8MHzs DSF indicated, and the configuration offered “DSD Native”, so I believe this thing really is a DSD DAC (though who knows, it may convert to PCM internally).

image

Once connected in this way, you can also set it as the output for other audio software such as Foobar 2000 or iTunes.

The sound

What of the sound though? The SRS-X9 has seven speakers: 1 sub-woofer, two midrange, two tweeters and two super-tweeters. This means you get mono for the lowest frequencies, but that it not really a disadvantage as low frequencies are not directional and you don’t get much stereo image with this box anyway.

In addition, there are two passive bass radiators.

image

As you would expect from a unit at this price (nearly £600 in the UK) and with some audiophile pretensions, the sound is very good. In its class – as a single box wireless speaker – it may be the best I’ve heard. It easily beat a Squeezebox Boom, sounding both bigger and cleaner. I also thought it had the edge over an Audyssey Lower East Side Audio Dock Air, which is another AirPlay speaker with good sound, though the Audyssey offers deeper bass.

The SRS-X9 does go relatively deep though, and the bass is clean whereas the Audyssey tends to boom a little.

The sound is not faultless though. It is a touch bright and can get a little strident at higher volumes. Vocals can have slightly exaggerated sibilance. Stereo imaging, as mentioned above, is poor, thanks to the close proximity of left and right speakers. The sound is exceptionally clean, which is hardly a fault, but worth noting if you like to get down and boogie; you might find the SRS-09 overly clinical.

These are reasons why the SRS-09 will not replace a traditional home stereo for me. I also like having separate speakers either side of my PC screen, so this is not perfect for that role.

HOWEVER as a minimalist and good-looking single box speaker this is excellent; perfect for a sitting room if you do not want the clutter of a traditional home stereo, or for somewhere else round the house where you want high quality music.

The sound over USB is best, and ideally I would suggest parking a Mac Mini or similar small computer next to it and using it that way. On the other hand, AirPlay also works well and in conjunction with Apple’s Remote app this is a convenient solution. Bluetooth can be handy too.

A few other notes. Sony has gone for an understated design, and the buttons on top of the unit are completely flat and in fact mostly invisible unless you hover your hand close by – it uses a proximity sensor. Clever, but easy to hit a button by accident if you are repositioning the device.

The appearance is glossy black, looks nice but gets dusty easily. Sony supplies a little black cloth for polishing. Unfortunately the super tweeters on top are surrounded with a slightly sticky area which attracts dust and is hard to clean; this might bother you if you are meticulous about such things.

The front grille can be removed with two supplied magnetic tools; Sony says this give a “more dynamic sound” though the difference is not great.

image

It is a shame that there is no audio output port, neither for headphones, nor for external speakers. You cannot use this as a DAC for another stereo system, for example.

An S/PDIF optical digital input would also be handy, as this is more universally compatible than USB for wired digital input.

Other weak points are the fiddly setup, reliance on a mobile app for some settings, general unreliability of DLNA, and some problems which mysteriously disappear when you turn off and on again (with so many input options it is not surprising that the Sony gets confused sometimes).

Conclusion? There is a ton of technology packed into this box and it does sound good. I like the option to play back native DSD even though it is all a bit mad; it is doubtful that the inaudible higher frequencies really make any difference, and there are compromises elsewhere such as the mono sub-woofer and limited stereo image that more than outweigh any benefit from high-resolution (a controversial subject). Never mind though; Sony has taken trouble over the sound and it shows.

Good points

  • Flexible streaming options
  • High quality sound, exceptionally clean
  • Compact, minimalist design
  • Smooth AirPlay support
  • Support for hi-res PCM and DSD audio files when connected via USB

Bad points

  • Dependence on iOS or Android apps for some features, no support for Windows Phone
  • No headphone socket
  • No audio output for connection to other hi-fi kit
  • No S/PDIF optical digital input
  • Limited stereo image and sound too bright on some material

Specifications

  • Size: 430x133x125mm
  • Weight: 4.6Kg
  • Power consumption: 50w
  • Power output: unknown though Amazon quotes “154w”
  • Frequency response: Sony quotes “45Hz to 40kHz”.
  • Drive units: 1 sub-woofer, 2 passive bass radiators, 2 midrange units, 2 tweeters, 2 super-tweeters
  • Streaming support: Bluetooth audio, AirPlay, DLNA

Soundgarden’s Superunknown in DTS virtual 11.1 surround-sound: better than stereo for your mobile listening?

A&M/Universal has released Soundgarden’s classic 1994 Superunknown album in the DTS Headphone:X format, which offers 11.1 virtual surround sound through normal stereo headphones.

image

Is such a thing possible? I am sceptical of the claims for 11.1 (11 discrete channels plus sub-woofer) though the DTS Headphone X demo app is most impressive, and you hear the surround effect clearly. When I first heard this demonstrated at Mobile World Congress in Barcelona, it was so convincing that I took off my headphones to make sure that the sound was not really coming from speakers positioned around the studio.

image

This demo is included in a new app developed for the 20th anniversary of Superunknown. The app is free. and also includes a free sample track in virtual 11.1, Spoonman.

If you want the full 16 track album in this format, it seems that you have to buy the Super Deluxe box: 4CD plus Blu-Ray at an extravagant price. This includes a voucher which lets you download the full album in the app. Note that the Blu-Ray also includes a 96/24 5.1 surround mix, so you can think of the app as a mobile version of the surround mix, though they are different: the credits say:

Surround sound mixes by Adam Kasper at Studio X, Seattle and Bob DeMaa at DTS, Calabasas, California.

The app offers four settings for listening: In Ear, On Ear, Over Ear, and unprocessed stereo. DTS knows what it is doing: with On Ear headphones, the On Ear setting sounded best and the In Ear setting muffled; with earbuds, the In Ear setting sounded best and the On Ear setting harsh.

image

But how is the sound? The odd thing about the Headphone X system is that the spectacular demo raises expectations that actual music does not deliver; the surround illusion is less striking.

That said, there is a huge difference in sound between plain stereo and virtual surround. Unfortunately switching to virtual surround significantly raises the volume, making comparison more difficult, but the surround processing does open out the sound and make it more immersive. It is easier to pick out individual instruments. Bass is more accentuated.

It is not all in one direction though; the stereo sounds cleaner and less processed.

Still, I would personally choose to hear the DTS version. It is effective technology even though I cannot honestly say that it sounds like 11.1 surround sound. Producer Kasper is quoted though saying: “The experience Soundgarden’s fans will hear over headphones is identical to how I heard the mix in the studio when producing the surround sound version.” This could be a matter of which headphones you use, or he might be exaggerating.

I am less impressed with the app itself. Tracks are slow to load and I got occasional stuttering on an older iPad. The settings menu pops up repeatedly, rather than remembering your last setting. If you switch from the tracklist to the Player menu and back you get a momentary pause in the sound. The design is basic and it looks as if the app was put together quickly.

It is also obvious that having a separate app for every album is hopeless as a long-term strategy. Space is also an issue. The app with the album downloaded is 344MB and there is no provision for storing the music files anywhere other than in the iPad’s on-board storage. It is unfortunate that once downloaded, the surround mix is only available on that device; you cannot download for both iOS and Android with one voucher.

Overall I still like it, and would like to see more surround mixes released in this format. It may not be quite as good as the real thing, but it is vastly more convenient.

You can get the new app here, on Apple iOS or Android, and try it for yourself.

The Microsoft Apartment: full of screens and an uninvited cucumber

I visited Microsoft’s “Apartment” in London, billed as a chance to see “Dragon’s Den star Kelly Hoppen’s apartment in the heart of Covent Garden kitted out with the latest Microsoft technologies,” and to include a “deep dive discussion” on Microsoft’s latest developer announcements.

How do you kit out an apartment with the latest Microsoft technologies? Apparently, you stick an Xbox One and a couple of PC screens in the living area, and upstairs in the study (a mezzanine floor), a PC, a Surface (not 3 sadly), and a Windows phone connected to a big screen.

image

There were certainly lots of screens, but nothing in the way of home automation, and after watching Microsoft presenters struggling to get the Xbox One to play the right kind of music, and later a shaky Skype demo, it is hard to enthuse over this particular setup.

For some reason, we were not shown any cool games on the Xbox One, nor cool apps on the Windows Phone other than the Cortana assistant which is not yet available in the UK. There was a demo of the new swipe keyboard in Windows 8.1 which inevitably saw the word “document” rendered as “cucumber”; a shame as I know from my own experience that this keyboard works very well, but demoing this kind of thing in public is only for the brave or the very well rehearsed.

We did see collaborative real-time editing on an Office document – not something home users generally do, but to be fair this was part of a business-oriented discussion which followed.

One feature which I had not previously been aware of was the ability of Skype on the Xbox One, in conjunction with Kinect, to follow the speaker around the room automatically. If you like pacing up and down while on Skype, this is a cool feature; perhaps it would be good for talking to excitable kids as well.

Takeaways? Let me put it like this. If you thought, perhaps, that the Xbox One has potential but feels (in software terms) not yet ready; or that Microsoft has no idea how to market to consumers; then there was nothing here that would change your mind.

As chance would have it, the Microsoft apartment is a few paces away from Apple’s huge Covent Garden store, and seeing the crowds eager to try the latest iDevices put the Microsoft event in perspective.

PS for another, more positive take on the event see this Neowin report.

Apple’s Swift programming language: easy coding for OS X and iOS at last?

Apple has announced a new programming language, called Swift. (There was already a language called Swift, used for parallel scripting, but Apple links to the other Swift in case you land on the wrong page. So far it looks like the other Swift has not returned the favour).

For as long as I can remember, serious Apple developers have had to use Objective-C, an object-oriented C that is not like C++. I have only dabbled in Objective-C but when I last tried it I was pleasantly surprised: memory management was no hassle and I found it productive. Nevertheless it is an intimidating language if you come from a background of, say, JavaScript or Microsoft .NET. Apple’s focus on Objective-C has left a gap for easier to use alternatives, though the main reason developers use something other than Objective-C, as far as I am aware, is for cross-platform projects. Companies such as Xamarin and Embarcadero (with Delphi) have had some success, and of course Adobe PhoneGap (or the open source Cordova) has had significant take-up for cross-platform code based on HTML and JavaScript.

I should mention that RAD (Rapid Application Development) on OS X has long been possible using the wholly-owned Filemaker, a database manager with a powerful scripting language, but this is not suitable for general-purpose apps.

Overall, it is fair to say that coding for OS X and iOS has a higher bar than for Windows because Apple has not provided anything like Microsoft’s C# or Visual Basic, type-safe languages with easy form builders that let you snap together an application in a short time, while still being powerful enough for almost any purpose. This has been a differentiator for Windows. Visual Basic is almost as old as Windows itself, and C# was introduced in 2000.

Now Apple has come up with its own equivalent. I am new to Swift as are most people outside Apple, but took a quick look at the book, The Swift Programming Language, along with the announcement details. A few highlights:

  • Swift is a type-safe language that compiles to native code using LLVM.
  • The IDE for Swift is Xcode. It supports Cocoa development (Apple’s user interface framework) via import of the existing Objective-C frameworks, which become Swift APIs via the import keyword:

import UIKit

  • You can mix Swift and Objective-C in a single project. In Objective C you can use #import to make Swift code visible and usable.
  • Swift is a C-family language and you will find familiar features like curly braces and semi-colons to terminate lines (though semi-colons are optional).
  • Swift uses reference counting for automatic memory management. There is rather complex section in the book about weak references and unowned references, to solve some of the problems inherent in reference counting.
  • Type inference is the preferred approach to declaring the type of a variable, but you can state the type if required. You can also declare constants.
  • Swift supports single inheritance for classes and multiple inheritance for protocols (protocols are more or less equivalent to interfaces in other languages).
  • There are advanced features including closures, generics, tuples, and variadic parameters. (I am not sure if “advanced” is the right word, but other languages such as C# and Java took a while to get these).
  • Swift has something like destructors which it calls deinitializers.
  • There is an interesting feature called Extensions which lets you add methods to any existing type. For example, you could extend Int with a prettyprint method and then call 3.prettyprint.
  • Swift variables are not normally nullable; they must have a value. However you can declare optional types (add a ?, such as Int?) that can be set to nil. You can also declare implicitly unwrapped optionals which can be nil, but once assigned a value cannot be nil thereafter.
  • Swift includes the AnyObject type which can represent anything.

Swift seems to me to have similar goals to Microsoft’s C#: easier and safer than C or C++, but intended for any use right up to large and complex applications. One of the best things about it is the smooth interoperability with Objective-C; this also saves Apple from having to write native Swift frameworks for its entire stack.

A smart move? I think so, though Swift is different enough from any other language that developers have some learning to do.

What difference will Swift make? Initially, not that much. Objective-C developers now have a choice and some will move over or start mixing and matching, but Swift is still single-platform and will not change the developer landscape. That said, Swift may make Apple’s platform more attractive to business developers, for whom C# or Java is currently more productive; and perhaps Apple could find ways of using Swift in places where previously you would have to use AppleScript, extending its usefulness.

If Apple developers were tempted towards Xamarin or Delphi for productivity, as opposed to cross-platform, they will probably now use Swift; but I doubt there were all that many in that particular group.

I would be interested to hear from developers though: what do you think of Swift?

Hands on with Xamarin 3.0: a cross-platform breakthrough for Visual Studio

Today Xamarin announced version 3.0 of its cross-platform mobile development tools, which let you target Android and iOS with C# and .NET. I have been trying a late beta preview.

In order to use Xamarin 3.0 with iOS support you do need a Mac. However, you can do essentially all of your development in Visual Studio, and just use the Mac for debugging.

To get started, I installed Xamarin 3.0 on both Windows (with Visual Studio 2013 installed) and on a Mac Mini on the same network.

image

Unfortunately I was not able to sit back and relax. I got an error installing Xamarin Studio, following which the installer would not proceed further. My solution was to download the full DMG (Mac virtual disk image) for Xamarin Studio and run that separately. This worked, and I was able to complete the install with the combined installer.

When you start a Visual Studio iOS project, you are prompted to pair with a Mac. To do this, you run a utility on the Mac called Xamarin.IOS Build Host, which generates a PIN. You enter the PIN in Visual Studio and then pairing is active.

image

Once paired, you can create or open iOS Storyboard projects in Visual Studio, and use Xamarin’s amazing visual designer.

image

Please click this image to open it full-size. What you are seeing is a native iOS Storyboard file open in Visual Studio 2013 and rendering the iOS controls. On the left is a palette of visual components I can add to the Storyboard. On the right is the normal Visual Studio solution explorer and property inspector.

The way this works, according to what Xamarin CEO Nat Friedman told me, is that the controls are rendered using the iOS simulator on the Mac, and then transmitted to the Windows designer. Thus, what you see is exactly what the simulator will render at runtime. Friedman says it is better than the Xcode designer.

“The way we do event handling is far more intuitive than Xcode. It supports the new iOS 7 auto-layout feature. It allows you to live preview custom controls. Instead of getting a grey rectangle you can see it live rendered inside the canvas. We use the iOS native format for Storyboard files so you can open existing Storyboard files and edit them.”

I made a trivial change to the project, configured the project to debug on the iOS simulator, and hit Start. On the Mac side, the app opened in the simulator. On the Windows side, I have breakpoint debugging.

image

Now, I will not pretend that everything ran smoothly in the short time I have had the preview. I have had problems with the pairing after switching projects in Visual Studio. I also had to quit and restart the iOS Simulator in order to get rendering working again. This is an amazing experience though, combining remote debugging with a visual designer on Visual Studio in Windows that remote-renders design-time controls.

Still, time to look at another key new feature in Xamarin 3: Xamarin Forms. This is none other than our old friend XAML, implemented for iOS and Android. The Mono team has some experience implementing XAML on Linux, thanks to the Moonlight project which did Silverlight on Linux, but this is rather different. Xamarin forms does not do any custom drawing, but wraps native controls. In other words, it like is the Eclipse SWT approach for Java, and not like the Swing approach which does its own drawing. This is keeping with Xamarin’s philosophy of keeping apps as native as possible, even though the very existence of a cross-platform GUI framework is something of a compromise.

I have not had long to play with this. I did create a new Xamarin Forms project, and copy a few lines of XAML from a sample into a shared XAML file. Note that Xamarin Forms uses Shared Projects in Visual Studio, the same approach used by Microsoft’s Universal Apps. However, Xamarin Forms apps are NOT Universal Apps, since they do not support Windows 8 (yet).

image 

In a Shared Project, you have some code that is shared, and other code that is target-specific. By default hardly any code is shared, but you can move code to the shared node, or create new items there. I created XamFormsExample.xaml in the shared node, and amended App.cs so that it loads automatically. Then I ran the project in the Android emulator.

image

I was also able to run this on iOS using the remote connection.

I noticed a few things about the XAML. The namespace is:

xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"

I have not seen this before. Microsoft’s XAML always seems to have a “2006” namespace. For example, this is for a Universal App:

xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x=http://schemas.microsoft.com/winfx/2006/xaml

However, XAML 2009 does exist and apparently can be used in limited circumstances:

In WPF, you can use XAML 2009 features, but only for XAML that is not WPF markup-compiled. Markup-compiled XAML and the BAML form of XAML do not currently support the XAML 2009 language keywords and features.

It’s odd, because of course Xamarin’s XAML is cut-down compared to Microsoft’s XAML. That said, I am not sure of the exact specification of XAML in Xamarin Forms. I have a draft reference but it is incomplete. I am not sure that styles are supported, which would be a major omission. However you do get layout managers including AbsoluteLayout, Grid, RelativeLayout and StackLayout. You also get controls (called Views) including Button, DatePicker, Editor, Entry (single line editor), Image, Label, ListView, OpenGLView, ProgressBar, SearchBar, Slider, TableView and WebView.

Xamarin is not making any claims for compatibility in its XAML implementation. There is no visual designer, and you cannot port from existing XAML code. The commitment to wrapping native controls may limit prospects for compatibility. However, Friedman did say that Xamarin hopes to support Universal Apps, ie. to run on Windows 8 as well as Windows Phone, iOS and Android. He said:

I think it is the right strategy, and if it does take off, which I think it will, we will support it.

Friedman says the partnership with Microsoft (which begin in November 2013) is now close, and it would be reasonable to assume that greater compatibility with Microsoft XAML is a future goal. Note that Xamarin 3 also supports Portable Class Libraries, so on the non-visual side sharing code with Microsoft projects should be straightforward.

Personally I think both the Xamarin forms and the iOS visual designer (which, note, does NOT support Xamarin Forms) are significant features. The iOS designer matters because you can now do almost all of your cross-platform mobile development within Visual Studio, even if you want to follow the old Xamarin model of a different, native user interface for each platform; and Xamarin Forms because it enables a new level of code sharing for Xamarin projects, as well as making XAML into a GUI language that you can use across all the most popular platforms. Note that I do have reservations about XAML; but it does tick the boxes for scaling to multiple form factors and for enormous flexibility.

On Microsoft Surface: premium hardware, declining vision

image
Microsoft’s Panos Panay shows off Surface Pro 3

Microsoft’s Surface Pro 3 was launched yesterday, but the roots of Microsoft’s Surface project – the company’s first own-brand PC – go back a long way. There are three big issues which it attempts to tackle:

1. The PC OEM hardware ecosystem was (and to a large extent still is) stuck in a vicious loop of a price-sensitive market driving down prices and forcing vendors to skimp on design and materials, and to pre-install unwanted third-party applications that damage user experience. Most high-end users bought Macs instead. With Surface Microsoft breaks out of the loop with premium design and zero unwanted add-ons.

2. The tablet market. Windows 8 is designed for touch, at least in its “Metro” personality. But desktop apps need a keyboard and mouse. How do you combine the two without creating a twisty monster? Surface with its fold-back, tear-off keyboard cover is an elegant solution.

3. Fixing Windows. Users of today’s PCs live on a precipice. One false click and the adware and malware invades. Live in the “Metro” environment, or use an iPad, and that is unlikely to happen. Use Windows RT (Windows on ARM) and it is even less likely, since most malware cannot install.

Surface could not have happened without Windows 8. The efforts to make it work as a tablet would make no sense.

Now we have Surface 3. How is Microsoft doing?

I have followed Surface closely since its launch in September 2012. The models I know best are the original Surface RT, the second Surface RT called Surface 2, and the original Surface Pro, which is my machine of choice when travelling. A few observations.

There is plenty that I like (otherwise I would not use it so much). It really is slim and compact, and I would hate to go back to carrying a laptop everywhere. It is well-made and fairly robust, though the hinge on the keyboard covers is a weak point where the fabric can come unglued. The kickstand is handy, and one of my favourite configurations is Surface on its kickstand plus Bluetooth keyboard and mouse, with which I can be almost as productive as with a desktop (I do miss dual displays). I can also use the Surface successfully on my lap. In cramped aircraft seats it is not great but better than a laptop.

There are also annoyances. Only one USB port is a severe limitation and seems unnecessary, since there is room along the edge. For example, you plug in an external drive, now you cannot attach your camera. Not being able to upgrade the internal SSD is annoying, though I suppose inherent to the sealed design. Performance was poor on the original Surface RT, though Surface 2 is fine.

More annoying are the bugs. Sometimes the keyboard cover stops working; detaching and re-attaching usually but not always fixes it. Sometimes the wifi plays up and you have to disable and re-enable the wifi adapter in device manager. Another problem is power management, especially on Surface Pro (I gather that Pro 2 is better). You press power and it does not resume; or worse, you put it into your bag after pressing power off (which sends it to sleep), only to find later that it is heating your bag and wasting precious battery.

The key point here is this: Microsoft intended to make an appliance-like PC that, because of the synergy between first-party hardware and software, would be easy to maintain. It did not succeed, and even Surface RT is more troublesome to maintain than an iPad or Android tablet.

Microsoft also ran into user acceptance problems with Windows RT. Personally I like RT, I think I understand what Microsoft is (or was) trying to achieve, and with Surface specifically, I love the long battery life and easier (though this imperfect) maintenance that it offers. However, the apps are lacking, and Microsoft has so far failed to establish Windows as a tablet operating system like iOS and Android. People buy Windows to run Windows apps, they make little use of the Metro side, and for the most part Surface customers are those who would otherwise have bought laptops.

Incidentally, I have seen Surface RT used with success as a fool-proof portable machine for running Office and feel it deserved to do better, but the reality is that Microsoft has not persuaded the general public of its merits.

Another issue with Surface is the price. Given most Surface customers want the keyboard cover, which is integral to the concept, the cost is more than most laptops. But was Microsoft going for the premium market, or trying to compete with mass-market tablets? In reality, Surface is too expensive for the mass-market which is why its best success has been amongst high-end Windows users.

Surface Pro 3 and the launch that wasn’t

That brings me to Surface Pro 3. The intriguing aspect of yesterday’s launch is that it was rumoured to be for a new mini-sized Surface probably running Windows RT. Why else was the invite (which someone posted on Twitter) for a “small gathering”?

image

Admittedly, it is a stretch to suppose that the Surface Mini was cancelled between the date the invitations were sent out (around four weeks ago I believe) and the date of the event. On the other hand, this is a time of change at Microsoft. The Nokia acquisition completed on  25th April, putting former Nokia CEO Stephen Elop in charge of devices. Microsoft CEO Satya Nadella has only been in place since February 4. While cancelling a major hardware launch at such short notice would be surprising, it is not quite impossible, and a report from Bloomberg to that effect seems plausible.

It is also well-known that Microsoft does not intend to continue with three mobile operating systems: Windows x86, Windows on ARM, and Windows Phone. Windows Phone and Windows RT will “merge”, though merge may just mean that one will be scrapped, and that it will not be Windows Phone.

The promised arrival of a touch-friendly Microsoft Office for Windows Phone and Windows 8 further will rob Windows RT of a key distinctive feature.

This does not mean that Microsoft will not complete in the growing market for small tablets. It means, rather, that a future small tablet from Microsoft will run the Windows Phone OS – which is what some of us thought Microsoft should have done in the first place. This is a company that sometimes takes the hardest (and most expensive) possible route to its destination – see also Xbox One.

Surface Pro 3 specs: a MacBook Air compete

Surface Pro 3 is a large-size Surface Pro. It has a 12 inch 2160×1440 screen, a pen, and a redesigned keyboard cover that has an additional magnetic strip which sticks to the tablet when used laptop-style, for greater stability.

The kickstand can now be used at any angle, supposedly without slipping.

image

The weight is 800g making it lighter than a MacBook Air.

image

though note that the MacBook Air has a keyboard built in.

Battery life is quoted as “up to 9 hours”. There is still only one USB port. Full specs are here.

The Surface Pro 3 looks like a nice device. In the UK it starts at £639 for an Intel i3 device with a tiny 64GB SSD (I am running out of space with 128GB). And don’t forget the cover which will be at least £110 on top (prices include VAT).

A sensible Core i5 with 256GB SSD and a Type 2 cover will be around £1200. Not a bad buy; though personally I am not sure about the larger size.

Note that Microsoft has now abandoned the 16:9 wide-screen format which characterised the original release of Windows 8, designed to work well with two apps side by side. Surface Pro 3 has a conventional 3:2 screen ration.

Declining vision

Microsoft’s Surface project had a bold vision to reinvent Windows hardware and to usher in a new, more secure era of Windows computing, where tablet apps worked in harmony with the classic desktop.

It was bold but it failed. A combination of flawed implementation, patchy distribution, high prices, and above all, lack of success in the Windows Store ecosystem, meant that Surface remained at ground level.

What we have now is, by all accounts, an attractive high-end Windows hybrid. Not a bad thing in itself, but far short of what was originally hoped.

Microsoft is moving on, building on its investment in Active Directory, Azure cloud, and Microsoft Office, to base its business on an any-device strategy. The market has forced its hand, but it is embracing this new world and (to my mind) looks like making a success of it. It does not depend on the success of Surface, so whether or not the company ends up with a flourishing PC business is now almost incidental.

Hands on with Cordova in Visual Studio

At TechEd this week, Microsoft announced Apache Cordova support in Visual Studio 2013. A Cordova app is HTML and JavaScript wrapped as a native app, with support for multiple platforms including iOS and Android. It is the open source part of Adobe’s PhoneGap product. I downloaded the preview from here and took a quick look.

There is a long list of dependencies which the preview offers to install on your behalf:

image

and

image

The list includes the Java SDK, Google Chrome and Apple iTunes. The documentation explains that Java is required for the Android build process, Chrome is required to run the Ripple emulator (so you could choose not to install if you do not require Ripple), and iTunes is required for deploying an app to an iOS device, though a Mac is also required.

The license terms for both Chrome and iTunes are long and onerous, plus iTunes is on my list of applications not to install on Windows if you want it to run fast. Chrome is already installed on my PC, and I unchecked iTunes.

Next, I ran Visual Studio and selected a Multi-Device Hybrid App project (I guess “Cordova app” was rejected as being too short and simple).

image

An annoyance is that if you use the default project location, it is incompatible because of spaces in the path:

image

The project opened, and being impatient I immediately hit Run.

When you build, and debug using the default Ripple emulator (which runs in Chrome, hence the dependency), Visual Studio grabs a ton of dependencies.

image

and eventually the app runs:

image

or you can debug in the Android emulator:

image

A good start.

Microsoft has some sample projects for AngularJS, BackboneJS and WinJS. This last is intriguing since you could emulate the Windows Phone look and feel (or something like it) on Android on iOS, though it would look far from native.

The preview is not feature-complete. The only supported device targets are Android 4.x, IOS 6 and 7, Windows 8.x Store apps, and Windows Phone 8.x. Windows Phone debugging does not work in this preview.