Exploring HealthKit With Xamarin: Provisioning and Permissions Illustrated Walkthrough

One of the more interesting frameworks in iOS 8 is Health Kit, system-wide persistent storage for health-related information. I'm just beginning to explore the namespace myself, but thought I'd walk through the steps you need to manipulate Health Kit with Xamarin.

Because health-related information is so sensitive, developing for Health …

more ...

The Protocol Pattern

In C# (and F#), one can define extension methods on interfaces. These extension methods can have implementations, which can be used as default implementations for implementors of the extension. I haven't heard a name for this technique.

Example:

[code lang="csharp"]
interface IFoo
{

}

static class IFoo_Extensions
{
public static void …

more ...

Local Notifications in iOS 8 With Xamarin

As of iOS 8, the user has to provide explicit permission for apps to respond to local notifications. This means that now, the first time the program is run, you need to run code such as:

[code lang="fsharp"]
//F#
UIUserNotificationSettings.GetSettingsForTypes(
UIUserNotificationType.Alert
||| UIUserNotificationType.Badge
||| UIUserNotificationType.Sound,
new NSSet …

more ...

F# For Scripting

It's F# Week at Xamarin. Also, in the US, it's only a 4-day work-week. F# saves 20% of your time. QED.

Anyway, I don't have any actually interesting F# to share, but I recommend:

more ...

iOS 8, Scene Kit @ 60FPS, programmed in F#, using Xamarin.iOS

I have the best job in the world:

[code lang="fsharp"]
namespace SceneKitFSharp

open System
open MonoTouch.UIKit
open MonoTouch.Foundation
open MonoTouch.SceneKit
open MonoTouch.CoreAnimation

type MySceneKitController () =
inherit UIViewController()

override this.ViewDidLoad () =
let scene = new SCNScene ()

//Positions everyone!
let boxNode = new SCNNode ()
boxNode.Geometry \<- new SCNBox(
Width = 1 …

more ...

Using Xamarin.Forms.Maps: You have to Init() first!

The first time I wrote a Xamarin.Forms.Maps program, I couldn't figure out why my map wasn't appearing. And then I put a call to Xamarin.FormsMaps.Init() into the AppDelegate (iOS) and MainActivity (Android):

Shared:

[code lang="csharp"]
public class App
{
public static Page GetMainPage ()
{
return new ContentPage …

more ...

50 PRINT "HAPPY BIRTHDAY"

I think BASIC's greatest strength may be that it was something that many people -- not just those with a particular background -- could learn. There was no gatekeeper, either literally or figuratively: you didn't have to push punchcards under a bank-teller window nor did you have to learn recursion before learning …

more ...

Reviewing Values for iOS UIViewContentMode with Xamarin and F#

Who can remember the scaling behavior of UIView.ContentMode? Not me!

So I wrote this quick little F# program to review them:

[code lang="fsharp"]
namespace Simple

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

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

more ...

Review of my Xamarin F# Event Code Leads To Improvements

Not at all surprisingly, it turns out that F# events need not be the crufty structures I showed in my previous post.

First, Xamarin's David Siegel suggested "Let the Event type be inferred, don't define a delegate type, and send simple typed values rather than EventArgs:"

open System

type Control …

more ...

Review of my first real F# program written in Xamarin

tl;dr: F# has a long learning curve (it takes a long time to master) but productivity happens quickly.


I recently wrote my first real application in F#. Although I've been using F# for many of my scripting needs for about a year and use F# to explore iOS APIs …

more ...