xamarin.forms in visual studio magazine

enlightened lazinessIt’s a sign of the times when Visual Studio Magazine covers a development tool that’s neither Visual Studio nor even made by Microsoft. Lately, they’ve been giving a lot of love to Xamarin, which lets you code with C# and the .NET Framework to create native Android, iOS, MacOS, and Windows apps, with particular attention paid to Xamarin.Forms, their new cross-platform UI API that lets you target Android, iOS, and Windows Phone with a single code base.

With Xamarin.Forms, you build mobile UIs using an API that abstracts away each mobile OS’s particular features as far as the developer is concerned. When you create a Button in Xamarin forms, it becomes an Android Button instance on Android devices and a UIButton view on iOS devices. I’ve been noodling with Xamarin.Forms for the past few weeks and it looks like it’s the tool I’ll use to build sales, marketing, and training apps for partner organizations of GSG, the company I work for.

Why use Xamarin.Forms?

In their article, Simplifying Cross-Platform Mobile App Development with Xamarin.Forms, Visual Studio Magazine’s Wallace McClure suggests that you ask these questions when considering adopting Xamarin.Forms as your development platform:

  • What type of expertise do you currently have? A company that has invested heavily in C# and the Microsoft .NET Framework would have a significant burden taking on Objective-C for iOS and Java for Android.
  • How much do you want to invest for the application you’re developing? Web applications tend to be lower cost to get started. As customers ask for more features, the cost to continually add platform-specific features tends to cost more money than merely adding features to a platform-specific application. Will the application fit within a Web application forever, or will end users ask for features that will result in a dead-end Web interface? What happens when an application needs to use the image processing capabilities in iOS? Will the time, effort, and money spent building a Web application end up being a sunk cost?
  • What’s your end-customer expectation? End customers want apps that look like all of the other apps with which they work. Giving iOS users an application that looks like some generic platform (think jQuery Mobile default themes) results in some strange looks from those users. While they won’t hate the application, they won’t love the application as much as if they’d been presented with a platform-looking application.
  • Increasing the productivity of end users tends to be much more valuable than increasing the productivity of developers. End users outnumber developers by many times. I have a client with approximately 3,000 end users using an application I’ve written. A simple 5 percent increase in end-user productivity would greatly offset a 50 percent increase in developer productivity gained by using a cross-platform framework.

Xamarin.Forms in action

The article also features a sample app, which takes JSON data from a remote source via .NET’s HttpClient and displays it in list form as shown below:

xamarin data binding example

It’s worth noting that they don’t show a Windows Phone screenshot — just Android and iOS. You can download the code here.

What do developers make of Xamarin.Forms?

Another Visual Studio Magazine article, Xamarin.Forms: What Developers Make of It, has McClure talking to developers who participated in the Xamarin.Forms beta program as well as Xamarin evangelist Craig Dunn. Some quotes:

  • I really like Xamarin.Forms for creating simple and complex UIs for cross-platform (mobile) apps. I’m currently working on a video catalog app for a local telco, which I’ll be building the app for iOS, Android and Windows Phone. The user will scroll through a list of categories and TV shows and pick a video to watch on the handset. The data (menu structure) comes from a JSON feed and is perfect for Xamarin.Forms. Instead of creating a separate UI for each platform I can use one code base to cover all three platforms. I’m very excited about that.”
  • One of the most useful things in XAML is the DataBinding platform and this saves a lot of time in tracking properties and changes. Now it’s in Xamarin via XF [Xamarin.Forms]. Also, you can now separate your UI code from your business/logic code and have a clearer separation of concerns.”
  • The main benefit is that if you have a .NET background or know how to write C# code or F# and want to start building mobile apps, you can start immediately with Xamarin. You won’t need to learn a new programming language, and you can reuse all of your .NET skills building mobile apps. At the same time you are saving precious time by reusing your business logic between platforms, and even your UI if you are using Xamarin.Forms. You should use Xamarin.Forms if your main goal is to develop for all three platforms and share some UI between them.”
  • “The project has great traction because Xamarin.Forms is being widely adopted by many developers. We have around 10 contributors, almost 350 commits and we have NuGet packages with around 600 downloads — all this in less than two months of Xamarin.Forms being publicly available.”

Xamarin Test Cloud

xamarin test cloud

Xamarin isn’t just doing their part for cross-platform coding, but cross-platform testing as well, with Xamarin Test Cloud. Xamarin Test Cloud lets you test your apps on thousands on devices with your having to acquire them all. According to the Visual Studio Magazine article Xamarin Test Cloud Now Available:

Xamarin Test Cloud can provide simulated testing environments for more than 1,000 devices, from desktops to mobile devices and includes the various OS versions on a number of platforms.

Xamarin Test Cloud can be used to automate testing of apps through its Calabash cross-platform test automation framework whether developers are working in any C# or Ruby supported tool suite, and can report back on memory and CPU usage performance and test durations. Automated testing can be integrated into Team Foundation Server and other continuous integrations systems like Jenkins and TeamCity.

Xamarin Test Cloud is able to gain access and collect diagnostics information from device logs, stack traces and through hardware data to generate performance reports for more accuracy.

{ 0 comments }

Swift roundup: Game programming!

by Joey deVilla on October 2, 2014

swift kick

Today’s Swift Kick features a roundup of tutorials and resources for the Swift developer who’s into game programming. If you’ve been meaning to learn Swift, games are a fun way to do so, and if you’ve been meaning to learn game programming, you’ll find these useful!

Brian Advent’s tutorial on building a networked tic-tac-toe game with Swift and the Multipeer Connectivity Framework

Brian Advent (whom I’ve written about before) has posted a video tutorial showing how to build a networked tic-tac-toe game using iOS’ Multipeer Connectivity Framework, which allows you to connect and share data with devices nearby.

RayWenderlich.com’s Sprite Kit Tutorial for Beginners updated for Swift

ray wenderlich ninja game

Two years ago, Ray Wenderlich posted the sort of game programming tutorial that he wanted to see: in his own words, “very simple but functional game with animation, collisions, and audio without using too many advanced features.” The resulting game is the one pictured above, featuring a shuriken-hurling ninja taking on approaching monsters.

The game was originally written in Objective-C and used the open source cross-platform 2D gaming framework Cocos2D 1.X, and was followed by an update for Cocos2D 2.X. When Sprite Kit came out, Ray wrote a new version of the game using that framework, and I took some ideas from that game and turned it into a simple shoot ‘em up game in Swift.

Ray’s updated his Sprite Kit Tutorial for Beginners for Swift, and it’s a great way to brush up on Swift and game programming at the same time. Check it out!

Conway’s Game of Life in functional Swift

life

While it can be argued that Swift is not a functional programming language, it certainly lends itself better to functional programming techniques than many other languages, Objective-C included. With this in mind, take The Game of Life with Functional Swift, written by Colin Eberhardt, one of the co-authors of the RayWenderlich.com books iOS8 by Tutorials, Swift By Tutorials, and Core Data by Tutorials. He writes:

This blog post shows an implementation of Conway’s Game of Life using functional techniques in Swift. This results in code which is a clear and concise representation of the game’s logic. I also take a closer look at ranges, intervals, the pattern match operator, ~= and how local functions help organise your code.

Taking a functional programming approach allowed Colin to condense the rules of Conway’s Game of Life down to this:

If you’re looking for a challenge, you might want to take MakeGamesWith.Us’ implementation of the Game of Life (pictured below) and refactor it using Colin’s functional approach.

life in swift

SwiftCast: Game Programming in Swift

The latest Swiftcast, which you can listen to using the player above, is all about game programming in Swift:

Swift game development is very exciting. If it isn’t already obvious with the content of our site, we love to talk about game development. Mobile gaming is a rapidly growing market, and iOS is by far the most rewarding and exciting to build games for. If you’ve ever wanted to learn how to build an iOS game as an indie developer, we have some resources and advice for you.

iOS Games by Tutorials updated for Swift

RayWenderlich.com’s book, iOS Games by Tutorials, has been updated for iOS 8 and Swift. In 28 chapters and over 800 pages, you’ll learn game programing with Swift and Sprite Kit by building the following games:

zombie conga

Zombie Conga, where the player is a partying zombie who’s trying to build a conga line of cats while avoiding crazy cat ladies. It covers introductory topics such as sprites, processing touches, collision detection and scrolling.

XBlaster

XBlaster: a space shooter where you’ll work with physics and particle systems.

cat nap

Cat Nap, where you’re trying to help a sleepy kitty get to bed. This is a “physics-based” game, so this introduces the Sprite Kit’s physics engine starting with the basics, but getting into stuff advanced enough for you to write your own version of Angry Birds or Cut the Rope.

pest control

Pest Control, a tile-mapped game where you take a Schwarzeneggarian hero on a bug-killing spree. This covers building a tile-mapping engine and adding all sorts of effects to a game.

circuit racer

Circuit Racer, a racing game made more complicated by obstacles on the track. This one features mixing Sprite Kit-based UIs with UIKit-based UIs, using the accelerometer, and interfacing with Game Center.

Also covered:

  • Porting your iOS games to OS X
  • Using texture atlases for reduced memory overhead and better performance
  • Tips and tricks for getting the most performance out of your game code
  • Basic game art-making for programmers

iOS Games by Tutorials is available in PDF form for $54, and it’s a great deal at the price. Buying it also gets you free updates for the life of the book; if you bought the earlier Objective-C/iOS 7 edition, you already own the current Swift/iOS 8 edition!

…and don’t forget…

The Flappening, in which I fix the implementation of Flappy Bird that changes to iOS’ Swift APIs broke, and…

my simple “shoot ‘em up” game in Swift, which has also been updated to work with post-beta Swift.

{ 0 comments }

swift kickA couple of quick updates about the simple “shoot ‘em up” game tutorial app written in Swift with Sprite Kit that I posted a little while back:

{ 0 comments }

Xcode 6.1 beta 3 and iOS 8.1 beta are out!

by Joey deVilla on September 29, 2014

do you feel lucky geek

For those of you who like living on the edge, beta 3 of Xcode 6.1 (the current stable version is 6.0) is now available to registered iOS developers. Of note in this release:

  • More APIs have been made optional-conformant. The good news is that code will make more sense. The bad news is that some existing code may break.
  • Value of type Any can now contain function-type values, as you might come to expect from a value named Any.
  • Documentation for the standard library, which shows up in quick help and in the synthesized header for the Swift module, is improved.
  • All the *LiteralConvertible protocols now use initializers for their requirements rather than static methods starting with convertFrom. Any type that previously conformed to one of these protocols will need to replace its convertFromXXX static methods with the corresponding initializer.
  • Xcode now produces fixit hints to move code from the old-style fromRaw()/toRaw() enum APIs to the new style-initializer and rawValue property.
  • Class properties don’t need to be marked final to avoid O(n) mutations on value semantic types.
  • iOS Playgrounds now support displaying animated views with the XCPShowView() XCPlayground API. This is disabled by default, but can be enabled by checking the Run in Full Simulator checkbox in the Playground Settings inspector. When this checkbox is checked, running the playground will cause the iOS Simulator application to launch and run the playground in the full simulator. This is also required for some other functionality that fails without the full iOS Simulator, such as NSURLConnection http requests. Running in the full iOS Simulator is slower than running in the default mode.
  • Apple has addressed an issue that could cause Xcode to become unresponsive while editing Swift code.
  • Dead code stripping no longer removes public declarations from Swift application targets which are needed by unit testing.
  • Weakly-linked symbols no longer cause compilation errors in Playgrounds .
  • Swift expressions like expr, p, and print that are evaluated from the LLDB prompt in the Debugger console will now work on 32-bit iOS devices.
  • Profiling App Extensions with Instruments now works.
  • Ampersand and double quotation mark characters are now fully supported in the company name for iOS projects you create.

Also available for download is iOS 8.1 beta. As with Xcode 6.1 beta, you have to be a registered Apple developer to get it now.

Remember, these are betas, and the standard caveats apply.

I’ll close with the Dirty Harry clip referenced in the photo at the top of this article, for the benefit of younger readers who may not be familiar with Mr. Clint Eastwood’s iconic character:

{ 0 comments }

RootMetrics gives Verizon top marks for its wireless network

rootmetrics on us carriers

Investment site The Motley Fool points to RootMetrics’ report for mobile carrier performance for the first half of 2014, which shows Verizon as the best overall performer of the “Big Four”. RootMetrics’ methodology incorporates thousands of mobile network performance tests performed on voice, text, and data from the consumer’s point of view. In the most recent round of these tests, Verizon performed best in reliability, speed, voice call performance, and data performance. AT&T beat them out in text message performance.

rootmetrics tests 1

rootmetrics tests 2

rootmetrics test 3

Click on any of these test graphs to see the RootMetrics report.

The Motley Fool credits Verizon’s XLTE — their branding for their Advanced Wireless Service (AWS) spectrum — which allows them to offer more than double the bandwidth provided by 4G LTE to customers, and this often yields faster connection speeds. Verizon has made XLTE available to 80% of its wireless market and 35% of devices currently on their network, and nearly all the devices it sells are XLTE-compatible.

total us carrier subscribers

Graph from Jan Dawson’s US wireless market trends for 2014 slide deck.
Click to see the source.

Verizon added 1.4 million net new wireless subscriptions in Q2 2014, and most of them — nearly 1.2 million — were tablet subscribers, not phone subscribers. Tablet mobile plan subscriptions are typically secondary subscriptions (with the primary one being for a mobile phone), and this, coupled with the fact that they’re one of the top 2 carriers in the US, suggests that their focus is on retaining customers and keeping their churn rate down. They seem to be succeeding in this goal, considering that they’ve kept their churn to under 1% for postpaid subscribers in Q2 2014.

Worth reading: Jan Dawson’s US wireless market trends for 2014 slide deck

The last graph in the segment above comes from US wireless market trends for 2014, a slide deck created by Jackdaw Research’s chief analyst, Jan Dawson. The deck looks at the wireless market’s financials (revenues, profitability, capital intensity), subscribers (total subscriptions, net adds, churn), and device trends (subsidies and penetration). If you want a good overview of the market, this is a good place to start.

AT&T offers double the data for family plans

att double data chart
att jpgFrom now until October 31, a family currently on AT&T’s Mobile Share Value plan can apply to get double the data on their plan for the same price. The deal doesn’t expire once you’ve signed up for it, but you do have to sign up for it, as it’s not automatically offered, and you have to do so before Hallowe’en.

Want an unlocked iPhone 6? T-Mobile’s got ‘em!

t-mobileIf you’ve got the money to buy it outright from the get-go, T-Mobile can help you; they’re the only US carrier who sells unlocked, contract-free iPhone 6. If you take this route, you’ll have to pay off any installment balance remaining on it and use the T-Mobile network for 40 days, which is the usual policy for T-Mobile. Once those 40 days have passed, you can switch to the network of your choice.

this article also appears in the GSG blog

{ 0 comments }

For a while, FlappySwift — an implementation of Flappy Bird put together by the folks at FullStack.io as part of a Swift development course — was the go-to GitHub repo for understanding both Swift and Sprite Kit. Then, Xcode 6 beta 7 happened and…

xcode beta 7 broke everything

At the beginning of the beta period, many of Apple’s APIs returned values as implicitly unwrapped optionals, which I suspect was a quick and dirty way to get a large number of APIs Swift-compatible. As the beta period went on, they started changing the APIs for optional conformance, which means that:

  • If an API call was going to return a value that might be nil, it would do so as an optional, and
  • if an API call would never return a nil value, it would do so as a non-optional.

A lot of the APIs were updated for optional conformance in Xcode 6 beta 7, including Sprite Kit, which means that suddenly a lot of Swift game code broke. Any code that expected to be using PhysicsBody! objects was suddenly dealing with PhysicsBody? objects and therefore wouldn’t run thanks to a crop of PhysicsBody? does not have a member named [SomeMember] errors.

I explained how to fix this problem in an article titled Why your Swift apps broke in Xcode 6 beta 7 and the GM versions, and how to fix them, but I thought I’d do one better.

I decided to fork the FlappySwift repo, make the necessary fixes, and post the resulting working new version on GitHub.

Now there’s a Swift version of Flappy Swift that will compile under the Xcode 6 GM and the optional-conformant APIs. Enjoy!

{ 0 comments }

BlackBerry Passport’s big screen

blackberry passport american cheese

The Canadian BlackBerry Passport meets American cheese…and dirty fingernails.

Nothing conveys the size of the BlackBerry Passport’s screen as well as this photo from Charlie Wells’ recent tweet:

Bendgate

bendgate

The current kerfuffle in mobile technology goes by the name “Bendgate” (or my favorite, “Bendghazi”), in which a number of users have reported that their brand-new iPhone 6 Plus devices would have a tendency to warp and bend while in their pockets.

I’ll leave it to tech videographer extraordinaire Marcus Brownlee to explain it in detail:

In response, the Apple PR machine has given tours of their iPhone torture-testing facilities:

In a story on The Verge, Josh Lowensohn reports that 30,000 iPhone 6 units — 15,000 of the 4.7″ iPhone 6 and 15,000 of the 5.5″ iPhone 6 Plus — underwent testing at Apple’s labs, where he saw phone undergoing all manner of stresses that they might undergo in regular (and some not-so-regular) everyday use. Apple report that they’ve received a mere 9 complaints.

Whether or not your bent iPhone 6 is your fault, chances are that if you take your bent iPhone 6 to the Genius Bar at your local Apple Store, they just might replace it, given their mandate and training to provide maximum customer satisfaction.

No Galaxy Note Edge for you!

samsung galaxy note edge
Remember Samsung’s Galaxy Note Edge, which we wrote about in our article covering the IFA trade show? It turns out that despite all the promotion, it’s a concept device.

galaxy edge edge

The phablet, which boasted a screen that curved around its right edge, with the curve acting as a second screen that could be viewed from its side, is a limited edition device whose primary purpose is simply to, as PC World puts it, “scream ‘First!'”. According to them, there will be limited sales in South Korea next month, and only way you’ll have a chance of getting one in the U.S. is either by being very lucky or knowing someone high up in Samsung US.

FBI director “very concerned” about new Apple and Google smartphone privacy features

fbi director james comey

In response to announcements from Apple and Google about enabling encryption on their mobile operating systems that would keep out both thieves and law enforcement, FBI director James Comey expressed his concern:

“I like and believe very much that we should have to obtain a warrant from an independent judge to be able to take the content of anyone’s closet or their smart phone. The notion that someone would market a closet that could never be opened — even if it involves a case involving a child kidnapper and a court order — to me does not make any sense.”

The Verge provides some valuable perspective in their article on the subject in these two paragraphs, which we’ll close with:

If this fight sounds familiar, it’s because much of the 90s was spent on exactly this legal question, a fight that’s now known as the Crypto Wars. PGP founder Phil Zimmermann almost went to jail over it. Of course, because it was the 90s, the fight was over desktop hard drives rather than phones, but when the dust settled, the courts ruled it was completely legal and large, reputable companies like Microsoft and Apple started offering full-disk encryption services without anyone making a fuss about it. Julian Sanchez has a great rundown of how it happened and why it was a good decision, but the general punchline is that it’s hard to build a backdoor that can only be used by the good guys.

It should also be pointed out that Comey’s refreshing enthusiasm for warrants is not shared across all federal agencies. Surveillance of this type frequently happens under a much lower legal standard, whether it’s a subpoena, a National Security Letter or plain old FISC-approved bulk collection. In fact, programs like that are the biggest reason Apple implemented this encryption in the first place, trying to placate concerns over unauthorized government data collection. Unfortunately for Comey, just invoking kidnapped children isn’t enough to undo 20 years of legal precedent.

{ 0 comments }