F# iOS Program: 39 lines of code

Xamarin loves F#!


Of course you can use F# to program iOS and Android applications using Xamarin and Visual Studio!

[code lang="fsharp"]
namespace Simple

open System
open MonoTouch.UIKit
open MonoTouch.Foundation
open System.Drawing

type ContentView ( color : UIColor ) as self =
inherit UIView ()
self.BackgroundColor \< - color

type SimpleController …

more ...

Cheatsheet for iOS 7 Design Sizes

Helpful: http://ivomynttinen.com/blog/the-ios-7-design-cheat-sheet/

more ...

Natively Recognize Barcodes/QR Codes in iOS 7 with Xamarin.iOS

There have been great barcode-reading libraries available for Xamarin for some time, but iOS 7 has built-in barcode-recognition support.

There's only one tricky bit: you have to tell the AVCaptureMetadataOutput what types of barcodes you're interested in after you've added it to the AVCaptureSession. (I suppose what happens behind the …

more ...

My Favorite iOS 7 APIs Part 3 : CoreMotion (iPhone 5S only)

The new M7 coprocessor in the iPhone 5S makes pedometer apps trivial:

[code lang="csharp"]
var counter = new CMStepCounter();
//Last 8 hours
counter.QueryStepCount(NSDate.FromTimeIntervalSinceNow(-8 * 60 * 60), NSDate.Now, NSOperationQueue.CurrentQueue, StepQueryHandler);

void StepQueryHandler(int nssteps, NSError error)

more ...

My Favorite iOS 7 APIs: Multipeer Connectivity

Multipeer Connectivity allows you to discover and share data with other iOS devices within Bluetooth radio range or on the same WiFi subnet. It is much easier to use than Bonjour.

I wrote a simple MPC chat program in Xamarin.iOS.

There's necessarily a few hundred lines of code, but …

more ...

Dynamic Type in iOS 7: Not Quite as "Dynamic" as You Might Think

One of the nice features in iOS 7 for old fogeys such as myself is that the user can use the general Settings to increase and decrease the fonts used in apps. This is called "Dynamic Type." Judging by developer forums, I'm not the only one who thought that this …

more ...

Xamarin Code for iBeacons

Did I mention how easy it is to track an iBeacon using Xamarin?

[code lang="csharp"]
locationManager = new CLLocationManager();
var beaconId = new NSUuid("E437C1AF-36CE-4BBC-BBE2-6CE802977C46");
var beaconRegion = new CLBeaconRegion(beaconId, "My Beacon");
locationManager.RegionEntered += (s, e) => {
if(e.Region.Identifier == "My Beacon")
Console.WriteLine("Found My Beacon");
//Fire up ranging
locationManager …

more ...

My Favorite iOS 7 APIs Part 1: iBeacons and Multipeer Connectivity

Since Xamarin provides full native capabilities, developers don't need to wait for us to exploit iOS 7's awesome new APIs, such as:

  • iBeacon: This, to my mind, is the stealth API of the release. An iBeacon is a Bluetooth device (just iOS devices for now, but Apple says they'll release …

more ...

3D Maps in iOS 7 with Xamarin

It's trivially simple to show 3D maps in iOS 7:

[code lang="csharp"]
var target = new CLLocationCoordinate2D(37.7952, -122.4028);
var viewPoint = new CLLocationCoordinate2D(37.8009, -122.4100);
//Enable 3D buildings
mapView.ShowsBuildings = true;
mapView.PitchEnabled = true;

var camera = MKMapCamera.CameraLookingAtCenterCoordinate(target, viewPoint, 500);
mapView.Camera = camera;


more ...