Add YogaKit Shared and iOS version
Summary: Using shared code for reuse in other platforms based on iOS native implementation. Adds YogaKit sample. Adds YogaKit tests (same as objc). ``` YogaKitTest : 80 ms Facebook.YogaKit.iOS.Tests.exe : 81 ms Tests run: 11 Passed: 8 Inconclusive: 0 Failed: 3 Ignored: 1 ``` Since we don't have extension properties we need to go with a extension method to get access to the YogaLayout . I m also not sure this is leak free yet, would love some help with testing and feedback about view/node lifecycle Closes https://github.com/facebook/yoga/pull/336 Reviewed By: splhack Differential Revision: D4415027 Pulled By: emilsjolander fbshipit-source-id: c88328212426c3200e6f0c48cda594cd2c432065
This commit is contained in:
committed by
Facebook Github Bot
parent
8021c5d968
commit
498a5980e8
23
csharp/iOS/Facebook.YogaKit.iOS.Sample/AppDelegate.cs
Normal file
23
csharp/iOS/Facebook.YogaKit.iOS.Sample/AppDelegate.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
using Foundation;
|
||||
using UIKit;
|
||||
|
||||
namespace Facebook.YogaKit.iOS.Sample
|
||||
{
|
||||
[Register("AppDelegate")]
|
||||
public class AppDelegate : UIApplicationDelegate
|
||||
{
|
||||
public override UIWindow Window
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
public override bool FinishedLaunching(UIApplication application, NSDictionary launchOptions)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
@@ -0,0 +1,157 @@
|
||||
{
|
||||
"images": [
|
||||
{
|
||||
"idiom": "iphone",
|
||||
"size": "29x29",
|
||||
"scale": "1x"
|
||||
},
|
||||
{
|
||||
"idiom": "iphone",
|
||||
"size": "29x29",
|
||||
"scale": "2x"
|
||||
},
|
||||
{
|
||||
"idiom": "iphone",
|
||||
"size": "29x29",
|
||||
"scale": "3x"
|
||||
},
|
||||
{
|
||||
"idiom": "iphone",
|
||||
"size": "40x40",
|
||||
"scale": "2x"
|
||||
},
|
||||
{
|
||||
"idiom": "iphone",
|
||||
"size": "40x40",
|
||||
"scale": "3x"
|
||||
},
|
||||
{
|
||||
"idiom": "iphone",
|
||||
"size": "57x57",
|
||||
"scale": "1x"
|
||||
},
|
||||
{
|
||||
"idiom": "iphone",
|
||||
"size": "57x57",
|
||||
"scale": "2x"
|
||||
},
|
||||
{
|
||||
"idiom": "iphone",
|
||||
"size": "60x60",
|
||||
"scale": "2x"
|
||||
},
|
||||
{
|
||||
"idiom": "iphone",
|
||||
"size": "60x60",
|
||||
"scale": "3x"
|
||||
},
|
||||
{
|
||||
"idiom": "ipad",
|
||||
"size": "29x29",
|
||||
"scale": "1x"
|
||||
},
|
||||
{
|
||||
"idiom": "ipad",
|
||||
"size": "29x29",
|
||||
"scale": "2x"
|
||||
},
|
||||
{
|
||||
"idiom": "ipad",
|
||||
"size": "40x40",
|
||||
"scale": "1x"
|
||||
},
|
||||
{
|
||||
"idiom": "ipad",
|
||||
"size": "40x40",
|
||||
"scale": "2x"
|
||||
},
|
||||
{
|
||||
"idiom": "ipad",
|
||||
"size": "50x50",
|
||||
"scale": "1x"
|
||||
},
|
||||
{
|
||||
"idiom": "ipad",
|
||||
"size": "50x50",
|
||||
"scale": "2x"
|
||||
},
|
||||
{
|
||||
"idiom": "ipad",
|
||||
"size": "72x72",
|
||||
"scale": "1x"
|
||||
},
|
||||
{
|
||||
"idiom": "ipad",
|
||||
"size": "72x72",
|
||||
"scale": "2x"
|
||||
},
|
||||
{
|
||||
"idiom": "ipad",
|
||||
"size": "76x76",
|
||||
"scale": "1x"
|
||||
},
|
||||
{
|
||||
"idiom": "ipad",
|
||||
"size": "76x76",
|
||||
"scale": "2x"
|
||||
},
|
||||
{
|
||||
"size": "24x24",
|
||||
"idiom": "watch",
|
||||
"scale": "2x",
|
||||
"role": "notificationCenter",
|
||||
"subtype": "38mm"
|
||||
},
|
||||
{
|
||||
"size": "27.5x27.5",
|
||||
"idiom": "watch",
|
||||
"scale": "2x",
|
||||
"role": "notificationCenter",
|
||||
"subtype": "42mm"
|
||||
},
|
||||
{
|
||||
"size": "29x29",
|
||||
"idiom": "watch",
|
||||
"role": "companionSettings",
|
||||
"scale": "2x"
|
||||
},
|
||||
{
|
||||
"size": "29x29",
|
||||
"idiom": "watch",
|
||||
"role": "companionSettings",
|
||||
"scale": "3x"
|
||||
},
|
||||
{
|
||||
"size": "40x40",
|
||||
"idiom": "watch",
|
||||
"scale": "2x",
|
||||
"role": "appLauncher",
|
||||
"subtype": "38mm"
|
||||
},
|
||||
{
|
||||
"size": "44x44",
|
||||
"idiom": "watch",
|
||||
"scale": "2x",
|
||||
"role": "longLook",
|
||||
"subtype": "42mm"
|
||||
},
|
||||
{
|
||||
"size": "86x86",
|
||||
"idiom": "watch",
|
||||
"scale": "2x",
|
||||
"role": "quickLook",
|
||||
"subtype": "38mm"
|
||||
},
|
||||
{
|
||||
"size": "98x98",
|
||||
"idiom": "watch",
|
||||
"scale": "2x",
|
||||
"role": "quickLook",
|
||||
"subtype": "42mm"
|
||||
}
|
||||
],
|
||||
"info": {
|
||||
"version": 1,
|
||||
"author": "xcode"
|
||||
}
|
||||
}
|
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"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,128 @@
|
||||
<?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>{6A094B74-FA9A-4E49-A8E1-F450A04E3E5B}</ProjectGuid>
|
||||
<ProjectTypeGuids>{FEACFBD2-3405-455C-9665-78FE426C6842};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
<OutputType>Exe</OutputType>
|
||||
<RootNamespace>Facebook.YogaKit.iOS.Sample</RootNamespace>
|
||||
<AssemblyName>Facebook.YogaKit.iOS.Sample</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;ENABLE_TEST_CLOUD;__IOS__</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<CodesignKey>iPhone Developer</CodesignKey>
|
||||
<MtouchDebug>true</MtouchDebug>
|
||||
<MtouchFastDev>true</MtouchFastDev>
|
||||
<MtouchProfiling>true</MtouchProfiling>
|
||||
<MtouchUseSGen>true</MtouchUseSGen>
|
||||
<MtouchUseRefCounting>true</MtouchUseRefCounting>
|
||||
<IOSDebuggerPort>56768</IOSDebuggerPort>
|
||||
<MtouchLink>None</MtouchLink>
|
||||
<MtouchArch>x86_64</MtouchArch>
|
||||
<MtouchHttpClientHandler>HttpClientHandler</MtouchHttpClientHandler>
|
||||
<MtouchTlsProvider>Default</MtouchTlsProvider>
|
||||
<DeviceSpecificBuild>false</DeviceSpecificBuild>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|iPhone' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\iPhone\Release</OutputPath>
|
||||
<DefineConstants></DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<CodesignKey>iPhone Developer</CodesignKey>
|
||||
<MtouchUseSGen>true</MtouchUseSGen>
|
||||
<MtouchUseRefCounting>true</MtouchUseRefCounting>
|
||||
<MtouchFloat32>true</MtouchFloat32>
|
||||
<CodesignEntitlements>Entitlements.plist</CodesignEntitlements>
|
||||
<MtouchLink>SdkOnly</MtouchLink>
|
||||
<MtouchArch>ARMv7, ARM64</MtouchArch>
|
||||
<MtouchHttpClientHandler>HttpClientHandler</MtouchHttpClientHandler>
|
||||
<MtouchTlsProvider>Default</MtouchTlsProvider>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|iPhoneSimulator' ">
|
||||
<DebugType></DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\iPhoneSimulator\Release</OutputPath>
|
||||
<DefineConstants></DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<CodesignKey>iPhone Developer</CodesignKey>
|
||||
<MtouchUseSGen>true</MtouchUseSGen>
|
||||
<MtouchUseRefCounting>true</MtouchUseRefCounting>
|
||||
<MtouchLink>None</MtouchLink>
|
||||
<MtouchArch>x86_64</MtouchArch>
|
||||
<MtouchHttpClientHandler>HttpClientHandler</MtouchHttpClientHandler>
|
||||
<MtouchTlsProvider>Default</MtouchTlsProvider>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|iPhone' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\iPhone\Debug</OutputPath>
|
||||
<DefineConstants>DEBUG;ENABLE_TEST_CLOUD;</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<CodesignKey>iPhone Developer</CodesignKey>
|
||||
<DeviceSpecificBuild>true</DeviceSpecificBuild>
|
||||
<MtouchDebug>true</MtouchDebug>
|
||||
<MtouchFastDev>true</MtouchFastDev>
|
||||
<MtouchProfiling>true</MtouchProfiling>
|
||||
<MtouchUseSGen>true</MtouchUseSGen>
|
||||
<MtouchUseRefCounting>true</MtouchUseRefCounting>
|
||||
<MtouchFloat32>true</MtouchFloat32>
|
||||
<CodesignEntitlements>Entitlements.plist</CodesignEntitlements>
|
||||
<MtouchLink>SdkOnly</MtouchLink>
|
||||
<MtouchArch>ARMv7, ARM64</MtouchArch>
|
||||
<MtouchHttpClientHandler>HttpClientHandler</MtouchHttpClientHandler>
|
||||
<MtouchTlsProvider>Default</MtouchTlsProvider>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="Xamarin.iOS" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\Contents.json" />
|
||||
<ImageAsset Include="Assets.xcassets\Contents.json" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="Resources\" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<InterfaceDefinition Include="LaunchScreen.storyboard" />
|
||||
<InterfaceDefinition Include="Main.storyboard" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="Info.plist" />
|
||||
<None Include="Entitlements.plist" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Main.cs" />
|
||||
<Compile Include="AppDelegate.cs" />
|
||||
<Compile Include="ViewController.cs" />
|
||||
<Compile Include="ViewController.designer.cs">
|
||||
<DependentUpon>ViewController.cs</DependentUpon>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Facebook.YogaKit.iOS\Facebook.YogaKit.iOS.csproj">
|
||||
<Project>{0C38AA9D-3178-4B43-9C3B-3C97A90FB1B0}</Project>
|
||||
<Name>Facebook.YogaKit.iOS</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Facebook.Yoga.iOS\Facebook.Yoga.iOS.csproj">
|
||||
<Project>{128FB32A-C4A1-4363-BF06-0A36E700B7FA}</Project>
|
||||
<Name>Facebook.Yoga.iOS</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildExtensionsPath)\Xamarin\iOS\Xamarin.iOS.CSharp.targets" />
|
||||
</Project>
|
39
csharp/iOS/Facebook.YogaKit.iOS.Sample/Info.plist
Normal file
39
csharp/iOS/Facebook.YogaKit.iOS.Sample/Info.plist
Normal file
@@ -0,0 +1,39 @@
|
||||
<?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>CFBundleName</key>
|
||||
<string>Facebook.YogaKit.iOS.Sample</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>com.xamarin.facebook-yogakit-ios-sample</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1.0</string>
|
||||
<key>LSRequiresIPhoneOS</key>
|
||||
<true/>
|
||||
<key>MinimumOSVersion</key>
|
||||
<string>10.2</string>
|
||||
<key>UIDeviceFamily</key>
|
||||
<array>
|
||||
<integer>1</integer>
|
||||
<integer>2</integer>
|
||||
</array>
|
||||
<key>UILaunchStoryboardName</key>
|
||||
<string>LaunchScreen</string>
|
||||
<key>UIMainStoryboardFile</key>
|
||||
<string>Main</string>
|
||||
<key>UIRequiredDeviceCapabilities</key>
|
||||
<array>
|
||||
<string>armv7</string>
|
||||
</array>
|
||||
<key>UISupportedInterfaceOrientations</key>
|
||||
<array>
|
||||
<string>UIInterfaceOrientationPortrait</string>
|
||||
<string>UIInterfaceOrientationLandscapeLeft</string>
|
||||
<string>UIInterfaceOrientationLandscapeRight</string>
|
||||
</array>
|
||||
<key>XSAppIconAssets</key>
|
||||
<string>Assets.xcassets/AppIcon.appiconset</string>
|
||||
</dict>
|
||||
</plist>
|
@@ -0,0 +1,27 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="9532" systemVersion="15D21" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" initialViewController="01J-lp-oVM">
|
||||
<dependencies>
|
||||
<deployment identifier="iOS" />
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="9530" />
|
||||
</dependencies>
|
||||
<scenes>
|
||||
<!--View Controller-->
|
||||
<scene sceneID="EHf-IW-A2E">
|
||||
<objects>
|
||||
<viewController id="01J-lp-oVM" sceneMemberID="viewController">
|
||||
<layoutGuides>
|
||||
<viewControllerLayoutGuide type="top" id="Llm-lL-Icb" />
|
||||
<viewControllerLayoutGuide type="bottom" id="xb3-aO-Qok" />
|
||||
</layoutGuides>
|
||||
<view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
|
||||
<rect key="frame" x="0.0" y="0.0" width="600" height="600" />
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES" />
|
||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite" />
|
||||
</view>
|
||||
</viewController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder" />
|
||||
</objects>
|
||||
<point key="canvasLocation" x="53" y="375" />
|
||||
</scene>
|
||||
</scenes>
|
||||
</document>
|
12
csharp/iOS/Facebook.YogaKit.iOS.Sample/Main.cs
Normal file
12
csharp/iOS/Facebook.YogaKit.iOS.Sample/Main.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
using UIKit;
|
||||
|
||||
namespace Facebook.YogaKit.iOS.Sample
|
||||
{
|
||||
public class Application
|
||||
{
|
||||
static void Main(string[] args)
|
||||
{
|
||||
UIApplication.Main(args, null, "AppDelegate");
|
||||
}
|
||||
}
|
||||
}
|
25
csharp/iOS/Facebook.YogaKit.iOS.Sample/Main.storyboard
Normal file
25
csharp/iOS/Facebook.YogaKit.iOS.Sample/Main.storyboard
Normal file
@@ -0,0 +1,25 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="6211" systemVersion="14A298i" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="BYZ-38-t0r">
|
||||
<dependencies>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="6204" />
|
||||
</dependencies>
|
||||
<scenes>
|
||||
<!--View Controller-->
|
||||
<scene sceneID="tne-QT-ifu">
|
||||
<objects>
|
||||
<viewController id="BYZ-38-t0r" customClass="ViewController" customModuleProvider="" 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">
|
||||
<rect key="frame" x="0.0" y="0.0" width="600" height="600" />
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES" />
|
||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite" />
|
||||
</view>
|
||||
</viewController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder" />
|
||||
</objects>
|
||||
</scene>
|
||||
</scenes>
|
||||
</document>
|
54
csharp/iOS/Facebook.YogaKit.iOS.Sample/ViewController.cs
Normal file
54
csharp/iOS/Facebook.YogaKit.iOS.Sample/ViewController.cs
Normal file
@@ -0,0 +1,54 @@
|
||||
using System;
|
||||
using CoreGraphics;
|
||||
using Facebook.Yoga;
|
||||
using UIKit;
|
||||
|
||||
namespace Facebook.YogaKit.iOS.Sample
|
||||
{
|
||||
public partial class ViewController : UIViewController
|
||||
{
|
||||
protected ViewController(IntPtr handle) : base(handle)
|
||||
{
|
||||
// Note: this .ctor should not contain any initialization logic.
|
||||
}
|
||||
|
||||
public override void ViewDidLoad()
|
||||
{
|
||||
base.ViewDidLoad();
|
||||
CreateViewHierarchy(View, View.Bounds.Size.Width, View.Bounds.Size.Height);
|
||||
}
|
||||
|
||||
static void CreateViewHierarchy(UIView root, nfloat width, nfloat height)
|
||||
{
|
||||
root.BackgroundColor = UIColor.Red;
|
||||
root.Yoga().IsEnabled = true;
|
||||
|
||||
root.Yoga().Width = (float)width;
|
||||
root.Yoga().Height = (float)height;
|
||||
root.Yoga().AlignItems = YogaAlign.Center;
|
||||
root.Yoga().JustifyContent = YogaJustify.Center;
|
||||
|
||||
var child1 = new UIView { BackgroundColor = UIColor.Blue };
|
||||
child1.Yoga().IsEnabled = true;
|
||||
child1.Yoga().Width = 100;
|
||||
child1.Yoga().Height = 100;
|
||||
|
||||
var child2 = new UIView
|
||||
{
|
||||
BackgroundColor = UIColor.Green,
|
||||
Frame = new CGRect { Size = new CGSize(200, 100) }
|
||||
};
|
||||
|
||||
var child3 = new UIView
|
||||
{
|
||||
BackgroundColor = UIColor.Yellow,
|
||||
Frame = new CGRect { Size = new CGSize(100, 100) }
|
||||
};
|
||||
|
||||
child2.AddSubview(child3);
|
||||
root.AddSubview(child1);
|
||||
root.AddSubview(child2);
|
||||
root.Yoga().ApplyLayout();
|
||||
}
|
||||
}
|
||||
}
|
17
csharp/iOS/Facebook.YogaKit.iOS.Sample/ViewController.designer.cs
generated
Normal file
17
csharp/iOS/Facebook.YogaKit.iOS.Sample/ViewController.designer.cs
generated
Normal file
@@ -0,0 +1,17 @@
|
||||
//
|
||||
// This file has been generated automatically by MonoDevelop to store outlets and
|
||||
// actions made in the Xcode designer. If it is removed, they will be lost.
|
||||
// Manual changes to this file may not be handled correctly.
|
||||
//
|
||||
using Foundation;
|
||||
|
||||
namespace Facebook.YogaKit.iOS.Sample
|
||||
{
|
||||
[Register("ViewController")]
|
||||
partial class ViewController
|
||||
{
|
||||
void ReleaseDesignerOutlets()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
6
csharp/iOS/Facebook.YogaKit.iOS.Tests/Entitlements.plist
Normal file
6
csharp/iOS/Facebook.YogaKit.iOS.Tests/Entitlements.plist
Normal file
@@ -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,118 @@
|
||||
<?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>{238DB3A2-1182-4775-92BC-F62C885725D8}</ProjectGuid>
|
||||
<ProjectTypeGuids>{FEACFBD2-3405-455C-9665-78FE426C6842};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
<OutputType>Exe</OutputType>
|
||||
<RootNamespace>Facebook.YogaKit.iOS.Tests</RootNamespace>
|
||||
<AssemblyName>Facebook.YogaKit.iOS.Tests</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>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<CodesignKey>iPhone Developer</CodesignKey>
|
||||
<MtouchDebug>true</MtouchDebug>
|
||||
<MtouchFastDev>true</MtouchFastDev>
|
||||
<MtouchProfiling>true</MtouchProfiling>
|
||||
<MtouchUseSGen>true</MtouchUseSGen>
|
||||
<MtouchUseRefCounting>true</MtouchUseRefCounting>
|
||||
<IOSDebuggerPort>17481</IOSDebuggerPort>
|
||||
<MtouchLink>None</MtouchLink>
|
||||
<MtouchArch>x86_64</MtouchArch>
|
||||
<MtouchHttpClientHandler>HttpClientHandler</MtouchHttpClientHandler>
|
||||
<MtouchTlsProvider>Default</MtouchTlsProvider>
|
||||
<DeviceSpecificBuild>false</DeviceSpecificBuild>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|iPhone' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\iPhone\Release</OutputPath>
|
||||
<DefineConstants></DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<CodesignKey>iPhone Developer</CodesignKey>
|
||||
<MtouchUseSGen>true</MtouchUseSGen>
|
||||
<MtouchUseRefCounting>true</MtouchUseRefCounting>
|
||||
<MtouchFloat32>true</MtouchFloat32>
|
||||
<CodesignEntitlements>Entitlements.plist</CodesignEntitlements>
|
||||
<MtouchLink>SdkOnly</MtouchLink>
|
||||
<MtouchArch>ARMv7, ARM64</MtouchArch>
|
||||
<MtouchHttpClientHandler>HttpClientHandler</MtouchHttpClientHandler>
|
||||
<MtouchTlsProvider>Default</MtouchTlsProvider>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|iPhoneSimulator' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\iPhoneSimulator\Release</OutputPath>
|
||||
<DefineConstants></DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<CodesignKey>iPhone Developer</CodesignKey>
|
||||
<MtouchUseSGen>true</MtouchUseSGen>
|
||||
<MtouchUseRefCounting>true</MtouchUseRefCounting>
|
||||
<MtouchLink>None</MtouchLink>
|
||||
<MtouchArch>x86_64</MtouchArch>
|
||||
<MtouchHttpClientHandler>HttpClientHandler</MtouchHttpClientHandler>
|
||||
<MtouchTlsProvider>Default</MtouchTlsProvider>
|
||||
</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>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<CodesignKey>iPhone Developer</CodesignKey>
|
||||
<DeviceSpecificBuild>true</DeviceSpecificBuild>
|
||||
<MtouchDebug>true</MtouchDebug>
|
||||
<MtouchFastDev>true</MtouchFastDev>
|
||||
<MtouchProfiling>true</MtouchProfiling>
|
||||
<MtouchUseSGen>true</MtouchUseSGen>
|
||||
<MtouchUseRefCounting>true</MtouchUseRefCounting>
|
||||
<MtouchFloat32>true</MtouchFloat32>
|
||||
<CodesignEntitlements>Entitlements.plist</CodesignEntitlements>
|
||||
<MtouchLink>SdkOnly</MtouchLink>
|
||||
<MtouchArch>ARMv7, ARM64</MtouchArch>
|
||||
<MtouchHttpClientHandler>HttpClientHandler</MtouchHttpClientHandler>
|
||||
<MtouchTlsProvider>Default</MtouchTlsProvider>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="Xamarin.iOS" />
|
||||
<Reference Include="MonoTouch.NUnitLite" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<InterfaceDefinition Include="LaunchScreen.storyboard" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="Info.plist" />
|
||||
<None Include="Entitlements.plist" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Main.cs" />
|
||||
<Compile Include="UnitTestAppDelegate.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Facebook.YogaKit.iOS\Facebook.YogaKit.iOS.csproj">
|
||||
<Project>{0C38AA9D-3178-4B43-9C3B-3C97A90FB1B0}</Project>
|
||||
<Name>Facebook.YogaKit.iOS</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Facebook.Yoga.iOS\Facebook.Yoga.iOS.csproj">
|
||||
<Project>{128FB32A-C4A1-4363-BF06-0A36E700B7FA}</Project>
|
||||
<Name>Facebook.Yoga.iOS</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="..\..\tests\Facebook.YogaKit.Shared.Tests\Facebook.YogaKit.Shared.Tests.projitems" Label="Shared" Condition="Exists('..\..\tests\Facebook.YogaKit.Shared.Tests\Facebook.YogaKit.Shared.Tests.projitems')" />
|
||||
<Import Project="$(MSBuildExtensionsPath)\Xamarin\iOS\Xamarin.iOS.CSharp.targets" />
|
||||
</Project>
|
36
csharp/iOS/Facebook.YogaKit.iOS.Tests/Info.plist
Normal file
36
csharp/iOS/Facebook.YogaKit.iOS.Tests/Info.plist
Normal file
@@ -0,0 +1,36 @@
|
||||
<?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>CFBundleName</key>
|
||||
<string>Facebook.YogaKit.iOS.Tests</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>com.xamarin.facebook-yogakit-ios-tests</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1.0</string>
|
||||
<key>LSRequiresIPhoneOS</key>
|
||||
<true />
|
||||
<key>MinimumOSVersion</key>
|
||||
<string>10.2</string>
|
||||
<key>UIDeviceFamily</key>
|
||||
<array>
|
||||
<integer>1</integer>
|
||||
<integer>2</integer>
|
||||
</array>
|
||||
<key>UISupportedInterfaceOrientations</key>
|
||||
<array>
|
||||
<string>UIInterfaceOrientationPortrait</string>
|
||||
<string>UIInterfaceOrientationLandscapeLeft</string>
|
||||
<string>UIInterfaceOrientationLandscapeRight</string>
|
||||
</array>
|
||||
<key>UILaunchStoryboardName</key>
|
||||
<string>LaunchScreen</string>
|
||||
<key>NSAppTransportSecurity</key>
|
||||
<dict>
|
||||
<key>NSAllowsArbitraryLoads</key>
|
||||
<true />
|
||||
</dict>
|
||||
</dict>
|
||||
</plist>
|
@@ -0,0 +1,27 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="9532" systemVersion="15D21" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" initialViewController="01J-lp-oVM">
|
||||
<dependencies>
|
||||
<deployment identifier="iOS" />
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="9530" />
|
||||
</dependencies>
|
||||
<scenes>
|
||||
<!--View Controller-->
|
||||
<scene sceneID="EHf-IW-A2E">
|
||||
<objects>
|
||||
<viewController id="01J-lp-oVM" sceneMemberID="viewController">
|
||||
<layoutGuides>
|
||||
<viewControllerLayoutGuide type="top" id="Llm-lL-Icb" />
|
||||
<viewControllerLayoutGuide type="bottom" id="xb3-aO-Qok" />
|
||||
</layoutGuides>
|
||||
<view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
|
||||
<rect key="frame" x="0.0" y="0.0" width="600" height="600" />
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES" />
|
||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite" />
|
||||
</view>
|
||||
</viewController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder" />
|
||||
</objects>
|
||||
<point key="canvasLocation" x="53" y="375" />
|
||||
</scene>
|
||||
</scenes>
|
||||
</document>
|
20
csharp/iOS/Facebook.YogaKit.iOS.Tests/Main.cs
Normal file
20
csharp/iOS/Facebook.YogaKit.iOS.Tests/Main.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Collections.Generic;
|
||||
|
||||
using Foundation;
|
||||
using UIKit;
|
||||
|
||||
namespace Facebook.YogaKit.iOS.Tests
|
||||
{
|
||||
public class Application
|
||||
{
|
||||
// This is the main entry point of the application.
|
||||
static void Main(string[] args)
|
||||
{
|
||||
// if you want to use a different Application Delegate class from "UnitTestAppDelegate"
|
||||
// you can specify it here.
|
||||
UIApplication.Main(args, null, "UnitTestAppDelegate");
|
||||
}
|
||||
}
|
||||
}
|
45
csharp/iOS/Facebook.YogaKit.iOS.Tests/UnitTestAppDelegate.cs
Normal file
45
csharp/iOS/Facebook.YogaKit.iOS.Tests/UnitTestAppDelegate.cs
Normal file
@@ -0,0 +1,45 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Collections.Generic;
|
||||
|
||||
using Foundation;
|
||||
using UIKit;
|
||||
using MonoTouch.NUnit.UI;
|
||||
|
||||
namespace Facebook.YogaKit.iOS.Tests
|
||||
{
|
||||
// The UIApplicationDelegate for the application. This class is responsible for launching the
|
||||
// User Interface of the application, as well as listening (and optionally responding) to
|
||||
// application events from iOS.
|
||||
[Register("UnitTestAppDelegate")]
|
||||
public partial class UnitTestAppDelegate : UIApplicationDelegate
|
||||
{
|
||||
// class-level declarations
|
||||
UIWindow window;
|
||||
TouchRunner runner;
|
||||
|
||||
//
|
||||
// This method is invoked when the application has loaded and is ready to run. In this
|
||||
// method you should instantiate the window, load the UI into it and then make the window
|
||||
// visible.
|
||||
//
|
||||
// You have 17 seconds to return from this method, or iOS will terminate your application.
|
||||
//
|
||||
public override bool FinishedLaunching(UIApplication app, NSDictionary options)
|
||||
{
|
||||
// create a new window instance based on the screen size
|
||||
window = new UIWindow(UIScreen.MainScreen.Bounds);
|
||||
runner = new TouchRunner(window);
|
||||
|
||||
// register every tests included in the main application/assembly
|
||||
runner.Add(System.Reflection.Assembly.GetExecutingAssembly());
|
||||
|
||||
window.RootViewController = new UINavigationController(runner.GetViewController());
|
||||
|
||||
// make the window visible
|
||||
window.MakeKeyAndVisible();
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
84
csharp/iOS/Facebook.YogaKit.iOS.sln
Normal file
84
csharp/iOS/Facebook.YogaKit.iOS.sln
Normal file
@@ -0,0 +1,84 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 2012
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Shared", "Shared", "{9FB621AA-66DD-46F1-8B10-94F508272A8D}"
|
||||
EndProject
|
||||
Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "Facebook.YogaKit.Shared", "..\Facebook.YogaKit\Facebook.YogaKit.Shared.shproj", "{A24B3BA6-3143-4FFF-B8B8-1EDF166F5F4A}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Facebook.YogaKit.iOS", "Facebook.YogaKit.iOS\Facebook.YogaKit.iOS.csproj", "{0C38AA9D-3178-4B43-9C3B-3C97A90FB1B0}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Facebook.YogaKit.iOS.Sample", "Facebook.YogaKit.iOS.Sample\Facebook.YogaKit.iOS.Sample.csproj", "{6A094B74-FA9A-4E49-A8E1-F450A04E3E5B}"
|
||||
EndProject
|
||||
Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "Facebook.Yoga.Shared", "..\Facebook.Yoga\Facebook.Yoga.Shared.shproj", "{91C42D32-291D-4B72-90B4-551663D60B8B}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Facebook.Yoga.iOS", "Facebook.Yoga.iOS\Facebook.Yoga.iOS.csproj", "{128FB32A-C4A1-4363-BF06-0A36E700B7FA}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Facebook.YogaKit.iOS.Tests", "Facebook.YogaKit.iOS.Tests\Facebook.YogaKit.iOS.Tests.csproj", "{238DB3A2-1182-4775-92BC-F62C885725D8}"
|
||||
EndProject
|
||||
Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "Facebook.YogaKit.Shared.Tests", "..\tests\Facebook.YogaKit.Shared.Tests\Facebook.YogaKit.Shared.Tests.shproj", "{63AB08F4-4F7C-42B7-A20F-D84204D0D3CE}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
Debug|iPhoneSimulator = Debug|iPhoneSimulator
|
||||
Release|iPhone = Release|iPhone
|
||||
Release|iPhoneSimulator = Release|iPhoneSimulator
|
||||
Debug|iPhone = Debug|iPhone
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{0C38AA9D-3178-4B43-9C3B-3C97A90FB1B0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{0C38AA9D-3178-4B43-9C3B-3C97A90FB1B0}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{0C38AA9D-3178-4B43-9C3B-3C97A90FB1B0}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{0C38AA9D-3178-4B43-9C3B-3C97A90FB1B0}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{0C38AA9D-3178-4B43-9C3B-3C97A90FB1B0}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
|
||||
{0C38AA9D-3178-4B43-9C3B-3C97A90FB1B0}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
|
||||
{0C38AA9D-3178-4B43-9C3B-3C97A90FB1B0}.Release|iPhone.ActiveCfg = Release|Any CPU
|
||||
{0C38AA9D-3178-4B43-9C3B-3C97A90FB1B0}.Release|iPhone.Build.0 = Release|Any CPU
|
||||
{0C38AA9D-3178-4B43-9C3B-3C97A90FB1B0}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
|
||||
{0C38AA9D-3178-4B43-9C3B-3C97A90FB1B0}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
|
||||
{0C38AA9D-3178-4B43-9C3B-3C97A90FB1B0}.Debug|iPhone.ActiveCfg = Debug|Any CPU
|
||||
{0C38AA9D-3178-4B43-9C3B-3C97A90FB1B0}.Debug|iPhone.Build.0 = Debug|Any CPU
|
||||
{6A094B74-FA9A-4E49-A8E1-F450A04E3E5B}.Debug|Any CPU.ActiveCfg = Debug|iPhoneSimulator
|
||||
{6A094B74-FA9A-4E49-A8E1-F450A04E3E5B}.Debug|Any CPU.Build.0 = Debug|iPhoneSimulator
|
||||
{6A094B74-FA9A-4E49-A8E1-F450A04E3E5B}.Release|Any CPU.ActiveCfg = Release|iPhone
|
||||
{6A094B74-FA9A-4E49-A8E1-F450A04E3E5B}.Release|Any CPU.Build.0 = Release|iPhone
|
||||
{6A094B74-FA9A-4E49-A8E1-F450A04E3E5B}.Debug|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator
|
||||
{6A094B74-FA9A-4E49-A8E1-F450A04E3E5B}.Debug|iPhoneSimulator.Build.0 = Debug|iPhoneSimulator
|
||||
{6A094B74-FA9A-4E49-A8E1-F450A04E3E5B}.Release|iPhone.ActiveCfg = Release|iPhone
|
||||
{6A094B74-FA9A-4E49-A8E1-F450A04E3E5B}.Release|iPhone.Build.0 = Release|iPhone
|
||||
{6A094B74-FA9A-4E49-A8E1-F450A04E3E5B}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator
|
||||
{6A094B74-FA9A-4E49-A8E1-F450A04E3E5B}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator
|
||||
{6A094B74-FA9A-4E49-A8E1-F450A04E3E5B}.Debug|iPhone.ActiveCfg = Debug|iPhone
|
||||
{6A094B74-FA9A-4E49-A8E1-F450A04E3E5B}.Debug|iPhone.Build.0 = Debug|iPhone
|
||||
{128FB32A-C4A1-4363-BF06-0A36E700B7FA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{128FB32A-C4A1-4363-BF06-0A36E700B7FA}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{128FB32A-C4A1-4363-BF06-0A36E700B7FA}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{128FB32A-C4A1-4363-BF06-0A36E700B7FA}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{128FB32A-C4A1-4363-BF06-0A36E700B7FA}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
|
||||
{128FB32A-C4A1-4363-BF06-0A36E700B7FA}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
|
||||
{128FB32A-C4A1-4363-BF06-0A36E700B7FA}.Release|iPhone.ActiveCfg = Release|Any CPU
|
||||
{128FB32A-C4A1-4363-BF06-0A36E700B7FA}.Release|iPhone.Build.0 = Release|Any CPU
|
||||
{128FB32A-C4A1-4363-BF06-0A36E700B7FA}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
|
||||
{128FB32A-C4A1-4363-BF06-0A36E700B7FA}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
|
||||
{128FB32A-C4A1-4363-BF06-0A36E700B7FA}.Debug|iPhone.ActiveCfg = Debug|Any CPU
|
||||
{128FB32A-C4A1-4363-BF06-0A36E700B7FA}.Debug|iPhone.Build.0 = Debug|Any CPU
|
||||
{238DB3A2-1182-4775-92BC-F62C885725D8}.Debug|Any CPU.ActiveCfg = Debug|iPhoneSimulator
|
||||
{238DB3A2-1182-4775-92BC-F62C885725D8}.Debug|Any CPU.Build.0 = Debug|iPhoneSimulator
|
||||
{238DB3A2-1182-4775-92BC-F62C885725D8}.Release|Any CPU.ActiveCfg = Release|iPhone
|
||||
{238DB3A2-1182-4775-92BC-F62C885725D8}.Release|Any CPU.Build.0 = Release|iPhone
|
||||
{238DB3A2-1182-4775-92BC-F62C885725D8}.Debug|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator
|
||||
{238DB3A2-1182-4775-92BC-F62C885725D8}.Debug|iPhoneSimulator.Build.0 = Debug|iPhoneSimulator
|
||||
{238DB3A2-1182-4775-92BC-F62C885725D8}.Release|iPhone.ActiveCfg = Release|iPhone
|
||||
{238DB3A2-1182-4775-92BC-F62C885725D8}.Release|iPhone.Build.0 = Release|iPhone
|
||||
{238DB3A2-1182-4775-92BC-F62C885725D8}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator
|
||||
{238DB3A2-1182-4775-92BC-F62C885725D8}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator
|
||||
{238DB3A2-1182-4775-92BC-F62C885725D8}.Debug|iPhone.ActiveCfg = Debug|iPhone
|
||||
{238DB3A2-1182-4775-92BC-F62C885725D8}.Debug|iPhone.Build.0 = Debug|iPhone
|
||||
EndGlobalSection
|
||||
GlobalSection(NestedProjects) = preSolution
|
||||
{A24B3BA6-3143-4FFF-B8B8-1EDF166F5F4A} = {9FB621AA-66DD-46F1-8B10-94F508272A8D}
|
||||
{91C42D32-291D-4B72-90B4-551663D60B8B} = {9FB621AA-66DD-46F1-8B10-94F508272A8D}
|
||||
{63AB08F4-4F7C-42B7-A20F-D84204D0D3CE} = {9FB621AA-66DD-46F1-8B10-94F508272A8D}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
69
csharp/iOS/Facebook.YogaKit.iOS/Facebook.YogaKit.iOS.csproj
Normal file
69
csharp/iOS/Facebook.YogaKit.iOS/Facebook.YogaKit.iOS.csproj
Normal file
@@ -0,0 +1,69 @@
|
||||
<?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>{0C38AA9D-3178-4B43-9C3B-3C97A90FB1B0}</ProjectGuid>
|
||||
<ProjectTypeGuids>{FEACFBD2-3405-455C-9665-78FE426C6842};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
<OutputType>Library</OutputType>
|
||||
<RootNamespace>Facebook.YogaKit.iOS</RootNamespace>
|
||||
<AssemblyName>Facebook.YogaKit.iOS</AssemblyName>
|
||||
<IPhoneResourcePrefix>Resources</IPhoneResourcePrefix>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug</OutputPath>
|
||||
<DefineConstants>DEBUG;__IOS__</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<CodesignKey>iPhone Developer</CodesignKey>
|
||||
<MtouchDebug>true</MtouchDebug>
|
||||
<MtouchFastDev>true</MtouchFastDev>
|
||||
<MtouchProfiling>true</MtouchProfiling>
|
||||
<MtouchUseSGen>true</MtouchUseSGen>
|
||||
<MtouchUseRefCounting>true</MtouchUseRefCounting>
|
||||
<IOSDebuggerPort>53781</IOSDebuggerPort>
|
||||
<DeviceSpecificBuild>false</DeviceSpecificBuild>
|
||||
<MtouchLink>SdkOnly</MtouchLink>
|
||||
<MtouchHttpClientHandler>HttpClientHandler</MtouchHttpClientHandler>
|
||||
<MtouchTlsProvider>Default</MtouchTlsProvider>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release</OutputPath>
|
||||
<DefineConstants></DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<CodesignKey>iPhone Developer</CodesignKey>
|
||||
<MtouchUseSGen>true</MtouchUseSGen>
|
||||
<MtouchUseRefCounting>true</MtouchUseRefCounting>
|
||||
<MtouchLink>SdkOnly</MtouchLink>
|
||||
<MtouchHttpClientHandler>HttpClientHandler</MtouchHttpClientHandler>
|
||||
<MtouchTlsProvider>Default</MtouchTlsProvider>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="Xamarin.iOS" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="Resources\" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="YogaLayout.cs" />
|
||||
<Compile Include="YogaKit.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Facebook.Yoga.iOS\Facebook.Yoga.iOS.csproj">
|
||||
<Project>{128FB32A-C4A1-4363-BF06-0A36E700B7FA}</Project>
|
||||
<Name>Facebook.Yoga.iOS</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="..\..\Facebook.YogaKit\Facebook.YogaKit.projitems" Label="Shared" Condition="Exists('..\..\Facebook.YogaKit\Facebook.YogaKit.projitems')" />
|
||||
<Import Project="$(MSBuildExtensionsPath)\Xamarin\iOS\Xamarin.iOS.CSharp.targets" />
|
||||
</Project>
|
26
csharp/iOS/Facebook.YogaKit.iOS/Properties/AssemblyInfo.cs
Normal file
26
csharp/iOS/Facebook.YogaKit.iOS/Properties/AssemblyInfo.cs
Normal file
@@ -0,0 +1,26 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
// Information about this assembly is defined by the following attributes.
|
||||
// Change them to the values specific to your project.
|
||||
|
||||
[assembly: AssemblyTitle("Facebook.YogaKit.iOS")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("")]
|
||||
[assembly: AssemblyCopyright("rmarinho")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
|
||||
// The form "{Major}.{Minor}.*" will automatically update the build and revision,
|
||||
// and "{Major}.{Minor}.{Build}.*" will update just the revision.
|
||||
|
||||
[assembly: AssemblyVersion("1.0.*")]
|
||||
|
||||
// The following attributes are used to specify the signing key for the assembly,
|
||||
// if desired. See the Mono documentation for more information about signing.
|
||||
|
||||
//[assembly: AssemblyDelaySign(false)]
|
||||
//[assembly: AssemblyKeyFile("")]
|
43
csharp/iOS/Facebook.YogaKit.iOS/YogaKit.cs
Normal file
43
csharp/iOS/Facebook.YogaKit.iOS/YogaKit.cs
Normal file
@@ -0,0 +1,43 @@
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using Foundation;
|
||||
using UIKit;
|
||||
|
||||
namespace Facebook.YogaKit
|
||||
{
|
||||
public static partial class YogaKit
|
||||
{
|
||||
static NSString YogaNodeKey = new NSString("YogaNode");
|
||||
|
||||
public static IYogaLayout Yoga(this UIView view)
|
||||
{
|
||||
return YogaLayoutNative(view);
|
||||
}
|
||||
|
||||
static IYogaLayout YogaLayoutNative(UIView view)
|
||||
{
|
||||
var yoga = ObjCRuntime.Runtime.GetNSObject(objc_getAssociatedObject(view.Handle, YogaNodeKey.Handle)) as YogaLayout;
|
||||
if (yoga == null)
|
||||
{
|
||||
yoga = new YogaLayout(view);
|
||||
objc_setAssociatedObject(view.Handle, YogaNodeKey.Handle, yoga.Handle, AssociationPolicy.RETAIN_NONATOMIC);
|
||||
}
|
||||
return yoga;
|
||||
}
|
||||
|
||||
[DllImport("/usr/lib/libobjc.dylib")]
|
||||
static extern void objc_setAssociatedObject(IntPtr @object, IntPtr key, IntPtr value, AssociationPolicy policy);
|
||||
|
||||
[DllImport("/usr/lib/libobjc.dylib")]
|
||||
static extern IntPtr objc_getAssociatedObject(IntPtr @object, IntPtr key);
|
||||
|
||||
enum AssociationPolicy
|
||||
{
|
||||
ASSIGN = 0,
|
||||
RETAIN_NONATOMIC = 1,
|
||||
COPY_NONATOMIC = 3,
|
||||
RETAIN = 01401,
|
||||
COPY = 01403,
|
||||
}
|
||||
}
|
||||
}
|
52
csharp/iOS/Facebook.YogaKit.iOS/YogaLayout.cs
Normal file
52
csharp/iOS/Facebook.YogaKit.iOS/YogaLayout.cs
Normal file
@@ -0,0 +1,52 @@
|
||||
using System.Collections.Generic;
|
||||
using CoreGraphics;
|
||||
using Facebook.Yoga;
|
||||
using Foundation;
|
||||
using UIKit;
|
||||
|
||||
namespace Facebook.YogaKit
|
||||
{
|
||||
public partial class YogaLayout : NSObject
|
||||
{
|
||||
static IEnumerable<UIView> GetChildren(UIView view) => view.Subviews;
|
||||
|
||||
static void MeasureNativeView(UIView view, float constrainedWidth, float constrainedHeight, out float sizeThatFitsWidth, out float sizeThatFitsHeight)
|
||||
{
|
||||
var sizeThatFits = view.SizeThatFits(new CGSize(constrainedWidth, constrainedHeight));
|
||||
sizeThatFitsWidth = (float)sizeThatFits.Width;
|
||||
sizeThatFitsHeight = (float)sizeThatFits.Height;
|
||||
}
|
||||
|
||||
static void GetWidthHeightOfNativeView(UIView view, out float width, out float height)
|
||||
{
|
||||
width = (float)view.Bounds.Width;
|
||||
height = (float)view.Bounds.Height;
|
||||
}
|
||||
|
||||
static float NativePixelScale => (float)UIScreen.MainScreen.Scale;
|
||||
|
||||
|
||||
static void ApplyLayoutToNativeView(UIView view, YogaNode node)
|
||||
{
|
||||
var topLeft = new CGPoint(node.LayoutX, node.LayoutY);
|
||||
var bottomRight = new CGPoint(topLeft.X + node.LayoutWidth, topLeft.Y + node.LayoutHeight);
|
||||
view.Frame = new CGRect(RoundPixelValue((float)topLeft.X), RoundPixelValue((float)topLeft.Y), RoundPixelValue((float)bottomRight.X) - RoundPixelValue((float)topLeft.X), RoundPixelValue((float)bottomRight.Y) - RoundPixelValue((float)topLeft.Y));
|
||||
}
|
||||
|
||||
bool _disposed;
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && !_disposed)
|
||||
{
|
||||
_disposed = true;
|
||||
if (YogaKit.Bridges.ContainsKey(_node))
|
||||
{
|
||||
YogaKit.Bridges.Remove(_node);
|
||||
}
|
||||
_node = null;
|
||||
_viewRef = null;
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user