Skip to content

Instantly share code, notes, and snippets.

@caiorss
Forked from pillowsoft/AppDelegate.fs
Created December 19, 2016 19:52
Show Gist options
  • Save caiorss/41ee005c35480a7b5ea1cea66cf43cb2 to your computer and use it in GitHub Desktop.
Save caiorss/41ee005c35480a7b5ea1cea66cf43cb2 to your computer and use it in GitHub Desktop.
F# iOS app that gives INotifyProperty needed error (and other) work with Xamarin.Forms, AddIn 5.02 and latest FSharp (3.1 from github) on Mac
namespace TestiOS
open System
open MonoTouch.UIKit
open MonoTouch.Foundation
open System
open System.ComponentModel
open Xamarin.Forms
open Xamarin.Forms.Platform.iOS
type ButtonCodePage() as this =
inherit ContentPage()
[<Core.DefaultValue>] val mutable actt:Action<int>
let mutable count = 0
let button = new Button(Text = String.Format("Tap for click count!"))
do
button.Clicked.Add(fun _ ->
count <- count + 1
button.Text <- String.Format("{0} click{1}!", count, if count = 1 then "" else "s")
)
this.Content <- button
type App() =
static member GetMainPage() =
new ButtonCodePage()
[<Register ("AppDelegate")>]
type AppDelegate () =
inherit UIApplicationDelegate ()
[<Core.DefaultValue>] val mutable window:UIWindow
// This method is invoked when the application is ready to run.
override this.FinishedLaunching (app, options) =
Forms.Init()
this.window <- new UIWindow(UIScreen.MainScreen.Bounds)
this.window.RootViewController <- App.GetMainPage().CreateViewController()
this.window.MakeKeyAndVisible()
true
module Main =
[<EntryPoint>]
let main args =
UIApplication.Main (args, null, "AppDelegate")
0
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">iPhoneSimulator</Platform>
<ProjectTypeGuids>{6BC8ED88-2882-458C-8E55-DFD12B67127B};{4925A630-B079-445D-BCD4-3A9C94FE9307}</ProjectTypeGuids>
<ProjectGuid>{B31ECFE9-18F8-462D-A466-17C7D4290617}</ProjectGuid>
<OutputType>Exe</OutputType>
<RootNamespace>TestiOS</RootNamespace>
<IPhoneResourcePrefix>Resources</IPhoneResourcePrefix>
<AssemblyName>TestiOS</AssemblyName>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|iPhoneSimulator' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\iPhoneSimulator\Debug</OutputPath>
<DefineConstants>DEBUG;__MOBILE__;__IOS__</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<Tailcalls>false</Tailcalls>
<ConsolePause>false</ConsolePause>
<CodesignEntitlements>Entitlements.plist</CodesignEntitlements>
<PlatformTarget>
</PlatformTarget>
<MtouchDebug>true</MtouchDebug>
<MtouchLink>None</MtouchLink>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|iPhoneSimulator' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\iPhoneSimulator\Release</OutputPath>
<DefineConstants>__MOBILE__;__IOS__</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<PlatformTarget>
</PlatformTarget>
<CodesignEntitlements>Entitlements.plist</CodesignEntitlements>
<ConsolePause>false</ConsolePause>
<Tailcalls>true</Tailcalls>
<MtouchLink>None</MtouchLink>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|iPhone' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\iPhone\Debug</OutputPath>
<DefineConstants>DEBUG;__MOBILE__;__IOS__</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<Tailcalls>false</Tailcalls>
<ConsolePause>false</ConsolePause>
<MtouchDebug>true</MtouchDebug>
<PlatformTarget>
</PlatformTarget>
<CodesignKey>iPhone Developer</CodesignKey>
<CodesignEntitlements>Entitlements.plist</CodesignEntitlements>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|iPhone' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\iPhone\Release</OutputPath>
<DefineConstants>__MOBILE__;__IOS__</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<PlatformTarget>
</PlatformTarget>
<CodesignKey>iPhone Developer</CodesignKey>
<ConsolePause>false</ConsolePause>
<Tailcalls>true</Tailcalls>
<CodesignEntitlements>Entitlements.plist</CodesignEntitlements>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Ad-Hoc|iPhone' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\iPhone\Ad-Hoc</OutputPath>
<DefineConstants>__MOBILE__;__IOS__</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<Tailcalls>true</Tailcalls>
<ConsolePause>false</ConsolePause>
<CodesignKey>iPhone Distribution</CodesignKey>
<PlatformTarget>
</PlatformTarget>
<CodesignEntitlements>Entitlements.plist</CodesignEntitlements>
<CodesignProvision>Automatic:AdHoc</CodesignProvision>
<BuildIpa>true</BuildIpa>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'AppStore|iPhone' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\iPhone\AppStore</OutputPath>
<DefineConstants>__MOBILE__;__IOS__</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<Tailcalls>true</Tailcalls>
<ConsolePause>false</ConsolePause>
<CodesignKey>iPhone Distribution</CodesignKey>
<PlatformTarget>
</PlatformTarget>
<CodesignProvision>Automatic:AppStore</CodesignProvision>
<CodesignEntitlements>Entitlements.plist</CodesignEntitlements>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Xml" />
<Reference Include="System.Core" />
<Reference Include="mscorlib" />
<Reference Include="FSharp.Core" />
<Reference Include="monotouch" />
<Reference Include="Xamarin.Forms.Platform.iOS">
<HintPath>..\packages\Xamarin.Forms.1.0.6188\lib\MonoTouch10\Xamarin.Forms.Platform.iOS.dll</HintPath>
</Reference>
<Reference Include="Xamarin.Forms.Core">
<HintPath>..\packages\Xamarin.Forms.1.0.6188\lib\MonoTouch10\Xamarin.Forms.Core.dll</HintPath>
</Reference>
<Reference Include="Xamarin.Forms.Xaml">
<HintPath>..\packages\Xamarin.Forms.1.0.6188\lib\MonoTouch10\Xamarin.Forms.Xaml.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Folder Include="Resources\" />
</ItemGroup>
<ItemGroup>
<None Include="Info.plist" />
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<Compile Include="AppDelegate.fs" />
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath32)\..\Microsoft SDKs\F#\3.1\Framework\v4.0\Microsoft.FSharp.Targets" />
<Import Project="../packages/Xamarin.Forms.1.0.6188/build/portable-win+net45+wp80+MonoAndroid10+MonoTouch10/Xamarin.Forms.targets" />
</Project>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment