Add split runtime / design time for iOS and tvos
This commit is contained in:
Родитель
c281ff9895
Коммит
bb3918de52
|
@ -11,6 +11,8 @@ Project("{f2a71f9b-5d33-465a-a702-920d77279786}") = "SingleViewUniversal", "unif
|
||||||
EndProject
|
EndProject
|
||||||
Project("{f2a71f9b-5d33-465a-a702-920d77279786}") = "WatchkitTest", "unified\WatchkitTest\WatchkitTest.fsproj", "{9D0AE0B1-5E14-4539-9F8C-50C20E003E36}"
|
Project("{f2a71f9b-5d33-465a-a702-920d77279786}") = "WatchkitTest", "unified\WatchkitTest\WatchkitTest.fsproj", "{9D0AE0B1-5E14-4539-9F8C-50C20E003E36}"
|
||||||
EndProject
|
EndProject
|
||||||
|
Project("{f2a71f9b-5d33-465a-a702-920d77279786}") = "singleview_tvOS", "unified\singleview_tvOS\singleview_tvOS.fsproj", "{00BF2AD3-867C-4A12-8AE6-907D4F02380F}"
|
||||||
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
Debug|x86 = Debug|x86
|
Debug|x86 = Debug|x86
|
||||||
|
@ -87,11 +89,28 @@ Global
|
||||||
{9D0AE0B1-5E14-4539-9F8C-50C20E003E36}.Ad-Hoc|iPhone.Build.0 = Release|iPhone
|
{9D0AE0B1-5E14-4539-9F8C-50C20E003E36}.Ad-Hoc|iPhone.Build.0 = Release|iPhone
|
||||||
{9D0AE0B1-5E14-4539-9F8C-50C20E003E36}.AppStore|iPhone.ActiveCfg = Release|iPhone
|
{9D0AE0B1-5E14-4539-9F8C-50C20E003E36}.AppStore|iPhone.ActiveCfg = Release|iPhone
|
||||||
{9D0AE0B1-5E14-4539-9F8C-50C20E003E36}.AppStore|iPhone.Build.0 = Release|iPhone
|
{9D0AE0B1-5E14-4539-9F8C-50C20E003E36}.AppStore|iPhone.Build.0 = Release|iPhone
|
||||||
|
{00BF2AD3-867C-4A12-8AE6-907D4F02380F}.Debug|x86.ActiveCfg = Debug|iPhoneSimulator
|
||||||
|
{00BF2AD3-867C-4A12-8AE6-907D4F02380F}.Debug|x86.Build.0 = Debug|iPhoneSimulator
|
||||||
|
{00BF2AD3-867C-4A12-8AE6-907D4F02380F}.Release|x86.ActiveCfg = Debug|iPhoneSimulator
|
||||||
|
{00BF2AD3-867C-4A12-8AE6-907D4F02380F}.Release|x86.Build.0 = Debug|iPhoneSimulator
|
||||||
|
{00BF2AD3-867C-4A12-8AE6-907D4F02380F}.Debug|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator
|
||||||
|
{00BF2AD3-867C-4A12-8AE6-907D4F02380F}.Debug|iPhoneSimulator.Build.0 = Debug|iPhoneSimulator
|
||||||
|
{00BF2AD3-867C-4A12-8AE6-907D4F02380F}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator
|
||||||
|
{00BF2AD3-867C-4A12-8AE6-907D4F02380F}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator
|
||||||
|
{00BF2AD3-867C-4A12-8AE6-907D4F02380F}.Debug|iPhone.ActiveCfg = Debug|iPhone
|
||||||
|
{00BF2AD3-867C-4A12-8AE6-907D4F02380F}.Debug|iPhone.Build.0 = Debug|iPhone
|
||||||
|
{00BF2AD3-867C-4A12-8AE6-907D4F02380F}.Release|iPhone.ActiveCfg = Release|iPhone
|
||||||
|
{00BF2AD3-867C-4A12-8AE6-907D4F02380F}.Release|iPhone.Build.0 = Release|iPhone
|
||||||
|
{00BF2AD3-867C-4A12-8AE6-907D4F02380F}.Ad-Hoc|iPhone.ActiveCfg = Release|iPhone
|
||||||
|
{00BF2AD3-867C-4A12-8AE6-907D4F02380F}.Ad-Hoc|iPhone.Build.0 = Release|iPhone
|
||||||
|
{00BF2AD3-867C-4A12-8AE6-907D4F02380F}.AppStore|iPhone.ActiveCfg = Release|iPhone
|
||||||
|
{00BF2AD3-867C-4A12-8AE6-907D4F02380F}.AppStore|iPhone.Build.0 = Release|iPhone
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(NestedProjects) = preSolution
|
GlobalSection(NestedProjects) = preSolution
|
||||||
{14BE2E7C-3220-4128-A8B2-45DCB985B844} = {84C29D09-A71E-4B50-BD40-A679904BB3D9}
|
{14BE2E7C-3220-4128-A8B2-45DCB985B844} = {84C29D09-A71E-4B50-BD40-A679904BB3D9}
|
||||||
{A202739B-6E4E-4772-A2B6-2E427643FF15} = {84C29D09-A71E-4B50-BD40-A679904BB3D9}
|
{A202739B-6E4E-4772-A2B6-2E427643FF15} = {84C29D09-A71E-4B50-BD40-A679904BB3D9}
|
||||||
{4A95C0B9-1453-47C0-B6A1-FEE6122BD11A} = {84C29D09-A71E-4B50-BD40-A679904BB3D9}
|
{4A95C0B9-1453-47C0-B6A1-FEE6122BD11A} = {84C29D09-A71E-4B50-BD40-A679904BB3D9}
|
||||||
{9D0AE0B1-5E14-4539-9F8C-50C20E003E36} = {84C29D09-A71E-4B50-BD40-A679904BB3D9}
|
{9D0AE0B1-5E14-4539-9F8C-50C20E003E36} = {84C29D09-A71E-4B50-BD40-A679904BB3D9}
|
||||||
|
{00BF2AD3-867C-4A12-8AE6-907D4F02380F} = {84C29D09-A71E-4B50-BD40-A679904BB3D9}
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
EndGlobal
|
EndGlobal
|
||||||
|
|
|
@ -89,8 +89,8 @@
|
||||||
<Reference Include="System.Xml" />
|
<Reference Include="System.Xml" />
|
||||||
<Reference Include="System.Core" />
|
<Reference Include="System.Core" />
|
||||||
<Reference Include="Xamarin.iOS" />
|
<Reference Include="Xamarin.iOS" />
|
||||||
<Reference Include="Xamarin.iOSProviders">
|
<Reference Include="Xamarin.UIProvider.iOSRuntime">
|
||||||
<HintPath>..\..\..\src\Xamarin.iOSProviders\bin\Debug\Xamarin.iOSProviders.dll</HintPath>
|
<HintPath>..\..\..\src\Build\Debug\Xamarin.UIProvider.iOSRuntime.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|
|
@ -9,12 +9,6 @@ open Xamarin.iOSProviders
|
||||||
|
|
||||||
//view controller is generated from the type provider and embedded into the assembly here
|
//view controller is generated from the type provider and embedded into the assembly here
|
||||||
type VCContainer = UIProvider<AbstractController=false>
|
type VCContainer = UIProvider<AbstractController=false>
|
||||||
type VCContainer with
|
|
||||||
member x.Test () = 172
|
|
||||||
// override x.ToString() = ""
|
|
||||||
|
|
||||||
type VCContainer.ViewController with
|
|
||||||
member x.ToString() = "172"
|
|
||||||
|
|
||||||
[<Register ("ViewController")>]
|
[<Register ("ViewController")>]
|
||||||
type ViewController (handle:IntPtr) =
|
type ViewController (handle:IntPtr) =
|
||||||
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
namespace singleview_tvOS
|
||||||
|
|
||||||
|
open System
|
||||||
|
open UIKit
|
||||||
|
open Foundation
|
||||||
|
|
||||||
|
[<Register("AppDelegate")>]
|
||||||
|
type AppDelegate() =
|
||||||
|
inherit UIApplicationDelegate()
|
||||||
|
override val Window = null with get, set
|
||||||
|
// This method is invoked when the application is ready to run.
|
||||||
|
override this.FinishedLaunching(app, options) = true
|
|
@ -0,0 +1,54 @@
|
||||||
|
{
|
||||||
|
"images": [
|
||||||
|
{
|
||||||
|
"idiom": "universal"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"scale": "1x",
|
||||||
|
"idiom": "universal"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"scale": "2x",
|
||||||
|
"idiom": "universal"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"scale": "3x",
|
||||||
|
"idiom": "universal"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"idiom": "iphone"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"scale": "1x",
|
||||||
|
"idiom": "iphone"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"scale": "2x",
|
||||||
|
"idiom": "iphone"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"subtype": "retina4",
|
||||||
|
"scale": "2x",
|
||||||
|
"idiom": "iphone"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"scale": "3x",
|
||||||
|
"idiom": "iphone"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"idiom": "ipad"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"scale": "1x",
|
||||||
|
"idiom": "ipad"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"scale": "2x",
|
||||||
|
"idiom": "ipad"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"info": {
|
||||||
|
"version": 1,
|
||||||
|
"author": "xcode"
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
"info" : {
|
||||||
|
"version" : 1,
|
||||||
|
"author" : "xcode"
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,17 @@
|
||||||
|
{
|
||||||
|
"layers" : [
|
||||||
|
{
|
||||||
|
"filename" : "Front.imagestacklayer"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"filename" : "Middle.imagestacklayer"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"filename" : "Back.imagestacklayer"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"info" : {
|
||||||
|
"version" : 1,
|
||||||
|
"author" : "xcode"
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,54 @@
|
||||||
|
{
|
||||||
|
"images": [
|
||||||
|
{
|
||||||
|
"idiom": "universal"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"scale": "1x",
|
||||||
|
"idiom": "universal"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"scale": "2x",
|
||||||
|
"idiom": "universal"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"scale": "3x",
|
||||||
|
"idiom": "universal"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"idiom": "iphone"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"scale": "1x",
|
||||||
|
"idiom": "iphone"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"scale": "2x",
|
||||||
|
"idiom": "iphone"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"subtype": "retina4",
|
||||||
|
"scale": "2x",
|
||||||
|
"idiom": "iphone"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"scale": "3x",
|
||||||
|
"idiom": "iphone"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"idiom": "ipad"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"scale": "1x",
|
||||||
|
"idiom": "ipad"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"scale": "2x",
|
||||||
|
"idiom": "ipad"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"info": {
|
||||||
|
"version": 1,
|
||||||
|
"author": "xcode"
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
"info" : {
|
||||||
|
"version" : 1,
|
||||||
|
"author" : "xcode"
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,54 @@
|
||||||
|
{
|
||||||
|
"images": [
|
||||||
|
{
|
||||||
|
"idiom": "universal"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"scale": "1x",
|
||||||
|
"idiom": "universal"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"scale": "2x",
|
||||||
|
"idiom": "universal"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"scale": "3x",
|
||||||
|
"idiom": "universal"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"idiom": "iphone"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"scale": "1x",
|
||||||
|
"idiom": "iphone"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"scale": "2x",
|
||||||
|
"idiom": "iphone"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"subtype": "retina4",
|
||||||
|
"scale": "2x",
|
||||||
|
"idiom": "iphone"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"scale": "3x",
|
||||||
|
"idiom": "iphone"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"idiom": "ipad"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"scale": "1x",
|
||||||
|
"idiom": "ipad"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"scale": "2x",
|
||||||
|
"idiom": "ipad"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"info": {
|
||||||
|
"version": 1,
|
||||||
|
"author": "xcode"
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
"info" : {
|
||||||
|
"version" : 1,
|
||||||
|
"author" : "xcode"
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,54 @@
|
||||||
|
{
|
||||||
|
"images": [
|
||||||
|
{
|
||||||
|
"idiom": "universal"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"scale": "1x",
|
||||||
|
"idiom": "universal"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"scale": "2x",
|
||||||
|
"idiom": "universal"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"scale": "3x",
|
||||||
|
"idiom": "universal"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"idiom": "iphone"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"scale": "1x",
|
||||||
|
"idiom": "iphone"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"scale": "2x",
|
||||||
|
"idiom": "iphone"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"subtype": "retina4",
|
||||||
|
"scale": "2x",
|
||||||
|
"idiom": "iphone"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"scale": "3x",
|
||||||
|
"idiom": "iphone"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"idiom": "ipad"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"scale": "1x",
|
||||||
|
"idiom": "ipad"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"scale": "2x",
|
||||||
|
"idiom": "ipad"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"info": {
|
||||||
|
"version": 1,
|
||||||
|
"author": "xcode"
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
"info" : {
|
||||||
|
"version" : 1,
|
||||||
|
"author" : "xcode"
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,17 @@
|
||||||
|
{
|
||||||
|
"layers" : [
|
||||||
|
{
|
||||||
|
"filename" : "Front.imagestacklayer"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"filename" : "Middle.imagestacklayer"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"filename" : "Back.imagestacklayer"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"info" : {
|
||||||
|
"version" : 1,
|
||||||
|
"author" : "xcode"
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,54 @@
|
||||||
|
{
|
||||||
|
"images": [
|
||||||
|
{
|
||||||
|
"idiom": "universal"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"scale": "1x",
|
||||||
|
"idiom": "universal"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"scale": "2x",
|
||||||
|
"idiom": "universal"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"scale": "3x",
|
||||||
|
"idiom": "universal"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"idiom": "iphone"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"scale": "1x",
|
||||||
|
"idiom": "iphone"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"scale": "2x",
|
||||||
|
"idiom": "iphone"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"subtype": "retina4",
|
||||||
|
"scale": "2x",
|
||||||
|
"idiom": "iphone"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"scale": "3x",
|
||||||
|
"idiom": "iphone"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"idiom": "ipad"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"scale": "1x",
|
||||||
|
"idiom": "ipad"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"scale": "2x",
|
||||||
|
"idiom": "ipad"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"info": {
|
||||||
|
"version": 1,
|
||||||
|
"author": "xcode"
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
"info" : {
|
||||||
|
"version" : 1,
|
||||||
|
"author" : "xcode"
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,54 @@
|
||||||
|
{
|
||||||
|
"images": [
|
||||||
|
{
|
||||||
|
"idiom": "universal"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"scale": "1x",
|
||||||
|
"idiom": "universal"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"scale": "2x",
|
||||||
|
"idiom": "universal"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"scale": "3x",
|
||||||
|
"idiom": "universal"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"idiom": "iphone"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"scale": "1x",
|
||||||
|
"idiom": "iphone"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"scale": "2x",
|
||||||
|
"idiom": "iphone"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"subtype": "retina4",
|
||||||
|
"scale": "2x",
|
||||||
|
"idiom": "iphone"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"scale": "3x",
|
||||||
|
"idiom": "iphone"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"idiom": "ipad"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"scale": "1x",
|
||||||
|
"idiom": "ipad"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"scale": "2x",
|
||||||
|
"idiom": "ipad"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"info": {
|
||||||
|
"version": 1,
|
||||||
|
"author": "xcode"
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
"info" : {
|
||||||
|
"version" : 1,
|
||||||
|
"author" : "xcode"
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,26 @@
|
||||||
|
{
|
||||||
|
"assets" : [
|
||||||
|
{
|
||||||
|
"size" : "1280x768",
|
||||||
|
"idiom" : "tv",
|
||||||
|
"filename" : "App Icon - Large.imagestack",
|
||||||
|
"role" : "primary-app-icon"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"size" : "400x240",
|
||||||
|
"idiom" : "tv",
|
||||||
|
"filename" : "App Icon - Small.imagestack",
|
||||||
|
"role" : "primary-app-icon"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"size" : "1920x720",
|
||||||
|
"idiom" : "tv",
|
||||||
|
"filename" : "Top Shelf Image.imageset",
|
||||||
|
"role" : "top-shelf-image"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"info" : {
|
||||||
|
"version" : 1,
|
||||||
|
"author" : "xcode"
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,54 @@
|
||||||
|
{
|
||||||
|
"images": [
|
||||||
|
{
|
||||||
|
"idiom": "universal"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"scale": "1x",
|
||||||
|
"idiom": "universal"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"scale": "2x",
|
||||||
|
"idiom": "universal"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"scale": "3x",
|
||||||
|
"idiom": "universal"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"idiom": "iphone"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"scale": "1x",
|
||||||
|
"idiom": "iphone"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"scale": "2x",
|
||||||
|
"idiom": "iphone"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"subtype": "retina4",
|
||||||
|
"scale": "2x",
|
||||||
|
"idiom": "iphone"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"scale": "3x",
|
||||||
|
"idiom": "iphone"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"idiom": "ipad"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"scale": "1x",
|
||||||
|
"idiom": "ipad"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"scale": "2x",
|
||||||
|
"idiom": "ipad"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"info": {
|
||||||
|
"version": 1,
|
||||||
|
"author": "xcode"
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
"info" : {
|
||||||
|
"version" : 1,
|
||||||
|
"author" : "xcode"
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,162 @@
|
||||||
|
{
|
||||||
|
"images": [
|
||||||
|
{
|
||||||
|
"minimum-system-version": "8.0",
|
||||||
|
"orientation": "portrait",
|
||||||
|
"extent": "full-screen",
|
||||||
|
"size": "414x736",
|
||||||
|
"subtype": "736h",
|
||||||
|
"scale": "3x",
|
||||||
|
"idiom": "iphone"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"minimum-system-version": "8.0",
|
||||||
|
"orientation": "portrait",
|
||||||
|
"extent": "full-screen",
|
||||||
|
"size": "375x667",
|
||||||
|
"subtype": "667h",
|
||||||
|
"scale": "2x",
|
||||||
|
"idiom": "iphone"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"minimum-system-version": "8.0",
|
||||||
|
"orientation": "landscape",
|
||||||
|
"extent": "full-screen",
|
||||||
|
"size": "736x414",
|
||||||
|
"subtype": "736h",
|
||||||
|
"scale": "3x",
|
||||||
|
"idiom": "iphone"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"minimum-system-version": "7.0",
|
||||||
|
"orientation": "portrait",
|
||||||
|
"extent": "full-screen",
|
||||||
|
"size": "320x480",
|
||||||
|
"scale": "2x",
|
||||||
|
"idiom": "iphone"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"minimum-system-version": "7.0",
|
||||||
|
"orientation": "portrait",
|
||||||
|
"extent": "full-screen",
|
||||||
|
"size": "320x568",
|
||||||
|
"subtype": "retina4",
|
||||||
|
"scale": "2x",
|
||||||
|
"idiom": "iphone"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"minimum-system-version": "7.0",
|
||||||
|
"orientation": "portrait",
|
||||||
|
"extent": "full-screen",
|
||||||
|
"size": "768x1024",
|
||||||
|
"scale": "1x",
|
||||||
|
"idiom": "ipad"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"minimum-system-version": "7.0",
|
||||||
|
"orientation": "portrait",
|
||||||
|
"extent": "full-screen",
|
||||||
|
"size": "768x1024",
|
||||||
|
"scale": "2x",
|
||||||
|
"idiom": "ipad"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"minimum-system-version": "7.0",
|
||||||
|
"orientation": "landscape",
|
||||||
|
"extent": "full-screen",
|
||||||
|
"size": "1024x768",
|
||||||
|
"scale": "1x",
|
||||||
|
"idiom": "ipad"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"minimum-system-version": "7.0",
|
||||||
|
"orientation": "landscape",
|
||||||
|
"extent": "full-screen",
|
||||||
|
"size": "1024x768",
|
||||||
|
"scale": "2x",
|
||||||
|
"idiom": "ipad"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"orientation": "portrait",
|
||||||
|
"extent": "full-screen",
|
||||||
|
"size": "320x480",
|
||||||
|
"scale": "1x",
|
||||||
|
"idiom": "iphone"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"orientation": "portrait",
|
||||||
|
"extent": "full-screen",
|
||||||
|
"size": "320x480",
|
||||||
|
"scale": "2x",
|
||||||
|
"idiom": "iphone"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"orientation": "portrait",
|
||||||
|
"extent": "full-screen",
|
||||||
|
"size": "320x568",
|
||||||
|
"subtype": "retina4",
|
||||||
|
"scale": "2x",
|
||||||
|
"idiom": "iphone"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"orientation": "portrait",
|
||||||
|
"extent": "full-screen",
|
||||||
|
"size": "768x1024",
|
||||||
|
"scale": "1x",
|
||||||
|
"idiom": "ipad"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"orientation": "portrait",
|
||||||
|
"extent": "full-screen",
|
||||||
|
"size": "768x1024",
|
||||||
|
"scale": "2x",
|
||||||
|
"idiom": "ipad"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"orientation": "portrait",
|
||||||
|
"extent": "to-status-bar",
|
||||||
|
"size": "768x1004",
|
||||||
|
"scale": "1x",
|
||||||
|
"idiom": "ipad"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"orientation": "portrait",
|
||||||
|
"extent": "to-status-bar",
|
||||||
|
"size": "768x1004",
|
||||||
|
"scale": "2x",
|
||||||
|
"idiom": "ipad"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"orientation": "landscape",
|
||||||
|
"extent": "full-screen",
|
||||||
|
"size": "1024x768",
|
||||||
|
"scale": "1x",
|
||||||
|
"idiom": "ipad"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"orientation": "landscape",
|
||||||
|
"extent": "full-screen",
|
||||||
|
"size": "1024x768",
|
||||||
|
"scale": "2x",
|
||||||
|
"idiom": "ipad"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"orientation": "landscape",
|
||||||
|
"extent": "to-status-bar",
|
||||||
|
"size": "1024x748",
|
||||||
|
"scale": "1x",
|
||||||
|
"idiom": "ipad"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"orientation": "landscape",
|
||||||
|
"extent": "to-status-bar",
|
||||||
|
"size": "1024x748",
|
||||||
|
"scale": "2x",
|
||||||
|
"idiom": "ipad"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"info": {
|
||||||
|
"version": 1,
|
||||||
|
"author": "xcode"
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,6 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||||
|
<plist version="1.0">
|
||||||
|
<dict>
|
||||||
|
</dict>
|
||||||
|
</plist>
|
|
@ -0,0 +1,35 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||||
|
<plist version="1.0">
|
||||||
|
<dict>
|
||||||
|
<key>CFBundleDisplayName</key>
|
||||||
|
<string>singleview-tvOS</string>
|
||||||
|
<key>CFBundleName</key>
|
||||||
|
<string>singleview-tvOS</string>
|
||||||
|
<key>CFBundleIdentifier</key>
|
||||||
|
<string>com.companyname.singleview-tvos</string>
|
||||||
|
<key>CFBundleShortVersionString</key>
|
||||||
|
<string>1.0</string>
|
||||||
|
<key>CFBundleVersion</key>
|
||||||
|
<string>1.0</string>
|
||||||
|
<key>MinimumOSVersion</key>
|
||||||
|
<string>9.1</string>
|
||||||
|
<key>UIDeviceFamily</key>
|
||||||
|
<array>
|
||||||
|
<integer>3</integer>
|
||||||
|
</array>
|
||||||
|
<key>UISupportedInterfaceOrientations</key>
|
||||||
|
<array>
|
||||||
|
<string>UIInterfaceOrientationPortrait</string>
|
||||||
|
<string>UIInterfaceOrientationLandscapeLeft</string>
|
||||||
|
<string>UIInterfaceOrientationLandscapeRight</string>
|
||||||
|
</array>
|
||||||
|
<key>UIMainStoryboardFile</key>
|
||||||
|
<string>Main</string>
|
||||||
|
<key>XSAppIconAssets</key>
|
||||||
|
<string>Assets.xcassets/App Icon & Top Shelf Image.brandassets</string>
|
||||||
|
<key>XSLaunchImageAssets</key>
|
||||||
|
<string>Assets.xcassets/LaunchImages.launchimage</string>
|
||||||
|
</dict>
|
||||||
|
</plist>
|
||||||
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
namespace singleview_tvOS
|
||||||
|
|
||||||
|
open UIKit
|
||||||
|
|
||||||
|
module Main =
|
||||||
|
[<EntryPoint>]
|
||||||
|
let main args =
|
||||||
|
UIApplication.Main(args, null, "AppDelegate")
|
||||||
|
0
|
|
@ -0,0 +1,46 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<document type="com.apple.InterfaceBuilder.AppleTV.Storyboard" version="3.0" toolsVersion="9532" systemVersion="15D21" targetRuntime="AppleTV" propertyAccessControl="none" useAutolayout="YES" initialViewController="BYZ-38-t0r">
|
||||||
|
<dependencies>
|
||||||
|
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="9530"/>
|
||||||
|
</dependencies>
|
||||||
|
<scenes>
|
||||||
|
<!--My View Controller-->
|
||||||
|
<scene sceneID="tne-QT-ifu">
|
||||||
|
<objects>
|
||||||
|
<viewController id="BYZ-38-t0r" customClass="myViewController" customModule="Purple_Death" sceneMemberID="viewController">
|
||||||
|
<layoutGuides>
|
||||||
|
<viewControllerLayoutGuide type="top" id="y3c-jy-aDJ"/>
|
||||||
|
<viewControllerLayoutGuide type="bottom" id="wfy-db-euE"/>
|
||||||
|
</layoutGuides>
|
||||||
|
<view key="view" contentMode="scaleToFill" id="8bC-Xf-vdC" customClass="test">
|
||||||
|
<rect key="frame" x="0.0" y="0.0" width="1920" height="1080"/>
|
||||||
|
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||||
|
<subviews>
|
||||||
|
<button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="BAb-Xk-W2h">
|
||||||
|
<rect key="frame" x="587" y="297" width="304" height="86"/>
|
||||||
|
<inset key="contentEdgeInsets" minX="40" minY="20" maxX="40" maxY="20"/>
|
||||||
|
<state key="normal" title="Do Not Press"/>
|
||||||
|
<connections>
|
||||||
|
<action selector="doNotPressAction:" destination="BYZ-38-t0r" eventType="primaryActionTriggered" id="93C-4v-At6"/>
|
||||||
|
</connections>
|
||||||
|
</button>
|
||||||
|
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" text="Swift Was Here" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="xDR-Xb-Ar1">
|
||||||
|
<rect key="frame" x="587" y="245" width="304" height="44"/>
|
||||||
|
<fontDescription key="fontDescription" type="system" pointSize="30"/>
|
||||||
|
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
|
||||||
|
<nil key="highlightedColor"/>
|
||||||
|
</label>
|
||||||
|
</subviews>
|
||||||
|
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="calibratedWhite"/>
|
||||||
|
</view>
|
||||||
|
<connections>
|
||||||
|
<outlet property="myButton" destination="BAb-Xk-W2h" id="QO8-Mf-imE"/>
|
||||||
|
<outlet property="myLabel" destination="xDR-Xb-Ar1" id="NX6-84-hyj"/>
|
||||||
|
</connections>
|
||||||
|
</viewController>
|
||||||
|
<placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/>
|
||||||
|
</objects>
|
||||||
|
<point key="canvasLocation" x="188" y="139"/>
|
||||||
|
</scene>
|
||||||
|
</scenes>
|
||||||
|
</document>
|
|
@ -0,0 +1,25 @@
|
||||||
|
namespace singleview_tvOS
|
||||||
|
|
||||||
|
open System
|
||||||
|
open Foundation
|
||||||
|
open UIKit
|
||||||
|
|
||||||
|
type container = Xamarin.UIProvider
|
||||||
|
|
||||||
|
[<Register(container.myViewControllerBase.CustomClass)>]
|
||||||
|
type ViewController(handle : IntPtr) =
|
||||||
|
inherit container.myViewControllerBase(handle)
|
||||||
|
|
||||||
|
override x.DidReceiveMemoryWarning() =
|
||||||
|
// Releases the view if it doesn't have a superview.
|
||||||
|
base.DidReceiveMemoryWarning()
|
||||||
|
|
||||||
|
// Release any cached data, images, etc that aren't in use.
|
||||||
|
override x.ViewDidLoad() =
|
||||||
|
x.DoNotPressAction <- Some (fun sender -> x.View.BackgroundColor <- UIColor.Purple
|
||||||
|
x.myLabel.Text <- "Bang!" )
|
||||||
|
base.ViewDidLoad()
|
||||||
|
|
||||||
|
|
||||||
|
// Perform any additional setup after loading the view, typically from a nib.
|
||||||
|
|
|
@ -0,0 +1,131 @@
|
||||||
|
<?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>
|
||||||
|
<ProjectGuid>{00BF2AD3-867C-4A12-8AE6-907D4F02380F}</ProjectGuid>
|
||||||
|
<ProjectTypeGuids>{06FA79CB-D6CD-4721-BB4B-1BD202089C55};{F2A71F9B-5D33-465A-A702-920D77279786}</ProjectTypeGuids>
|
||||||
|
<OutputType>Exe</OutputType>
|
||||||
|
<RootNamespace>singleview_tvOS</RootNamespace>
|
||||||
|
<AssemblyName>singleview_tvOS</AssemblyName>
|
||||||
|
<IPhoneResourcePrefix>Resources</IPhoneResourcePrefix>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|iPhoneSimulator' ">
|
||||||
|
<DebugSymbols>true</DebugSymbols>
|
||||||
|
<DebugType>full</DebugType>
|
||||||
|
<Optimize>false</Optimize>
|
||||||
|
<OutputPath>bin\iPhoneSimulator\Debug</OutputPath>
|
||||||
|
<DefineConstants>DEBUG</DefineConstants>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<ConsolePause>false</ConsolePause>
|
||||||
|
<CodesignKey>iPhone Developer</CodesignKey>
|
||||||
|
<MtouchDebug>true</MtouchDebug>
|
||||||
|
<MtouchFastDev>true</MtouchFastDev>
|
||||||
|
<MtouchProfiling>true</MtouchProfiling>
|
||||||
|
<MtouchUseSGen>true</MtouchUseSGen>
|
||||||
|
<MtouchUseRefCounting>true</MtouchUseRefCounting>
|
||||||
|
<MtouchFloat32>true</MtouchFloat32>
|
||||||
|
<CodesignEntitlements></CodesignEntitlements>
|
||||||
|
<MtouchLink>None</MtouchLink>
|
||||||
|
<MtouchArch>x86_64</MtouchArch>
|
||||||
|
<DeviceSpecificBuild>false</DeviceSpecificBuild>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|iPhone' ">
|
||||||
|
<Optimize>true</Optimize>
|
||||||
|
<OutputPath>bin\iPhone\Release</OutputPath>
|
||||||
|
<DefineConstants></DefineConstants>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<ConsolePause>false</ConsolePause>
|
||||||
|
<CodesignKey>iPhone Developer</CodesignKey>
|
||||||
|
<MtouchUseLlvm>true</MtouchUseLlvm>
|
||||||
|
<MtouchUseSGen>true</MtouchUseSGen>
|
||||||
|
<MtouchUseRefCounting>true</MtouchUseRefCounting>
|
||||||
|
<MtouchFloat32>true</MtouchFloat32>
|
||||||
|
<MtouchEnableBitcode>true</MtouchEnableBitcode>
|
||||||
|
<CodesignEntitlements>Entitlements.plist</CodesignEntitlements>
|
||||||
|
<MtouchArch>ARM64</MtouchArch>
|
||||||
|
<GenerateTailCalls>true</GenerateTailCalls>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|iPhoneSimulator' ">
|
||||||
|
<Optimize>true</Optimize>
|
||||||
|
<OutputPath>bin\iPhoneSimulator\Release</OutputPath>
|
||||||
|
<DefineConstants></DefineConstants>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<ConsolePause>false</ConsolePause>
|
||||||
|
<CodesignKey>iPhone Developer</CodesignKey>
|
||||||
|
<MtouchUseSGen>true</MtouchUseSGen>
|
||||||
|
<MtouchUseRefCounting>true</MtouchUseRefCounting>
|
||||||
|
<MtouchFloat32>true</MtouchFloat32>
|
||||||
|
<CodesignEntitlements>Entitlements.plist</CodesignEntitlements>
|
||||||
|
<MtouchLink>None</MtouchLink>
|
||||||
|
<MtouchArch>x86_64</MtouchArch>
|
||||||
|
<GenerateTailCalls>true</GenerateTailCalls>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|iPhone' ">
|
||||||
|
<DebugSymbols>true</DebugSymbols>
|
||||||
|
<DebugType>full</DebugType>
|
||||||
|
<Optimize>false</Optimize>
|
||||||
|
<OutputPath>bin\iPhone\Debug</OutputPath>
|
||||||
|
<DefineConstants>DEBUG</DefineConstants>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<ConsolePause>false</ConsolePause>
|
||||||
|
<CodesignKey>iPhone Developer: de.thomas@ntlworld.com (EQ9W2F545F)</CodesignKey>
|
||||||
|
<DeviceSpecificBuild>true</DeviceSpecificBuild>
|
||||||
|
<MtouchDebug>true</MtouchDebug>
|
||||||
|
<MtouchFastDev>true</MtouchFastDev>
|
||||||
|
<MtouchProfiling>true</MtouchProfiling>
|
||||||
|
<MtouchUseSGen>true</MtouchUseSGen>
|
||||||
|
<MtouchUseRefCounting>true</MtouchUseRefCounting>
|
||||||
|
<MtouchFloat32>true</MtouchFloat32>
|
||||||
|
<CodesignEntitlements></CodesignEntitlements>
|
||||||
|
<MtouchLink>None</MtouchLink>
|
||||||
|
<MtouchArch>ARM64</MtouchArch>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Reference Include="System" />
|
||||||
|
<Reference Include="System.Xml" />
|
||||||
|
<Reference Include="System.Core" />
|
||||||
|
<Reference Include="mscorlib" />
|
||||||
|
<Reference Include="FSharp.Core" />
|
||||||
|
<Reference Include="Xamarin.TVOS" />
|
||||||
|
<Reference Include="Xamarin.UIProvider.TVOSRuntime">
|
||||||
|
<HintPath>..\..\..\src\Build\Debug\Xamarin.UIProvider.TVOSRuntime.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ImageAsset Include="Assets.xcassets\App Icon & Top Shelf Image.brandassets\Contents.json" />
|
||||||
|
<ImageAsset Include="Assets.xcassets\App Icon & Top Shelf Image.brandassets\App Icon - Large.imagestack\Contents.json" />
|
||||||
|
<ImageAsset Include="Assets.xcassets\App Icon & Top Shelf Image.brandassets\App Icon - Large.imagestack\Back.imagestacklayer\Contents.json" />
|
||||||
|
<ImageAsset Include="Assets.xcassets\App Icon & Top Shelf Image.brandassets\App Icon - Large.imagestack\Back.imagestacklayer\Content.imageset\Contents.json" />
|
||||||
|
<ImageAsset Include="Assets.xcassets\App Icon & Top Shelf Image.brandassets\App Icon - Large.imagestack\Front.imagestacklayer\Contents.json" />
|
||||||
|
<ImageAsset Include="Assets.xcassets\App Icon & Top Shelf Image.brandassets\App Icon - Large.imagestack\Front.imagestacklayer\Content.imageset\Contents.json" />
|
||||||
|
<ImageAsset Include="Assets.xcassets\App Icon & Top Shelf Image.brandassets\App Icon - Large.imagestack\Middle.imagestacklayer\Contents.json" />
|
||||||
|
<ImageAsset Include="Assets.xcassets\App Icon & Top Shelf Image.brandassets\App Icon - Large.imagestack\Middle.imagestacklayer\Content.imageset\Contents.json" />
|
||||||
|
<ImageAsset Include="Assets.xcassets\App Icon & Top Shelf Image.brandassets\App Icon - Small.imagestack\Contents.json" />
|
||||||
|
<ImageAsset Include="Assets.xcassets\App Icon & Top Shelf Image.brandassets\App Icon - Small.imagestack\Back.imagestacklayer\Contents.json" />
|
||||||
|
<ImageAsset Include="Assets.xcassets\App Icon & Top Shelf Image.brandassets\App Icon - Small.imagestack\Back.imagestacklayer\Content.imageset\Contents.json" />
|
||||||
|
<ImageAsset Include="Assets.xcassets\App Icon & Top Shelf Image.brandassets\App Icon - Small.imagestack\Front.imagestacklayer\Contents.json" />
|
||||||
|
<ImageAsset Include="Assets.xcassets\App Icon & Top Shelf Image.brandassets\App Icon - Small.imagestack\Front.imagestacklayer\Content.imageset\Contents.json" />
|
||||||
|
<ImageAsset Include="Assets.xcassets\App Icon & Top Shelf Image.brandassets\App Icon - Small.imagestack\Middle.imagestacklayer\Contents.json" />
|
||||||
|
<ImageAsset Include="Assets.xcassets\App Icon & Top Shelf Image.brandassets\App Icon - Small.imagestack\Middle.imagestacklayer\Content.imageset\Contents.json" />
|
||||||
|
<ImageAsset Include="Assets.xcassets\App Icon & Top Shelf Image.brandassets\Top Shelf Image.imageset\Contents.json" />
|
||||||
|
<ImageAsset Include="Assets.xcassets\LaunchImages.launchimage\Contents.json" />
|
||||||
|
<ImageAsset Include="Assets.xcassets\Contents.json" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Folder Include="Resources\" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<None Include="Info.plist" />
|
||||||
|
<None Include="Entitlements.plist" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<InterfaceDefinition Include="Main.storyboard" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Compile Include="ViewController.fs" />
|
||||||
|
<Compile Include="AppDelegate.fs" />
|
||||||
|
<Compile Include="Main.fs" />
|
||||||
|
</ItemGroup>
|
||||||
|
<Import Project="$(MSBuildExtensionsPath)\Xamarin\TVOS\Xamarin.TVOS.FSharp.targets" />
|
||||||
|
</Project>
|
|
@ -0,0 +1,20 @@
|
||||||
|
namespace Xamarin.UIProvider.iOSRuntime
|
||||||
|
open System.Reflection
|
||||||
|
open System.Runtime.CompilerServices
|
||||||
|
|
||||||
|
[<assembly: AssemblyTitle("Xamarin.UIProvider.iOSRuntime")>]
|
||||||
|
[<assembly: AssemblyDescription("")>]
|
||||||
|
[<assembly: AssemblyConfiguration("")>]
|
||||||
|
[<assembly: AssemblyCompany("")>]
|
||||||
|
[<assembly: AssemblyProduct("")>]
|
||||||
|
[<assembly: AssemblyCopyright("dave")>]
|
||||||
|
[<assembly: AssemblyTrademark("")>]
|
||||||
|
|
||||||
|
// The assembly version has the format {Major}.{Minor}.{Build}.{Revision}
|
||||||
|
|
||||||
|
[<assembly: AssemblyVersion("1.0.0.0")>]
|
||||||
|
|
||||||
|
//[<assembly: AssemblyDelaySign(false)>]
|
||||||
|
//[<assembly: AssemblyKeyFile("")>]
|
||||||
|
|
||||||
|
()
|
|
@ -0,0 +1,5 @@
|
||||||
|
namespace global
|
||||||
|
open Microsoft.FSharp.Core.CompilerServices
|
||||||
|
|
||||||
|
[<assembly:TypeProviderAssembly("Xamarin.UIProviders.DesignTime")>]
|
||||||
|
()
|
|
@ -0,0 +1,52 @@
|
||||||
|
<?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)' == '' ">AnyCPU</Platform>
|
||||||
|
<ProjectGuid>{90F944F1-593E-4960-B374-0F1367C1D0ED}</ProjectGuid>
|
||||||
|
<ProjectTypeGuids>{FEACFBD2-3405-455C-9665-78FE426C6842};{F2A71F9B-5D33-465A-A702-920D77279786}</ProjectTypeGuids>
|
||||||
|
<OutputType>Library</OutputType>
|
||||||
|
<RootNamespace>Xamarin.UIProvider.iOSRuntime</RootNamespace>
|
||||||
|
<AssemblyName>Xamarin.UIProvider.iOSRuntime</AssemblyName>
|
||||||
|
<IPhoneResourcePrefix>Resources</IPhoneResourcePrefix>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||||
|
<DebugSymbols>true</DebugSymbols>
|
||||||
|
<DebugType>full</DebugType>
|
||||||
|
<Optimize>false</Optimize>
|
||||||
|
<OutputPath>..\Build\Debug</OutputPath>
|
||||||
|
<DefineConstants>DEBUG</DefineConstants>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<ConsolePause>false</ConsolePause>
|
||||||
|
<MtouchUseSGen>true</MtouchUseSGen>
|
||||||
|
<MtouchUseRefCounting>true</MtouchUseRefCounting>
|
||||||
|
<PlatformTarget></PlatformTarget>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||||
|
<Optimize>true</Optimize>
|
||||||
|
<OutputPath>..\Build\Release</OutputPath>
|
||||||
|
<DefineConstants></DefineConstants>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<ConsolePause>false</ConsolePause>
|
||||||
|
<MtouchUseSGen>true</MtouchUseSGen>
|
||||||
|
<MtouchUseRefCounting>true</MtouchUseRefCounting>
|
||||||
|
<GenerateTailCalls>true</GenerateTailCalls>
|
||||||
|
<PlatformTarget></PlatformTarget>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Reference Include="System" />
|
||||||
|
<Reference Include="System.Xml" />
|
||||||
|
<Reference Include="System.Core" />
|
||||||
|
<Reference Include="mscorlib" />
|
||||||
|
<Reference Include="FSharp.Core" />
|
||||||
|
<Reference Include="Xamarin.iOS" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Folder Include="Resources\" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Compile Include="AssemblyInfo.fs" />
|
||||||
|
<Compile Include="Component1.fs" />
|
||||||
|
</ItemGroup>
|
||||||
|
<Import Project="$(MSBuildExtensionsPath)\Xamarin\iOS\Xamarin.iOS.FSharp.targets" />
|
||||||
|
</Project>
|
|
@ -0,0 +1,20 @@
|
||||||
|
namespace Xamarin.UIProvider.TVOSRuntime
|
||||||
|
open System.Reflection
|
||||||
|
open System.Runtime.CompilerServices
|
||||||
|
|
||||||
|
[<assembly: AssemblyTitle("Xamarin.UIProvider.TVOSRuntime")>]
|
||||||
|
[<assembly: AssemblyDescription("")>]
|
||||||
|
[<assembly: AssemblyConfiguration("")>]
|
||||||
|
[<assembly: AssemblyCompany("")>]
|
||||||
|
[<assembly: AssemblyProduct("")>]
|
||||||
|
[<assembly: AssemblyCopyright("dave")>]
|
||||||
|
[<assembly: AssemblyTrademark("")>]
|
||||||
|
|
||||||
|
// The assembly version has the format {Major}.{Minor}.{Build}.{Revision}
|
||||||
|
|
||||||
|
[<assembly: AssemblyVersion("1.0.0.0")>]
|
||||||
|
|
||||||
|
//[<assembly: AssemblyDelaySign(false)>]
|
||||||
|
//[<assembly: AssemblyKeyFile("")>]
|
||||||
|
|
||||||
|
()
|
|
@ -0,0 +1,5 @@
|
||||||
|
namespace global
|
||||||
|
open Microsoft.FSharp.Core.CompilerServices
|
||||||
|
|
||||||
|
[<assembly:TypeProviderAssembly("Xamarin.UIProviders.DesignTime")>]
|
||||||
|
()
|
|
@ -0,0 +1,45 @@
|
||||||
|
<?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)' == '' ">AnyCPU</Platform>
|
||||||
|
<ProjectGuid>{4F84B7DD-A5E0-4BC3-9C9F-565988030202}</ProjectGuid>
|
||||||
|
<ProjectTypeGuids>{06FA79CB-D6CD-4721-BB4B-1BD202089C55};{F2A71F9B-5D33-465A-A702-920D77279786}</ProjectTypeGuids>
|
||||||
|
<OutputType>Library</OutputType>
|
||||||
|
<RootNamespace>Xamarin.UIProvider.TVOSRuntime</RootNamespace>
|
||||||
|
<AssemblyName>Xamarin.UIProvider.TVOSRuntime</AssemblyName>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||||
|
<DebugSymbols>true</DebugSymbols>
|
||||||
|
<DebugType>full</DebugType>
|
||||||
|
<Optimize>false</Optimize>
|
||||||
|
<OutputPath>..\Build\Debug</OutputPath>
|
||||||
|
<DefineConstants>DEBUG</DefineConstants>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<ConsolePause>false</ConsolePause>
|
||||||
|
<PlatformTarget></PlatformTarget>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||||
|
<Optimize>true</Optimize>
|
||||||
|
<OutputPath>..\Build\Release</OutputPath>
|
||||||
|
<DefineConstants></DefineConstants>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<ConsolePause>false</ConsolePause>
|
||||||
|
<GenerateTailCalls>true</GenerateTailCalls>
|
||||||
|
<PlatformTarget></PlatformTarget>
|
||||||
|
</PropertyGroup>
|
||||||
|
<Import Project="$(MSBuildExtensionsPath)\Xamarin\TVOS\Xamarin.TVOS.FSharp.targets" />
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<Compile Include="AssemblyInfo.fs" />
|
||||||
|
<Compile Include="Component1.fs" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Reference Include="System" />
|
||||||
|
<Reference Include="System.Xml" />
|
||||||
|
<Reference Include="System.Core" />
|
||||||
|
<Reference Include="mscorlib" />
|
||||||
|
<Reference Include="FSharp.Core" />
|
||||||
|
<Reference Include="Xamarin.TVOS" />
|
||||||
|
</ItemGroup>
|
||||||
|
</Project>
|
|
@ -1,7 +1,11 @@
|
||||||
|
|
||||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
# Visual Studio 2012
|
# Visual Studio 2012
|
||||||
Project("{f2a71f9b-5d33-465a-a702-920d77279786}") = "Xamarin.iOSProviders", "Xamarin.iOSProviders\Xamarin.iOSProviders.fsproj", "{DD17E7B0-6EE1-4862-80F8-E0CAB67D6137}"
|
Project("{f2a71f9b-5d33-465a-a702-920d77279786}") = "Xamarin.UIProviders.DesignTime", "Xamarin.iOSProviders\Xamarin.UIProviders.DesignTime.fsproj", "{DD17E7B0-6EE1-4862-80F8-E0CAB67D6137}"
|
||||||
|
EndProject
|
||||||
|
Project("{f2a71f9b-5d33-465a-a702-920d77279786}") = "Xamarin.UIProvider.TVOSRuntime", "Xamarin.UIProvider.TVOSRuntime\Xamarin.UIProvider.TVOSRuntime.fsproj", "{4F84B7DD-A5E0-4BC3-9C9F-565988030202}"
|
||||||
|
EndProject
|
||||||
|
Project("{f2a71f9b-5d33-465a-a702-920d77279786}") = "Xamarin.UIProvider.iOSRuntime", "Xamarin.UIProvider.iOSRuntime\Xamarin.UIProvider.iOSRuntime.fsproj", "{90F944F1-593E-4960-B374-0F1367C1D0ED}"
|
||||||
EndProject
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
|
@ -52,6 +56,34 @@ Global
|
||||||
{B85F245B-3FB9-4253-8251-16F98F05B6EC}.Release|iPhone.Build.0 = Release|Any CPU
|
{B85F245B-3FB9-4253-8251-16F98F05B6EC}.Release|iPhone.Build.0 = Release|Any CPU
|
||||||
{B85F245B-3FB9-4253-8251-16F98F05B6EC}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
|
{B85F245B-3FB9-4253-8251-16F98F05B6EC}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
|
||||||
{B85F245B-3FB9-4253-8251-16F98F05B6EC}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
|
{B85F245B-3FB9-4253-8251-16F98F05B6EC}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
|
||||||
|
{4F84B7DD-A5E0-4BC3-9C9F-565988030202}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
|
||||||
|
{4F84B7DD-A5E0-4BC3-9C9F-565988030202}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
|
||||||
|
{4F84B7DD-A5E0-4BC3-9C9F-565988030202}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
|
||||||
|
{4F84B7DD-A5E0-4BC3-9C9F-565988030202}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
|
||||||
|
{4F84B7DD-A5E0-4BC3-9C9F-565988030202}.Debug|iPhone.ActiveCfg = Debug|Any CPU
|
||||||
|
{4F84B7DD-A5E0-4BC3-9C9F-565988030202}.Debug|iPhone.Build.0 = Debug|Any CPU
|
||||||
|
{4F84B7DD-A5E0-4BC3-9C9F-565988030202}.Release|iPhone.ActiveCfg = Release|Any CPU
|
||||||
|
{4F84B7DD-A5E0-4BC3-9C9F-565988030202}.Release|iPhone.Build.0 = Release|Any CPU
|
||||||
|
{4F84B7DD-A5E0-4BC3-9C9F-565988030202}.Ad-Hoc|iPhone.ActiveCfg = Release|Any CPU
|
||||||
|
{4F84B7DD-A5E0-4BC3-9C9F-565988030202}.Ad-Hoc|iPhone.Build.0 = Release|Any CPU
|
||||||
|
{4F84B7DD-A5E0-4BC3-9C9F-565988030202}.AppStore|iPhone.ActiveCfg = Release|Any CPU
|
||||||
|
{4F84B7DD-A5E0-4BC3-9C9F-565988030202}.AppStore|iPhone.Build.0 = Release|Any CPU
|
||||||
|
{4F84B7DD-A5E0-4BC3-9C9F-565988030202}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{4F84B7DD-A5E0-4BC3-9C9F-565988030202}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{90F944F1-593E-4960-B374-0F1367C1D0ED}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
|
||||||
|
{90F944F1-593E-4960-B374-0F1367C1D0ED}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
|
||||||
|
{90F944F1-593E-4960-B374-0F1367C1D0ED}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
|
||||||
|
{90F944F1-593E-4960-B374-0F1367C1D0ED}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
|
||||||
|
{90F944F1-593E-4960-B374-0F1367C1D0ED}.Debug|iPhone.ActiveCfg = Debug|Any CPU
|
||||||
|
{90F944F1-593E-4960-B374-0F1367C1D0ED}.Debug|iPhone.Build.0 = Debug|Any CPU
|
||||||
|
{90F944F1-593E-4960-B374-0F1367C1D0ED}.Release|iPhone.ActiveCfg = Release|Any CPU
|
||||||
|
{90F944F1-593E-4960-B374-0F1367C1D0ED}.Release|iPhone.Build.0 = Release|Any CPU
|
||||||
|
{90F944F1-593E-4960-B374-0F1367C1D0ED}.Ad-Hoc|iPhone.ActiveCfg = Release|Any CPU
|
||||||
|
{90F944F1-593E-4960-B374-0F1367C1D0ED}.Ad-Hoc|iPhone.Build.0 = Release|Any CPU
|
||||||
|
{90F944F1-593E-4960-B374-0F1367C1D0ED}.AppStore|iPhone.ActiveCfg = Release|Any CPU
|
||||||
|
{90F944F1-593E-4960-B374-0F1367C1D0ED}.AppStore|iPhone.Build.0 = Release|Any CPU
|
||||||
|
{90F944F1-593E-4960-B374-0F1367C1D0ED}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{90F944F1-593E-4960-B374-0F1367C1D0ED}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(NestedProjects) = preSolution
|
GlobalSection(NestedProjects) = preSolution
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
namespace Xamarin.iOSProviders
|
namespace Xamarin.UIProviders.DesignTime
|
||||||
open System.Reflection
|
open System.Reflection
|
||||||
open System.Runtime.CompilerServices
|
open System.Runtime.CompilerServices
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,524 @@
|
||||||
|
// --------------------------------------------------------------------------------------
|
||||||
|
// Helpers for writing type providers
|
||||||
|
// ----------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
namespace ProviderImplementation
|
||||||
|
|
||||||
|
open System
|
||||||
|
open System.Collections.Generic
|
||||||
|
open System.Reflection
|
||||||
|
open System.Text
|
||||||
|
open Microsoft.FSharp.Core.CompilerServices
|
||||||
|
open Microsoft.FSharp.Core.Printf
|
||||||
|
open Microsoft.FSharp.Quotations
|
||||||
|
open Microsoft.FSharp.Quotations.Patterns
|
||||||
|
open Microsoft.FSharp.Reflection
|
||||||
|
open ProviderImplementation.ProvidedTypes
|
||||||
|
|
||||||
|
module internal Debug =
|
||||||
|
|
||||||
|
/// Simulates a real instance of TypeProviderConfig and then creates an instance of the last
|
||||||
|
/// type provider added to a namespace by the type provider constructor
|
||||||
|
let generate (resolutionFolder: string) (runtimeAssembly: string) typeProviderForNamespacesConstructor args =
|
||||||
|
|
||||||
|
let cfg = new TypeProviderConfig(fun _ -> false)
|
||||||
|
let (?<-) cfg prop value =
|
||||||
|
cfg.GetType().GetProperty(prop).GetSetMethod(nonPublic = true).Invoke(cfg, [| box value |]) |> ignore
|
||||||
|
cfg?ResolutionFolder <- resolutionFolder
|
||||||
|
cfg?RuntimeAssembly <- runtimeAssembly
|
||||||
|
cfg?ReferencedAssemblies <- Array.zeroCreate<string> 0
|
||||||
|
|
||||||
|
let typeProviderForNamespaces = typeProviderForNamespacesConstructor cfg :> TypeProviderForNamespaces
|
||||||
|
|
||||||
|
let providedTypeDefinition = typeProviderForNamespaces.Namespaces |> Seq.last |> snd |> Seq.last
|
||||||
|
|
||||||
|
match args with
|
||||||
|
| [||] -> providedTypeDefinition
|
||||||
|
| args ->
|
||||||
|
let typeName =
|
||||||
|
if providedTypeDefinition.IsErased then
|
||||||
|
providedTypeDefinition.Name + (args |> Seq.map (fun s -> ",\"" + (if s = null then "" else s.ToString()) + "\"") |> Seq.reduce (+))
|
||||||
|
else
|
||||||
|
// The type name ends up quite mangled in the dll output if we combine the name using static parameters, so for generated types we don't do that
|
||||||
|
providedTypeDefinition.Name
|
||||||
|
providedTypeDefinition.MakeParametricType(typeName, args)
|
||||||
|
|
||||||
|
/// Returns a string representation of the signature (and optionally also the body) of all the
|
||||||
|
/// types generated by the type provider up to a certain depth and width
|
||||||
|
/// If ignoreOutput is true, this will still visit the full graph, but it will output an empty string to be faster
|
||||||
|
let prettyPrint signatureOnly ignoreOutput maxDepth maxWidth (t: ProvidedTypeDefinition) =
|
||||||
|
|
||||||
|
let ns =
|
||||||
|
[ t.Namespace
|
||||||
|
"Microsoft.FSharp.Core"
|
||||||
|
"Microsoft.FSharp.Core.Operators"
|
||||||
|
"Microsoft.FSharp.Collections"
|
||||||
|
"Microsoft.FSharp.Control"
|
||||||
|
"Microsoft.FSharp.Text" ]
|
||||||
|
|> Set.ofSeq
|
||||||
|
|
||||||
|
let pending = new Queue<_>()
|
||||||
|
let visited = new HashSet<_>()
|
||||||
|
|
||||||
|
let add t =
|
||||||
|
if visited.Add t then
|
||||||
|
pending.Enqueue t
|
||||||
|
|
||||||
|
let fullName (t: Type) =
|
||||||
|
let fullName = t.Namespace + "." + t.Name
|
||||||
|
if fullName.StartsWith "FSI_" then
|
||||||
|
fullName.Substring(fullName.IndexOf('.') + 1)
|
||||||
|
else
|
||||||
|
fullName
|
||||||
|
|
||||||
|
let rec toString useFullName (t: Type) =
|
||||||
|
|
||||||
|
let hasUnitOfMeasure = t.Name.Contains("[")
|
||||||
|
|
||||||
|
let innerToString (t: Type) =
|
||||||
|
match t with
|
||||||
|
| t when t = typeof<bool> -> "bool"
|
||||||
|
| t when t = typeof<obj> -> "obj"
|
||||||
|
| t when t = typeof<int> -> "int"
|
||||||
|
| t when t = typeof<int64> -> "int64"
|
||||||
|
| t when t = typeof<float> -> "float"
|
||||||
|
| t when t = typeof<float32> -> "float32"
|
||||||
|
| t when t = typeof<decimal> -> "decimal"
|
||||||
|
| t when t = typeof<string> -> "string"
|
||||||
|
| t when t = typeof<Void> -> "()"
|
||||||
|
| t when t = typeof<unit> -> "()"
|
||||||
|
| t when t.IsArray -> (t.GetElementType() |> toString useFullName) + "[]"
|
||||||
|
| :? ProvidedTypeDefinition as t ->
|
||||||
|
add t
|
||||||
|
t.Name.Split(',').[0]
|
||||||
|
| t when t.IsGenericType ->
|
||||||
|
let args =
|
||||||
|
if useFullName then
|
||||||
|
t.GetGenericArguments()
|
||||||
|
|> Seq.map (if hasUnitOfMeasure then (fun t -> t.Name) else toString useFullName)
|
||||||
|
else
|
||||||
|
t.GetGenericArguments()
|
||||||
|
|> Seq.map (fun _ -> "_")
|
||||||
|
if FSharpType.IsTuple t then
|
||||||
|
String.concat " * " args
|
||||||
|
elif t.Name.StartsWith "FSharpFunc`" then
|
||||||
|
"(" + (String.concat " -> " args) + ")"
|
||||||
|
else
|
||||||
|
let args = String.concat "," args
|
||||||
|
let name, reverse =
|
||||||
|
match t with
|
||||||
|
| t when hasUnitOfMeasure -> toString useFullName t.UnderlyingSystemType, false
|
||||||
|
| t when t.GetGenericTypeDefinition().Name = typeof<int seq>.GetGenericTypeDefinition().Name -> "seq", true
|
||||||
|
| t when t.GetGenericTypeDefinition().Name = typeof<int list>.GetGenericTypeDefinition().Name -> "list", true
|
||||||
|
| t when t.GetGenericTypeDefinition().Name = typeof<int option>.GetGenericTypeDefinition().Name -> "option", true
|
||||||
|
| t when t.GetGenericTypeDefinition().Name = typeof<int ref>.GetGenericTypeDefinition().Name -> "ref", true
|
||||||
|
| t when t.Name = "FSharpAsync`1" -> "async", true
|
||||||
|
| t when ns.Contains t.Namespace -> t.Name, false
|
||||||
|
| t -> (if useFullName then fullName t else t.Name), false
|
||||||
|
let name = name.Split('`').[0]
|
||||||
|
if reverse then
|
||||||
|
args + " " + name
|
||||||
|
else
|
||||||
|
name + "<" + args + ">"
|
||||||
|
| t when ns.Contains t.Namespace -> t.Name
|
||||||
|
| t when t.IsGenericParameter -> t.Name
|
||||||
|
| t -> if useFullName then fullName t else t.Name
|
||||||
|
|
||||||
|
let rec warnIfWrongAssembly (t:Type) =
|
||||||
|
match t with
|
||||||
|
| :? ProvidedTypeDefinition -> ""
|
||||||
|
| t when t.IsGenericType -> defaultArg (t.GetGenericArguments() |> Seq.map warnIfWrongAssembly |> Seq.tryFind (fun s -> s <> "")) ""
|
||||||
|
| t when t.IsArray -> warnIfWrongAssembly <| t.GetElementType()
|
||||||
|
| t -> if not t.IsGenericParameter && t.Assembly = Assembly.GetExecutingAssembly() then " [DESIGNTIME]" else ""
|
||||||
|
|
||||||
|
if ignoreOutput then
|
||||||
|
""
|
||||||
|
elif hasUnitOfMeasure || t.IsGenericParameter || t.DeclaringType = null then
|
||||||
|
innerToString t + (warnIfWrongAssembly t)
|
||||||
|
else
|
||||||
|
(toString useFullName t.DeclaringType) + "+" + (innerToString t) + (warnIfWrongAssembly t)
|
||||||
|
|
||||||
|
let toSignature (parameters: ParameterInfo[]) =
|
||||||
|
if parameters.Length = 0 then
|
||||||
|
"()"
|
||||||
|
else
|
||||||
|
parameters
|
||||||
|
|> Seq.map (fun p -> p.Name + ":" + (toString true p.ParameterType))
|
||||||
|
|> String.concat " -> "
|
||||||
|
|
||||||
|
let printExpr expr =
|
||||||
|
|
||||||
|
let sb = StringBuilder ()
|
||||||
|
let print (str:string) = sb.Append(str) |> ignore
|
||||||
|
|
||||||
|
let getCurrentIndent() =
|
||||||
|
let lastEnterPos = sb.ToString().LastIndexOf('\n')
|
||||||
|
if lastEnterPos = -1 then sb.Length + 4 else sb.Length - lastEnterPos - 1
|
||||||
|
|
||||||
|
let breakLine indent =
|
||||||
|
print "\n"
|
||||||
|
print (new String(' ', indent))
|
||||||
|
|
||||||
|
let isBigExpression = function
|
||||||
|
| Let _ | NewArray _ | NewTuple _ -> true
|
||||||
|
| _ -> false
|
||||||
|
|
||||||
|
let inline getAttrs attrName m =
|
||||||
|
( ^a : (member GetCustomAttributesData : unit -> IList<CustomAttributeData>) m)
|
||||||
|
|> Seq.filter (fun attr -> attr.Constructor.DeclaringType.Name = attrName)
|
||||||
|
|
||||||
|
let inline hasAttr attrName m =
|
||||||
|
not (Seq.isEmpty (getAttrs attrName m))
|
||||||
|
|
||||||
|
let rec printSeparatedByCommas exprs =
|
||||||
|
match exprs with
|
||||||
|
| [] -> ()
|
||||||
|
| e::es ->
|
||||||
|
printExpr false true e
|
||||||
|
for e in es do
|
||||||
|
print ", "
|
||||||
|
printExpr false true e
|
||||||
|
|
||||||
|
and printCall fromPipe printName (mi:MethodInfo) args =
|
||||||
|
if fromPipe && List.length args = 1 then
|
||||||
|
printName()
|
||||||
|
elif not (hasAttr "CompilationArgumentCountsAttribute" mi) then
|
||||||
|
printName()
|
||||||
|
match args with
|
||||||
|
| [] -> print "()"
|
||||||
|
| arg::args ->
|
||||||
|
print "("
|
||||||
|
let indent = getCurrentIndent()
|
||||||
|
printExpr false true arg
|
||||||
|
for arg in args do
|
||||||
|
print ", "
|
||||||
|
if isBigExpression arg then
|
||||||
|
breakLine indent
|
||||||
|
printExpr false true arg
|
||||||
|
print ")"
|
||||||
|
else
|
||||||
|
print "("
|
||||||
|
printName()
|
||||||
|
for arg in args do
|
||||||
|
print " "
|
||||||
|
printExpr false true arg
|
||||||
|
print ")"
|
||||||
|
|
||||||
|
and printExpr fromPipe needsParens = function
|
||||||
|
| Call (instance, mi, args) ->
|
||||||
|
if mi.Name = "GetArray" && mi.DeclaringType.FullName = "Microsoft.FSharp.Core.LanguagePrimitives+IntrinsicFunctions" then
|
||||||
|
printExpr false true args.Head
|
||||||
|
print ".["
|
||||||
|
printExpr false true args.Tail.Head
|
||||||
|
print "]"
|
||||||
|
elif mi.DeclaringType.IsGenericType && mi.DeclaringType.GetGenericTypeDefinition().Name = typeof<int option>.GetGenericTypeDefinition().Name then
|
||||||
|
if args.IsEmpty then
|
||||||
|
match instance with
|
||||||
|
| None -> print "None"
|
||||||
|
| Some instance ->
|
||||||
|
printExpr false true instance
|
||||||
|
print "."
|
||||||
|
print <| mi.Name.Substring("get_".Length)
|
||||||
|
else
|
||||||
|
print "Some "
|
||||||
|
printExpr false true args.Head
|
||||||
|
elif mi.Name.Contains "." && not args.IsEmpty then
|
||||||
|
// instance method in type extension
|
||||||
|
let printName() =
|
||||||
|
printExpr false true args.Head
|
||||||
|
print "."
|
||||||
|
print (mi.Name.Substring(mi.Name.IndexOf '.' + 1))
|
||||||
|
printCall fromPipe printName mi args.Tail
|
||||||
|
elif mi.Attributes &&& MethodAttributes.SpecialName = MethodAttributes.SpecialName && mi.Name.StartsWith "get_" && args.IsEmpty then
|
||||||
|
// property get
|
||||||
|
match instance with
|
||||||
|
| Some expr -> printExpr false true expr
|
||||||
|
| None -> print (toString false mi.DeclaringType)
|
||||||
|
print "."
|
||||||
|
print <| mi.Name.Substring("get_".Length)
|
||||||
|
elif mi.Name = "op_PipeRight" && args.Length = 2 then
|
||||||
|
printExpr false false args.Head
|
||||||
|
print " |> "
|
||||||
|
match args.Tail.Head with
|
||||||
|
| Lambda (_, (Call(_,_,_) as call)) -> printExpr true false call
|
||||||
|
| _ as expr -> printExpr false false expr
|
||||||
|
else
|
||||||
|
let printName() =
|
||||||
|
match instance with
|
||||||
|
| Some expr -> printExpr false true expr
|
||||||
|
| None -> print (toString false mi.DeclaringType)
|
||||||
|
print "."
|
||||||
|
print mi.Name
|
||||||
|
let isOptional (arg:Expr, param:ParameterInfo) =
|
||||||
|
hasAttr "OptionalArgumentAttribute" param
|
||||||
|
&& arg.ToString() = "Call (None, get_None, [])"
|
||||||
|
let args =
|
||||||
|
mi.GetParameters()
|
||||||
|
|> List.ofArray
|
||||||
|
|> List.zip args
|
||||||
|
|> List.filter (not << isOptional)
|
||||||
|
|> List.map fst
|
||||||
|
printCall fromPipe printName mi args
|
||||||
|
| Let (var1, TupleGet (Var x, 1), Let (var2, TupleGet (Var y, 0), body)) when x = y ->
|
||||||
|
let indent = getCurrentIndent()
|
||||||
|
bprintf sb "let %s, %s = %s" var2.Name var1.Name x.Name
|
||||||
|
breakLine indent
|
||||||
|
printExpr false false body
|
||||||
|
| Let (var, value, body) ->
|
||||||
|
let indent = getCurrentIndent()
|
||||||
|
let usePattern = sprintf "IfThenElse(TypeTest(IDisposable,Coerce(%s,Object)),Call(Some(Call(None,UnboxGeneric,[Coerce(%s,Object)])),Dispose,[]),Value(<null>))" var.Name var.Name
|
||||||
|
let body =
|
||||||
|
match body with
|
||||||
|
| TryFinally (tryExpr, finallyExpr) when finallyExpr.ToString().Replace("\n", null).Replace(" ", null) = usePattern ->
|
||||||
|
bprintf sb "use %s = " var.Name
|
||||||
|
tryExpr
|
||||||
|
| _ ->
|
||||||
|
if var.IsMutable then
|
||||||
|
bprintf sb "let mutable %s = " var.Name
|
||||||
|
else
|
||||||
|
bprintf sb "let %s = " var.Name
|
||||||
|
body
|
||||||
|
match value with
|
||||||
|
| Let _ ->
|
||||||
|
breakLine (indent + 4)
|
||||||
|
printExpr false false value
|
||||||
|
| _ -> printExpr false false value
|
||||||
|
breakLine indent
|
||||||
|
printExpr false false body
|
||||||
|
| Value (null, _) ->
|
||||||
|
print "null"
|
||||||
|
| Value (value, typ) when typ = typeof<string> && (value :?> string).Contains("\\") ->
|
||||||
|
bprintf sb "@%A" value
|
||||||
|
| Value (value, _) ->
|
||||||
|
bprintf sb "%A" value
|
||||||
|
| Var (var) ->
|
||||||
|
print var.Name
|
||||||
|
| NewObject (ci, args) ->
|
||||||
|
let getSourceConstructFlags (attr:CustomAttributeData) =
|
||||||
|
let arg = attr.ConstructorArguments
|
||||||
|
|> Seq.filter (fun arg -> arg.ArgumentType.Name = "SourceConstructFlags")
|
||||||
|
|> Seq.head
|
||||||
|
arg.Value :?> int
|
||||||
|
let compilationMappings = getAttrs "CompilationMappingAttribute" ci.DeclaringType
|
||||||
|
if not (Seq.isEmpty compilationMappings) && (getSourceConstructFlags (Seq.head compilationMappings)) = int SourceConstructFlags.RecordType then
|
||||||
|
print "{ "
|
||||||
|
let indent = getCurrentIndent()
|
||||||
|
let recordFields = FSharpType.GetRecordFields(ci.DeclaringType)
|
||||||
|
args |> List.iteri (fun i arg ->
|
||||||
|
if i > 0 then
|
||||||
|
breakLine indent
|
||||||
|
print recordFields.[i].Name
|
||||||
|
print " = "
|
||||||
|
printExpr false false arg)
|
||||||
|
print " }"
|
||||||
|
else
|
||||||
|
print "(new "
|
||||||
|
print (toString false ci.DeclaringType)
|
||||||
|
print "("
|
||||||
|
printSeparatedByCommas args
|
||||||
|
print "))"
|
||||||
|
| NewDelegate (typ, vars, expr) ->
|
||||||
|
print "new "
|
||||||
|
print (toString false typ)
|
||||||
|
match expr with
|
||||||
|
| Var v when not vars.IsEmpty && vars.Tail.IsEmpty && vars.Head = v -> print "(id)"
|
||||||
|
| _ ->
|
||||||
|
let indent = getCurrentIndent()
|
||||||
|
if vars.IsEmpty then
|
||||||
|
print "(fun () -> "
|
||||||
|
else
|
||||||
|
print "(fun"
|
||||||
|
for var in vars do
|
||||||
|
bprintf sb " (%s:%s)" var.Name (toString false var.Type)
|
||||||
|
print " -> "
|
||||||
|
if isBigExpression expr then
|
||||||
|
breakLine (indent + 4)
|
||||||
|
printExpr false false expr
|
||||||
|
else
|
||||||
|
printExpr false false expr
|
||||||
|
print ")"
|
||||||
|
| NewTuple (exprs) ->
|
||||||
|
if needsParens then print "("
|
||||||
|
let indent = getCurrentIndent()
|
||||||
|
printExpr false true exprs.Head
|
||||||
|
for e in exprs.Tail do
|
||||||
|
print ","
|
||||||
|
breakLine indent
|
||||||
|
printExpr false true e
|
||||||
|
if needsParens then print ")"
|
||||||
|
| NewArray (_, exprs) ->
|
||||||
|
if exprs.Length = 0 then print "[| |]"
|
||||||
|
else
|
||||||
|
print "[| "
|
||||||
|
let indent = getCurrentIndent()
|
||||||
|
printExpr false true exprs.Head
|
||||||
|
for e in exprs.Tail do
|
||||||
|
breakLine indent
|
||||||
|
printExpr false true e
|
||||||
|
print " |]"
|
||||||
|
| Coerce (expr, typ) ->
|
||||||
|
print "("
|
||||||
|
printExpr false false expr
|
||||||
|
print " :> "
|
||||||
|
print (toString false typ)
|
||||||
|
print ")"
|
||||||
|
| TupleGet (expr, index) ->
|
||||||
|
print "(let "
|
||||||
|
let rec getTupleLength (typ:Type) =
|
||||||
|
let length = typ.GetGenericArguments().Length
|
||||||
|
if length = 0 then // happens in the Apiary provider
|
||||||
|
let typeNameSuffix = typ.Name.Substring(typ.Name.IndexOf('`') + 1)
|
||||||
|
typeNameSuffix.Substring(0, typeNameSuffix.IndexOf('[')) |> Int32.Parse
|
||||||
|
else
|
||||||
|
let lastItem = typ.GetGenericArguments() |> Seq.last
|
||||||
|
if lastItem.Name.StartsWith "Tuple`"
|
||||||
|
then length + getTupleLength lastItem - 1
|
||||||
|
else length
|
||||||
|
let tupleLength = getTupleLength expr.Type
|
||||||
|
let varName = "t" + (string (index + 1))
|
||||||
|
for i in 0..tupleLength-1 do
|
||||||
|
if i = index then
|
||||||
|
print varName
|
||||||
|
else
|
||||||
|
print "_"
|
||||||
|
if i <> tupleLength-1 then
|
||||||
|
print ","
|
||||||
|
print " = "
|
||||||
|
printExpr false false expr
|
||||||
|
print (" in " + varName + ")")
|
||||||
|
| expr -> print (expr.ToString())
|
||||||
|
|
||||||
|
printExpr false false expr
|
||||||
|
sb.ToString()
|
||||||
|
|
||||||
|
let sb = StringBuilder ()
|
||||||
|
|
||||||
|
let print (str: string) =
|
||||||
|
if not ignoreOutput then
|
||||||
|
sb.Append(str) |> ignore
|
||||||
|
|
||||||
|
let println() =
|
||||||
|
if not ignoreOutput then
|
||||||
|
sb.AppendLine() |> ignore
|
||||||
|
|
||||||
|
let printMember (memberInfo: MemberInfo) =
|
||||||
|
|
||||||
|
let print str =
|
||||||
|
print " "
|
||||||
|
print str
|
||||||
|
println()
|
||||||
|
|
||||||
|
let getMethodBody (m: ProvidedMethod) =
|
||||||
|
seq { if not m.IsStatic then yield (ProvidedTypeDefinition.EraseType m.DeclaringType)
|
||||||
|
for param in m.GetParameters() do yield (ProvidedTypeDefinition.EraseType param.ParameterType) }
|
||||||
|
|> Seq.map (fun typ -> Expr.Value(null, typ))
|
||||||
|
|> Array.ofSeq
|
||||||
|
|> m.GetInvokeCodeInternal false
|
||||||
|
|
||||||
|
let getConstructorBody (c: ProvidedConstructor) =
|
||||||
|
if c.IsImplicitCtor then Expr.Value(()) else
|
||||||
|
seq { for param in c.GetParameters() do yield (ProvidedTypeDefinition.EraseType param.ParameterType) }
|
||||||
|
|> Seq.map (fun typ -> Expr.Value(null, typ))
|
||||||
|
|> Array.ofSeq
|
||||||
|
|> c.GetInvokeCodeInternal false
|
||||||
|
|
||||||
|
let printExpr x =
|
||||||
|
if not ignoreOutput then
|
||||||
|
let rec removeParams x =
|
||||||
|
match x with
|
||||||
|
| Let (_, Value(null, _), body) -> removeParams body
|
||||||
|
| _ -> x
|
||||||
|
let formattedExpr = printExpr (removeParams x)
|
||||||
|
print formattedExpr
|
||||||
|
println()
|
||||||
|
|
||||||
|
let printObj x =
|
||||||
|
if ignoreOutput then
|
||||||
|
""
|
||||||
|
else
|
||||||
|
sprintf "\n%O\n" x
|
||||||
|
|
||||||
|
let getName (m:MemberInfo) =
|
||||||
|
if memberInfo.Name.Contains(" ") then
|
||||||
|
"``" + m.Name + "``"
|
||||||
|
else
|
||||||
|
m.Name
|
||||||
|
|
||||||
|
match memberInfo with
|
||||||
|
|
||||||
|
| :? ProvidedConstructor as cons ->
|
||||||
|
if not ignoreOutput then
|
||||||
|
print <| "new : " +
|
||||||
|
(toSignature <| cons.GetParameters()) + " -> " +
|
||||||
|
(toString true memberInfo.DeclaringType)
|
||||||
|
if not signatureOnly then
|
||||||
|
cons |> getConstructorBody |> printExpr
|
||||||
|
|
||||||
|
| :? ProvidedLiteralField as field ->
|
||||||
|
let value =
|
||||||
|
if signatureOnly then ""
|
||||||
|
else field.GetRawConstantValue() |> printObj
|
||||||
|
if not ignoreOutput then
|
||||||
|
print <| "val " + (getName field) + ": " +
|
||||||
|
(toString true field.FieldType) +
|
||||||
|
value
|
||||||
|
|
||||||
|
| :? ProvidedProperty as prop ->
|
||||||
|
if not ignoreOutput then
|
||||||
|
print <| (if prop.IsStatic then "static " else "") + "member " +
|
||||||
|
(getName prop) + ": " + (toString true prop.PropertyType) +
|
||||||
|
" with " + (if prop.CanRead && prop.CanWrite then "get, set" else if prop.CanRead then "get" else "set")
|
||||||
|
if not signatureOnly then
|
||||||
|
if prop.CanRead then
|
||||||
|
getMethodBody (prop.GetGetMethod() :?> ProvidedMethod) |> printExpr
|
||||||
|
if prop.CanWrite then
|
||||||
|
getMethodBody (prop.GetSetMethod() :?> ProvidedMethod) |> printExpr
|
||||||
|
|
||||||
|
| :? ProvidedMethod as m ->
|
||||||
|
if m.Attributes &&& MethodAttributes.SpecialName <> MethodAttributes.SpecialName then
|
||||||
|
if not ignoreOutput then
|
||||||
|
print <| (if m.IsStatic then "static " else "") + "member " +
|
||||||
|
(getName m) + ": " + (toSignature <| m.GetParameters()) +
|
||||||
|
" -> " + (toString true m.ReturnType)
|
||||||
|
if not signatureOnly then
|
||||||
|
m |> getMethodBody |> printExpr
|
||||||
|
|
||||||
|
| _ -> ()
|
||||||
|
|
||||||
|
add t
|
||||||
|
|
||||||
|
let currentDepth = ref 0
|
||||||
|
|
||||||
|
while pending.Count <> 0 && !currentDepth <= maxDepth do
|
||||||
|
let pendingForThisDepth = new List<_>(pending)
|
||||||
|
pending.Clear()
|
||||||
|
let pendingForThisDepth =
|
||||||
|
pendingForThisDepth
|
||||||
|
|> Seq.sortBy (fun m -> m.Name)
|
||||||
|
|> Seq.truncate maxWidth
|
||||||
|
for t in pendingForThisDepth do
|
||||||
|
//Disabled because not working on Mono
|
||||||
|
//for attr in t.GetCustomAttributesData() do
|
||||||
|
// print <| (sprintf "[<%A>]" attr).Replace("Microsoft.FSharp.Core.", null).Replace("CompilerServices.", null).Replace("Attribute(", "(")
|
||||||
|
// println()
|
||||||
|
match t with
|
||||||
|
| t when FSharpType.IsRecord t-> "record "
|
||||||
|
| t when FSharpType.IsModule t -> "module "
|
||||||
|
| t when t.IsValueType -> "struct "
|
||||||
|
| t when t.IsClass && t.IsSealed && t.IsAbstract -> "static class "
|
||||||
|
| t when t.IsClass && t.IsAbstract -> "abstract class "
|
||||||
|
| t when t.IsClass -> "class "
|
||||||
|
| _ -> ""
|
||||||
|
|> print
|
||||||
|
print (toString true t)
|
||||||
|
if t.BaseType <> typeof<obj> then
|
||||||
|
print " : "
|
||||||
|
print (toString true t.BaseType)
|
||||||
|
println()
|
||||||
|
t.GetMembers()
|
||||||
|
|> Seq.sortBy (fun m -> m.Name)
|
||||||
|
|> Seq.iter printMember
|
||||||
|
println()
|
||||||
|
currentDepth := !currentDepth + 1
|
||||||
|
|
||||||
|
sb.ToString()
|
|
@ -1,4 +1,4 @@
|
||||||
namespace Xamarin.iOSProviders
|
namespace Xamarin.UIProviders.DesignTime
|
||||||
|
|
||||||
open System
|
open System
|
||||||
open System.IO
|
open System.IO
|
||||||
|
@ -6,11 +6,12 @@ open System.Reflection
|
||||||
open ProviderImplementation.ProvidedTypes
|
open ProviderImplementation.ProvidedTypes
|
||||||
open Microsoft.FSharp.Core.CompilerServices
|
open Microsoft.FSharp.Core.CompilerServices
|
||||||
open Microsoft.FSharp.Quotations
|
open Microsoft.FSharp.Quotations
|
||||||
open Foundation
|
//open Foundation
|
||||||
open UIKit
|
//open UIKit
|
||||||
open MonoTouch.Design
|
open MonoTouch.Design
|
||||||
open iOSDesignerTypeProvider.ProvidedTypes
|
open ProvidedTypes
|
||||||
open ExtCore.Control
|
open ExtCore.Control
|
||||||
|
open Swensen.Unquote
|
||||||
|
|
||||||
module Sanitise =
|
module Sanitise =
|
||||||
let cleanTrailing = String.trimEnd [|':'|]
|
let cleanTrailing = String.trimEnd [|':'|]
|
||||||
|
@ -24,25 +25,13 @@ module Sanitise =
|
||||||
let makeSelectorMethodName (name:string) =
|
let makeSelectorMethodName (name:string) =
|
||||||
(makePascalCase name) + "Selector"
|
(makePascalCase name) + "Selector"
|
||||||
|
|
||||||
module Attributes =
|
|
||||||
let MakeActionAttributeData(argument:string) =
|
|
||||||
CustomAttributeDataExt.Make (typeof<ActionAttribute>.GetConstructor (typeof<string>),
|
|
||||||
[| CustomAttributeTypedArgument (typeof<ActionAttribute>, argument) |])
|
|
||||||
|
|
||||||
let MakeRegisterAttributeData(argument:string) =
|
|
||||||
CustomAttributeDataExt.Make (typeof<RegisterAttribute>.GetConstructor (typeof<string>),
|
|
||||||
[| CustomAttributeTypedArgument (typeof<string>, argument) |])
|
|
||||||
|
|
||||||
let MakeOutletAttributeData() =
|
|
||||||
CustomAttributeDataExt.Make (typeof<OutletAttribute>.GetUnitConstructor ())
|
|
||||||
|
|
||||||
module TypeBuilder =
|
module TypeBuilder =
|
||||||
|
|
||||||
let typeMap (proxy:ProxiedUiKitObject) =
|
let getTypeMap (assembly:Assembly) (proxy:ProxiedUiKitObject) =
|
||||||
//TODO: Expand this to also search in user assemblies
|
//TODO: Expand this to also search in user assemblies
|
||||||
let hasRegisterAttribute (typ:Type) =
|
let hasRegisterAttribute (typ:Type) =
|
||||||
query {for ca in typ.CustomAttributes do
|
query {for ca in typ.CustomAttributes do
|
||||||
exists (ca.AttributeType = typeof<RegisterAttribute>) }
|
exists (ca.AttributeType = assembly.GetType("Foundation.RegisterAttribute", true)) }
|
||||||
|
|
||||||
let hasMatchingAttributeName (typ:Type) proxyClassName =
|
let hasMatchingAttributeName (typ:Type) proxyClassName =
|
||||||
query {for ca in typ.CustomAttributes do
|
query {for ca in typ.CustomAttributes do
|
||||||
|
@ -51,7 +40,6 @@ module TypeBuilder =
|
||||||
| [:? string as name; :? bool as _isWrapper] -> name = proxyClassName
|
| [:? string as name; :? bool as _isWrapper] -> name = proxyClassName
|
||||||
| _ -> false) }
|
| _ -> false) }
|
||||||
|
|
||||||
let monotouchAssembly = typeof<UIButton>.Assembly
|
|
||||||
//debug
|
//debug
|
||||||
// let allTypes =
|
// let allTypes =
|
||||||
// query { for typ in monotouchAssembly.ExportedTypes do
|
// query { for typ in monotouchAssembly.ExportedTypes do
|
||||||
|
@ -66,7 +54,7 @@ module TypeBuilder =
|
||||||
//
|
//
|
||||||
// let justRegister =
|
// let justRegister =
|
||||||
// typeAndCa |> Array.map (fun (a,b) -> match b.ConstructorArguments |> Seq.map (fun ca -> ca.Value) |> Seq.toList with
|
// typeAndCa |> Array.map (fun (a,b) -> match b.ConstructorArguments |> Seq.map (fun ca -> ca.Value) |> Seq.toList with
|
||||||
// | [:? string as name] -> name
|
// toList | [:? string as name] -> name
|
||||||
// | [:? string as name; :? bool as _isWrapper] -> name
|
// | [:? string as name; :? bool as _isWrapper] -> name
|
||||||
// | _-> "invalid") |> Array.sort
|
// | _-> "invalid") |> Array.sort
|
||||||
//
|
//
|
||||||
|
@ -75,39 +63,48 @@ module TypeBuilder =
|
||||||
|
|
||||||
//------------------------------
|
//------------------------------
|
||||||
let matches =
|
let matches =
|
||||||
query { for typ in monotouchAssembly.ExportedTypes do
|
query { for typ in assembly.ExportedTypes do
|
||||||
where ((hasRegisterAttribute typ) && (hasMatchingAttributeName typ proxy.CodeGenerationBaseClass))
|
where ((hasRegisterAttribute typ) && (hasMatchingAttributeName typ proxy.CodeGenerationBaseClass))
|
||||||
select typ
|
select typ
|
||||||
exactlyOne }
|
exactlyOne }
|
||||||
matches
|
matches
|
||||||
|
|
||||||
//TODO add option for ObservableSource<NSObject>, potentially unneeded as outlets exposes this with observable...
|
//TODO add option for ObservableSource<NSObject>, potentially unneeded as outlets exposes this with observable...
|
||||||
let buildAction (action:ActionConnection) =
|
let buildAction (assembly:Assembly) (action:ActionConnection) =
|
||||||
//create a backing field fand property or the action
|
//create a backing field fand property or the action
|
||||||
|
|
||||||
|
let actionAttributeType = assembly.GetType("Foundation.ActionAttribute", true)
|
||||||
|
|
||||||
let actionField, actionProperty =
|
let actionField, actionProperty =
|
||||||
ProvidedTypes.ProvidedPropertyWithField (Sanitise.makeFieldName action.Selector,
|
ProvidedTypes.ProvidedPropertyWithField (Sanitise.makeFieldName action.Selector,
|
||||||
Sanitise.makePascalCase action.Selector,
|
Sanitise.makePascalCase action.Selector,
|
||||||
typeof<Action<NSObject>>)
|
typeof<option<obj -> unit>>)
|
||||||
|
|
||||||
let actionBinding =
|
let actionBinding =
|
||||||
ProvidedMethod(methodName = Sanitise.makeSelectorMethodName action.Selector,
|
ProvidedMethod(methodName = Sanitise.makeSelectorMethodName action.Selector,
|
||||||
parameters = [ProvidedParameter("sender", typeof<NSObject>)],
|
parameters = [ProvidedParameter("sender", typeof<obj>) ],
|
||||||
returnType = typeof<Void>,
|
returnType = typeof<Void>,
|
||||||
InvokeCode = fun args -> let instance = Expr.Cast<Action<NSObject>> (Expr.FieldGet (args.[0], actionField))
|
InvokeCode = fun args ->
|
||||||
<@@ if %instance <> null then (%instance).Invoke(%%args.[1]) @@>)
|
let callback = Expr.FieldGet(args.[0], actionField)
|
||||||
|
let arg = args.[1]
|
||||||
|
<@@ %%callback |> Option.iter (fun f -> f %%arg) @@>)
|
||||||
|
|
||||||
|
|
||||||
actionBinding.AddCustomAttribute (Attributes.MakeActionAttributeData(action.Selector))
|
actionBinding.AddCustomAttribute
|
||||||
|
(CustomAttributeDataExt.Make (actionAttributeType.GetConstructor (typeof<string>),
|
||||||
|
[| CustomAttributeTypedArgument (actionAttributeType, action.Selector) |]))
|
||||||
actionBinding.SetMethodAttrs MethodAttributes.Private
|
actionBinding.SetMethodAttrs MethodAttributes.Private
|
||||||
|
|
||||||
[actionField :> MemberInfo; actionProperty :> _; actionBinding :> _]
|
[actionField :> MemberInfo
|
||||||
|
actionProperty :> _
|
||||||
|
actionBinding :> _]
|
||||||
|
|
||||||
let buildOutlet (vc:ProxiedViewController, outlet:Outlet) =
|
let buildOutlet (assembly:Assembly) (vc:ProxiedViewController, outlet:Outlet) =
|
||||||
let uiProxy = vc.Storyboard.FindById (outlet.Destination) :?> ProxiedUiKitObject
|
let uiProxy = vc.Storyboard.FindById (outlet.Destination) :?> ProxiedUiKitObject
|
||||||
let outletField, outletProperty =
|
let outletField, outletProperty =
|
||||||
ProvidedTypes.ProvidedPropertyWithField (Sanitise.makeFieldName outlet.Property,
|
ProvidedTypes.ProvidedPropertyWithField (Sanitise.makeFieldName outlet.Property,
|
||||||
Sanitise.cleanTrailing outlet.Property,
|
Sanitise.cleanTrailing outlet.Property,
|
||||||
typeMap uiProxy)
|
getTypeMap assembly uiProxy)
|
||||||
outletProperty.AddCustomAttribute <| Attributes.MakeOutletAttributeData()
|
outletProperty.AddCustomAttribute <| CustomAttributeDataExt.Make (assembly.GetType("Foundation.OutletAttribute", true).GetUnitConstructor ())
|
||||||
|
|
||||||
//Add the property and backing fields to the view controller
|
//Add the property and backing fields to the view controller
|
||||||
outletField, outletProperty
|
outletField, outletProperty
|
||||||
|
@ -133,10 +130,10 @@ module TypeBuilder =
|
||||||
else buildReleaseOutletsExpr instance fields
|
else buildReleaseOutletsExpr instance fields
|
||||||
| _ -> invalidOp "Too many arguments")
|
| _ -> invalidOp "Too many arguments")
|
||||||
|
|
||||||
let buildController (vcs: ProxiedViewController seq) isAbstract addUnitCtor register (config:TypeProviderConfig) =
|
let buildController (assembly:Assembly) (vcs: ProxiedViewController seq) isAbstract addUnitCtor register (config:TypeProviderConfig) =
|
||||||
|
|
||||||
//get the real type of the controller proxy
|
//get the real type of the controller proxy
|
||||||
let vcsTypes = vcs |> Seq.map typeMap
|
let vcsTypes = vcs |> Seq.map (getTypeMap assembly)
|
||||||
let vc = Seq.head vcs
|
let vc = Seq.head vcs
|
||||||
let controllerType = Seq.head vcsTypes
|
let controllerType = Seq.head vcsTypes
|
||||||
let className = if isAbstract then vc.CustomClass + "Base" else vc.CustomClass
|
let className = if isAbstract then vc.CustomClass + "Base" else vc.CustomClass
|
||||||
|
@ -164,13 +161,13 @@ module TypeBuilder =
|
||||||
| Some ctor -> let emptyctor = ProvidedConstructor([], InvokeCode = Expr.emptyInvoke, BaseConstructorCall = fun args -> ctor, args)
|
| Some ctor -> let emptyctor = ProvidedConstructor([], InvokeCode = Expr.emptyInvoke, BaseConstructorCall = fun args -> ctor, args)
|
||||||
providedController.AddMember (emptyctor)
|
providedController.AddMember (emptyctor)
|
||||||
|
|
||||||
//If register set and nor isAbstract, then automatically registers using [<Register>]
|
//If register set and not isAbstract, then automatically registers using [<Register>]
|
||||||
if register && not isAbstract then
|
if register && not isAbstract then
|
||||||
let register = Attributes.MakeRegisterAttributeData customClass
|
let register = CustomAttributeDataExt.Make (assembly.GetType("Foundation.RegisterAttribute", true).GetConstructor (typeof<string>), [| CustomAttributeTypedArgument (typeof<string>, customClass) |])
|
||||||
providedController.AddCustomAttribute (register)
|
providedController.AddCustomAttribute (register)
|
||||||
|
|
||||||
//Add a little helper that has the "CustomClass" available, this can be used to register without knowing the CustomClass
|
//Add a little helper that has the "CustomClass" available, this can be used to register without knowing the CustomClass
|
||||||
providedController.AddMember (ProvidedLiteralField("CustomClass", typeof<string>, customClass))
|
providedController.AddMember (mkProvidedLiteralField "CustomClass" customClass)
|
||||||
|
|
||||||
//actions
|
//actions
|
||||||
let actionProvidedMembers =
|
let actionProvidedMembers =
|
||||||
|
@ -184,7 +181,7 @@ module TypeBuilder =
|
||||||
yield! subviews
|
yield! subviews
|
||||||
|> Seq.collect (fun sv -> sv.Actions)
|
|> Seq.collect (fun sv -> sv.Actions)
|
||||||
|> Seq.distinct
|
|> Seq.distinct
|
||||||
|> Seq.collect buildAction]
|
|> Seq.collect (buildAction assembly)]
|
||||||
|
|
||||||
providedController.AddMembers actionProvidedMembers
|
providedController.AddMembers actionProvidedMembers
|
||||||
|
|
||||||
|
@ -194,7 +191,7 @@ module TypeBuilder =
|
||||||
for outlet in vc.Outlets do
|
for outlet in vc.Outlets do
|
||||||
yield vc, outlet ]
|
yield vc, outlet ]
|
||||||
|> List.distinctBy (fun (_, outlet) -> outlet.Property)
|
|> List.distinctBy (fun (_, outlet) -> outlet.Property)
|
||||||
|> List.map buildOutlet
|
|> List.map (buildOutlet assembly)
|
||||||
|
|
||||||
for (field, property) in providedOutlets do
|
for (field, property) in providedOutlets do
|
||||||
providedController.AddMembers [field :> MemberInfo; property :> _]
|
providedController.AddMembers [field :> MemberInfo; property :> _]
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
namespace Xamarin.iOSProviders
|
namespace Xamarin.UIProviders.DesignTime
|
||||||
open System
|
open System
|
||||||
open System.Collections.Generic
|
open System.Collections.Generic
|
||||||
open System.IO
|
open System.IO
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
namespace Xamarin.iOSProviders
|
namespace Xamarin.UIProviders.DesignTime
|
||||||
open System
|
open System
|
||||||
open System.Diagnostics
|
open System.Diagnostics
|
||||||
|
|
||||||
|
|
|
@ -134,7 +134,7 @@ module internal Misc =
|
||||||
#else
|
#else
|
||||||
{ new CustomAttributeData() with
|
{ new CustomAttributeData() with
|
||||||
#endif
|
#endif
|
||||||
member __.Constructor = typeof<System.ObsoleteAttribute>.GetConstructors() |> Array.find (fun x -> x.GetParameters().Length = 1)
|
member __.Constructor = typeof<System.ObsoleteAttribute>.GetConstructors() |> Array.find (fun x -> x.GetParameters().Length = 2)
|
||||||
member __.ConstructorArguments = upcast [|CustomAttributeTypedArgument(typeof<string>, message) ; CustomAttributeTypedArgument(typeof<bool>, isError) |]
|
member __.ConstructorArguments = upcast [|CustomAttributeTypedArgument(typeof<string>, message) ; CustomAttributeTypedArgument(typeof<bool>, isError) |]
|
||||||
member __.NamedArguments = upcast [| |] }
|
member __.NamedArguments = upcast [| |] }
|
||||||
|
|
||||||
|
@ -494,7 +494,7 @@ module internal Misc =
|
||||||
else
|
else
|
||||||
Some (args.[1], args.[1])
|
Some (args.[1], args.[1])
|
||||||
)
|
)
|
||||||
|> Seq.item (n - 1)
|
|> Seq.nth (n - 1)
|
||||||
|
|
||||||
let adaptMethod = getFastFuncType args resultType
|
let adaptMethod = getFastFuncType args resultType
|
||||||
let adapted = E.Call(adaptMethod, [loop applicable])
|
let adapted = E.Call(adaptMethod, [loop applicable])
|
||||||
|
@ -2733,4 +2733,4 @@ type TypeProviderForNamespaces(namespacesAndTypes : list<(string * list<Provided
|
||||||
let bytes = System.IO.File.ReadAllBytes assembly.ManifestModule.FullyQualifiedName
|
let bytes = System.IO.File.ReadAllBytes assembly.ManifestModule.FullyQualifiedName
|
||||||
GlobalProvidedAssemblyElementsTable.theTable.[assembly] <- Lazy<_>.CreateFromValue bytes
|
GlobalProvidedAssemblyElementsTable.theTable.[assembly] <- Lazy<_>.CreateFromValue bytes
|
||||||
bytes
|
bytes
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -464,4 +464,4 @@ type TypeProviderForNamespaces =
|
||||||
[<CLIEvent>]
|
[<CLIEvent>]
|
||||||
member Disposing : IEvent<EventHandler,EventArgs>
|
member Disposing : IEvent<EventHandler,EventArgs>
|
||||||
|
|
||||||
interface ITypeProvider
|
interface ITypeProvider
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
namespace iOSDesignerTypeProvider
|
namespace Xamarin.UIProviders.DesignTime
|
||||||
|
|
||||||
open System
|
open System
|
||||||
open System.Collections.Generic
|
open System.Collections.Generic
|
||||||
|
@ -43,12 +43,19 @@ module ProvidedTypes =
|
||||||
|
|
||||||
let field = ProvidedField( fieldName, typ)
|
let field = ProvidedField( fieldName, typ)
|
||||||
field.SetFieldAttributes FieldAttributes.Private
|
field.SetFieldAttributes FieldAttributes.Private
|
||||||
|
|
||||||
|
|
||||||
let property = ProvidedProperty(propertyName, typ, defaultArg parameters [])
|
let property = ProvidedProperty(propertyName, typ, defaultArg parameters [])
|
||||||
property.GetterCode <- fun args -> Expr.FieldGet(args.[0], field)
|
property.GetterCode <- fun args -> Expr.FieldGet(args.[0], field)
|
||||||
property.SetterCode <- fun args -> Expr.FieldSet(args.[0], field, args.[1])
|
property.SetterCode <- fun args -> Expr.FieldSet(args.[0], field, args.[1])
|
||||||
|
|
||||||
field,property
|
field,property
|
||||||
|
|
||||||
|
let mkProvidedLiteralField name (value: 'a) =
|
||||||
|
ProvidedLiteralField(name, typeof<'a>, value)
|
||||||
|
|
||||||
|
let mkProvidedStaticParameter name (value: 'a) =
|
||||||
|
ProvidedStaticParameter(name, typeof<'a>, value)
|
||||||
|
|
||||||
module Expr =
|
module Expr =
|
||||||
/// This helper makes working with Expr.Let a little easier and safer
|
/// This helper makes working with Expr.Let a little easier and safer
|
||||||
|
|
|
@ -1,74 +1,78 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
<PropertyGroup>
|
||||||
<PropertyGroup>
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
<ProjectGuid>{DD17E7B0-6EE1-4862-80F8-E0CAB67D6137}</ProjectGuid>
|
||||||
<ProjectGuid>{DD17E7B0-6EE1-4862-80F8-E0CAB67D6137}</ProjectGuid>
|
<OutputType>Library</OutputType>
|
||||||
<OutputType>Library</OutputType>
|
<RootNamespace>Xamarin.UIProviders.DesignTime</RootNamespace>
|
||||||
<RootNamespace>iOSDesignerTypeProvider</RootNamespace>
|
<AssemblyName>Xamarin.UIProviders.DesignTime</AssemblyName>
|
||||||
<AssemblyName>Xamarin.iOSProviders</AssemblyName>
|
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
||||||
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
</PropertyGroup>
|
||||||
</PropertyGroup>
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
<DebugSymbols>true</DebugSymbols>
|
||||||
<DebugSymbols>true</DebugSymbols>
|
<DebugType>full</DebugType>
|
||||||
<OutputPath>bin\Debug</OutputPath>
|
<OutputPath>..\Build\Debug</OutputPath>
|
||||||
<DefineConstants>DEBUG</DefineConstants>
|
<DefineConstants>DEBUG</DefineConstants>
|
||||||
<ErrorReport>prompt</ErrorReport>
|
<ErrorReport>prompt</ErrorReport>
|
||||||
<PlatformTarget></PlatformTarget>
|
<PlatformTarget></PlatformTarget>
|
||||||
<Externalconsole>true</Externalconsole>
|
<Externalconsole>true</Externalconsole>
|
||||||
<CustomCommands>
|
<CustomCommands>
|
||||||
<CustomCommands>
|
<CustomCommands>
|
||||||
<Command type="Execute" command=""/Applications/Xamarin Studio.app/Contents/Resources/lib/monodevelop/bin/XamarinStudio.exe" --no-redirect" workingdir="" />
|
<Command type="Execute" command="../../../monodevelop/main/build/bin/MonoDevelop.exe --no-redirect" workingdir="../../../monodevelop/main/build/" />
|
||||||
</CustomCommands>
|
</CustomCommands>
|
||||||
</CustomCommands>
|
</CustomCommands>
|
||||||
<Optimize>false</Optimize>
|
<Optimize>false</Optimize>
|
||||||
<Tailcalls>false</Tailcalls>
|
<Tailcalls>false</Tailcalls>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||||
<DebugSymbols>true</DebugSymbols>
|
<DebugSymbols>true</DebugSymbols>
|
||||||
<DebugType>pdbonly</DebugType>
|
<DebugType>pdbonly</DebugType>
|
||||||
<Optimize>true</Optimize>
|
<Optimize>true</Optimize>
|
||||||
<OutputPath>bin\Release</OutputPath>
|
<OutputPath>..\Build\Release</OutputPath>
|
||||||
<ErrorReport>prompt</ErrorReport>
|
<ErrorReport>prompt</ErrorReport>
|
||||||
<PlatformTarget></PlatformTarget>
|
<PlatformTarget></PlatformTarget>
|
||||||
<ConsolePause>false</ConsolePause>
|
<ConsolePause>false</ConsolePause>
|
||||||
<Tailcalls>true</Tailcalls>
|
<Tailcalls>true</Tailcalls>
|
||||||
<DefineConstants></DefineConstants>
|
<DefineConstants></DefineConstants>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Reference Include="System" />
|
<Reference Include="System" />
|
||||||
<Reference Include="System.Core" />
|
<Reference Include="System.Core" />
|
||||||
<Reference Include="System.Numerics" />
|
<Reference Include="System.Numerics" />
|
||||||
<Reference Include="System.Xml" />
|
<Reference Include="System.Xml" />
|
||||||
<Reference Include="System.Xml.Linq" />
|
<Reference Include="System.Xml.Linq" />
|
||||||
<Reference Include="MonoTouch.Design">
|
<Reference Include="MonoTouch.Design">
|
||||||
<HintPath>\Applications\Xamarin Studio.app\Contents\Resources\lib\monodevelop\AddIns\MonoDevelop.IPhone\MonoTouch.Design.dll</HintPath>
|
<HintPath>\Applications\Xamarin Studio.app\Contents\Resources\lib\monodevelop\AddIns\MonoDevelop.IPhone\MonoTouch.Design.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="MonoTouch.Design.Client">
|
<Reference Include="MonoTouch.Design.Client">
|
||||||
<HintPath>\Applications\Xamarin Studio.app\Contents\Resources\lib\monodevelop\AddIns\MonoDevelop.IPhone\MonoTouch.Design.Client.dll</HintPath>
|
<HintPath>\Applications\Xamarin Studio.app\Contents\Resources\lib\monodevelop\AddIns\MonoDevelop.IPhone\MonoTouch.Design.Client.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="System.Drawing" />
|
<Reference Include="System.Drawing" />
|
||||||
<Reference Include="ExtCore">
|
<Reference Include="ExtCore">
|
||||||
<HintPath>..\packages\ExtCore.0.8.45\lib\net45\ExtCore.dll</HintPath>
|
<HintPath>..\packages\ExtCore.0.8.45\lib\net45\ExtCore.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="Xamarin.iOS">
|
<Reference Include="Xamarin.iOS">
|
||||||
<HintPath>\Library\Frameworks\Xamarin.iOS.framework\Versions\Current\lib\64bits\Xamarin.iOS.dll</HintPath>
|
<HintPath>\Library\Frameworks\Xamarin.iOS.framework\Versions\Current\lib\64bits\Xamarin.iOS.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
</ItemGroup>
|
<Reference Include="Unquote">
|
||||||
<ItemGroup>
|
<HintPath>..\packages\Unquote.3.1.1\lib\net45\Unquote.dll</HintPath>
|
||||||
<Compile Include="AssemblyInfo.fs" />
|
</Reference>
|
||||||
<Compile Include="ProvidedTypes.fsi" />
|
</ItemGroup>
|
||||||
<Compile Include="ProvidedTypes.fs" />
|
<ItemGroup>
|
||||||
<Compile Include="ProvidedTypesHelpers.fs" />
|
<Compile Include="AssemblyInfo.fs" />
|
||||||
<Compile Include="Observable.fs" />
|
<Compile Include="ProvidedTypes.fsi" />
|
||||||
<Compile Include="IO.fs" />
|
<Compile Include="ProvidedTypes.fs" />
|
||||||
<Compile Include="Debug.fs" />
|
<Compile Include="ProvidedTypesHelpers.fs" />
|
||||||
<Compile Include="Designtime.fs" />
|
<Compile Include="Observable.fs" />
|
||||||
<Compile Include="iOSDesignerProvider.fs" />
|
<Compile Include="IO.fs" />
|
||||||
</ItemGroup>
|
<Compile Include="DebugProvidedTypes.fs" />
|
||||||
<Import Project="$(MSBuildExtensionsPath32)\..\Microsoft SDKs\F#\3.0\Framework\v4.0\Microsoft.FSharp.Targets" />
|
<Compile Include="Designtime.fs" />
|
||||||
<ItemGroup>
|
<Compile Include="iOSDesignerProvider.fs" />
|
||||||
<None Include="packages.config" />
|
</ItemGroup>
|
||||||
<None Include="Script.fsx" />
|
<Import Project="$(MSBuildExtensionsPath32)\..\Microsoft SDKs\F#\3.0\Framework\v4.0\Microsoft.FSharp.Targets" />
|
||||||
</ItemGroup>
|
<ItemGroup>
|
||||||
|
<None Include="packages.config" />
|
||||||
|
<None Include="Script.fsx" />
|
||||||
|
<None Include="Debug.fs" />
|
||||||
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
|
@ -1,4 +1,4 @@
|
||||||
namespace Xamarin.iOSProviders
|
namespace Xamarin.UIProviders.DesignTime
|
||||||
|
|
||||||
open System
|
open System
|
||||||
open System.Collections.Generic
|
open System.Collections.Generic
|
||||||
|
@ -8,24 +8,37 @@ open System.Xml.Linq
|
||||||
open System.Reflection
|
open System.Reflection
|
||||||
open ProviderImplementation.ProvidedTypes
|
open ProviderImplementation.ProvidedTypes
|
||||||
open Microsoft.FSharp.Core.CompilerServices
|
open Microsoft.FSharp.Core.CompilerServices
|
||||||
open MonoTouch.Design
|
open MonoTouch.Design
|
||||||
|
open ProvidedTypes
|
||||||
|
|
||||||
[<TypeProvider>]
|
[<TypeProvider>]
|
||||||
type iOSDesignerProvider(config: TypeProviderConfig) as this =
|
type iOSDesignerProvider(config: TypeProviderConfig) as this =
|
||||||
inherit TypeProviderForNamespaces()
|
inherit TypeProviderForNamespaces()
|
||||||
|
|
||||||
//TODO figure out how to find this properly, must be a env var or something.
|
//TODO figure out how to find this properly, must be a env var or something.
|
||||||
let assemblybase = "/Developer/MonoTouch/usr/lib/mono/Xamarin.iOS/"
|
let baseFolder ="/Library/Frameworks/Xamarin.iOS.framework/Versions/Current/lib/mono"
|
||||||
|
|
||||||
|
let assemblybase, assembly =
|
||||||
|
match Path.GetFileName config.RuntimeAssembly with
|
||||||
|
| a when a = "Xamarin.UIProvider.TVOSRuntime.dll" ->
|
||||||
|
let folder = Path.Combine (baseFolder, "Xamarin.TVOS")
|
||||||
|
let assembly = Path.Combine(folder, "Xamarin.TVOS.dll")
|
||||||
|
folder, Assembly.LoadFrom assembly
|
||||||
|
| a when a = "Xamarin.UIProvider.iOSRuntime.dll" ->
|
||||||
|
let folder = Path.Combine (baseFolder, "Xamarin.iOS")
|
||||||
|
let assembly = Path.Combine(folder, "Xamarin.iOS.dll")
|
||||||
|
folder, Assembly.LoadFrom assembly
|
||||||
|
| other -> failwithf "Uknown runtime provider assembly: %s" other
|
||||||
|
|
||||||
do this.RegisterProbingFolder assemblybase
|
do this.RegisterProbingFolder assemblybase
|
||||||
|
|
||||||
let ns = "Xamarin.iOSProviders"
|
let ns = "Xamarin"
|
||||||
let asm = Assembly.GetExecutingAssembly()
|
let asm = Assembly.GetExecutingAssembly()
|
||||||
let rootType = ProvidedTypeDefinition(asm, ns, "UIProvider", None, HideObjectMethods = true, IsErased = false)
|
let rootType = ProvidedTypeDefinition(asm, ns, "UIProvider", None, HideObjectMethods=true, IsErased=false)
|
||||||
let watchedFiles = ResizeArray()
|
let watchedFiles = ResizeArray()
|
||||||
let buildTypes typeName (parameterValues: obj []) =
|
let buildTypes typeName (parameterValues: obj []) =
|
||||||
|
|
||||||
let allStoryBoards = Directory.EnumerateFiles ( config.ResolutionFolder, "*.storyboard", SearchOption.AllDirectories)
|
let allStoryBoards = Directory.EnumerateFiles ( config.ResolutionFolder, "*.storyboard", SearchOption.AllDirectories)
|
||||||
|
|
||||||
let register = parameterValues.[0] :?> bool
|
let register = parameterValues.[0] :?> bool
|
||||||
let isAbstract = parameterValues.[1] :?> bool
|
let isAbstract = parameterValues.[1] :?> bool
|
||||||
let addUnitCtor = parameterValues.[2] :?> bool
|
let addUnitCtor = parameterValues.[2] :?> bool
|
||||||
|
@ -57,7 +70,7 @@ type iOSDesignerProvider(config: TypeProviderConfig) as this =
|
||||||
[ for sc in groupedViewControllers do
|
[ for sc in groupedViewControllers do
|
||||||
let vcs = sc.AsEnumerable()
|
let vcs = sc.AsEnumerable()
|
||||||
// if not (String.IsNullOrWhiteSpace sc.ViewController.CustomClass) then
|
// if not (String.IsNullOrWhiteSpace sc.ViewController.CustomClass) then
|
||||||
yield TypeBuilder.buildController vcs isAbstract addUnitCtor register config ]
|
yield TypeBuilder.buildController assembly vcs isAbstract addUnitCtor register config ]
|
||||||
|
|
||||||
//Add the types to the container
|
//Add the types to the container
|
||||||
container.AddMembers generatedTypes
|
container.AddMembers generatedTypes
|
||||||
|
@ -72,12 +85,13 @@ type iOSDesignerProvider(config: TypeProviderConfig) as this =
|
||||||
assembly.AddTypes [container]
|
assembly.AddTypes [container]
|
||||||
container
|
container
|
||||||
|
|
||||||
do rootType.DefineStaticParameters([ProvidedStaticParameter ("AddRegisteration", typeof<bool>, false)
|
do rootType.DefineStaticParameters(
|
||||||
ProvidedStaticParameter ("AbstractController", typeof<bool>, true)
|
[mkProvidedStaticParameter "AddRegisteration" false
|
||||||
ProvidedStaticParameter ("AddDefaultConstructor", typeof<bool>, false)], buildTypes)
|
mkProvidedStaticParameter "AbstractController" true
|
||||||
|
mkProvidedStaticParameter "AddDefaultConstructor" false], buildTypes)
|
||||||
|
|
||||||
this.AddNamespace(ns, [rootType])
|
this.AddNamespace(ns, [rootType])
|
||||||
this.Disposing.Add (fun _ -> for disposer in watchedFiles do disposer.Dispose ())
|
this.Disposing.Add (fun _ -> for disposer in watchedFiles do disposer.Dispose ())
|
||||||
|
|
||||||
[<assembly:TypeProviderAssembly()>]
|
//[<assembly:TypeProviderAssembly()>]
|
||||||
do()
|
//do()
|
|
@ -1,4 +1,6 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<packages>
|
<packages>
|
||||||
<package id="ExtCore" version="0.8.45" targetFramework="net45" />
|
<package id="ExtCore" version="0.8.45" targetFramework="net45" />
|
||||||
|
<package id="FSharp.TypeProviders.StarterPack" version="1.1.3.88" targetFramework="net45" />
|
||||||
|
<package id="Unquote" version="3.1.1" targetFramework="net45" />
|
||||||
</packages>
|
</packages>
|
Загрузка…
Ссылка в новой задаче