Add basic Xamarin.iOS support #280

Closed
rmarinho wants to merge 20 commits from add-xamarin-ios into master
40 changed files with 2373 additions and 49 deletions

48
.gitignore vendored
View File

@@ -5,54 +5,6 @@
/.buckconfig.local /.buckconfig.local
/.buckd /.buckd
/gentest/test.html /gentest/test.html
.buckversion
splhack commented 2016-12-15 23:04:27 -08:00 (Migrated from github.com)
Review

Move to csharp/.gitignore

Move to csharp/.gitignore
# Visual studio code # Visual studio code
.vscode .vscode
*.pdb
*.tlog
*.obj
*.pch
*.log
*.orig
# Xcode
## Build generated
build/
DerivedData/
## Various settings
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3
xcuserdata/
## Other
*.moved-aside
*.xcuserstate
## Obj-C/Swift specific
*.hmap
*.ipa
*.dSYM.zip
*.dSYM
# CocoaPods
#
# We recommend against adding the Pods directory to your .gitignore. However
# you should judge for yourself, the pros and cons are mentioned at:
# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
#
Pods/
# Carthage
#
# Add this line if you want to avoid checking in source code from Carthage dependencies.
# Carthage/Checkouts
Carthage/Build

2
csharp/.gitignore vendored
View File

@@ -267,3 +267,5 @@ paket-files/
# Python Tools for Visual Studio (PTVS) # Python Tools for Visual Studio (PTVS)
__pycache__/ __pycache__/
*.pyc *.pyc
libyoga.a

View File

@@ -89,8 +89,10 @@ namespace Facebook.Yoga
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)] [DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
public static extern void YGNodePrint(YGNodeHandle node, YogaPrintOptions options); public static extern void YGNodePrint(YGNodeHandle node, YogaPrintOptions options);
#if !__IOS__
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)] [DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
[return: MarshalAs(UnmanagedType.I1)] [return: MarshalAs(UnmanagedType.I1)]
#endif
public static extern bool YGValueIsUndefined(float value); public static extern bool YGValueIsUndefined(float value);
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)] [DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]

View File

@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ProjectGuid>{A24B3BA6-3143-4FFF-B8B8-1EDF166F5F4A}</ProjectGuid>
</PropertyGroup>
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\CodeSharing\Microsoft.CodeSharing.Common.Default.props" />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\CodeSharing\Microsoft.CodeSharing.Common.props" />
<Import Project="Facebook.YogaKit.projitems" Label="Shared" />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\CodeSharing\Microsoft.CodeSharing.CSharp.targets" />
</Project>

View File

@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects>
<HasSharedItems>true</HasSharedItems>
<SharedGUID>{A24B3BA6-3143-4FFF-B8B8-1EDF166F5F4A}</SharedGUID>
</PropertyGroup>
<PropertyGroup Label="Configuration">
<Import_RootNamespace>Facebook.YogaKit</Import_RootNamespace>
</PropertyGroup>
<ItemGroup>
<Compile Include="$(MSBuildThisFileDirectory)YogaKit.cs" />
<Compile Include="$(MSBuildThisFileDirectory)YogaKitNative.cs" />
</ItemGroup>
</Project>

View File

@@ -0,0 +1,180 @@
using System;
using System.Collections.Generic;
using Facebook.Yoga;
#if __IOS__
using NativeView = UIKit.UIView;
#endif
namespace Facebook.YogaKit
{
public static class YogaKit
{
internal static Dictionary<YogaNode, object> Bridges = new Dictionary<YogaNode, object>();
public static void UsesYoga(this NativeView view, bool usesYoga)
{
YogaKitNative.UsesYoga(view, usesYoga);
}
public static bool GetUsesYoga(this NativeView view)
{
return YogaKitNative.GetUsesYoga(view);
}
public static void IncludeYogaLayout(this NativeView view, bool includeInLayout)
{
YogaKitNative.IncludeYogaLayout(view, includeInLayout);
}
public static bool GetIncludeYogaLayout(this NativeView view)
{
return YogaKitNative.GetIncludeYogaLayout(view);
}
public static void YogaWidth(this NativeView view, nfloat width)
{
var node = GetYogaNode(view);
node.Width = (float)width;
}
public static void YogaHeight(this NativeView view, nfloat height)
{
var node = GetYogaNode(view);
node.Height = (float)height;
}
public static void YogaMinWidth(this NativeView view, float minWidth)
{
var node = GetYogaNode(view);
node.MinWidth = minWidth;
}
public static void YogaMinHeight(this NativeView view, float minHeight)
{
var node = GetYogaNode(view);
node.MinHeight = minHeight;
}
public static void YogaMaxWidth(this NativeView view, float maxWidth)
{
var node = GetYogaNode(view);
node.MaxWidth = maxWidth;
}
public static void YogaMaxHeight(this NativeView view, float maxHeight)
{
var node = GetYogaNode(view);
node.MaxHeight = maxHeight;
}
public static void YogaAlignItems(this NativeView view, YogaAlign align)
{
var node = GetYogaNode(view);
node.AlignItems = align;
}
public static void YogaJustify(this NativeView view, YogaJustify justify)
{
var node = GetYogaNode(view);
node.JustifyContent = justify;
}
public static void YogaAlign(this NativeView view, YogaAlign align)
{
var node = GetYogaNode(view);
node.AlignContent = align;
}
public static void YogaAlignSelf(this NativeView view, YogaAlign align)
{
var node = GetYogaNode(view);
node.AlignSelf = align;
}
public static void YogaDirection(this NativeView view, YogaDirection direction)
{
var node = GetYogaNode(view);
node.StyleDirection = direction;
}
public static void YogaFlexDirection(this NativeView view, YogaFlexDirection direction)
{
var node = GetYogaNode(view);
node.FlexDirection = direction;
}
public static void YogaPositionType(this NativeView view, YogaPositionType position)
{
var node = GetYogaNode(view);
node.PositionType = position;
}
public static void YogaFlexWrap(this NativeView view, YogaWrap wrap)
{
var node = GetYogaNode(view);
node.Wrap = wrap;
}
public static void YogaFlexShrink(this NativeView view, float shrink)
{
var node = GetYogaNode(view);
node.FlexShrink = shrink;
}
public static void YogaFlexGrow(this NativeView view, float grow)
{
var node = GetYogaNode(view);
node.FlexGrow = grow;
}
public static void YogaFlexBasis(this NativeView view, float basis)
{
var node = GetYogaNode(view);
node.FlexBasis = basis;
}
public static void YogaPositionForEdge(this NativeView view, float position, YogaEdge edge)
{
var node = GetYogaNode(view);
node.SetPosition(edge, position);
}
public static void YogaMarginForEdge(this NativeView view, float margin, YogaEdge edge)
{
var node = GetYogaNode(view);
node.SetMargin(edge, margin);
}
public static void YogaPaddingForEdge(this NativeView view, float padding, YogaEdge edge)
{
var node = GetYogaNode(view);
node.SetPadding(edge, padding);
}
public static void YogaAspectRation(this NativeView view, float ratio)
{
var node = GetYogaNode(view);
node.StyleAspectRatio = ratio;
}
#region Layout and Sizing
public static void YogaApplyLayout(this NativeView view)
{
YogaKitNative.CalculateLayoutWithSize(view, view.Bounds.Size);
YogaKitNative.ApplyLayoutToViewHierarchy(view);
}
public static YogaDirection YogaResolvedDirection(this NativeView view)
{
var node = GetYogaNode(view);
return node.LayoutDirection;
}
#endregion
public static YogaNode GetYogaNode(this NativeView view)
{
return YogaKitNative.GetYogaNode(view);
}
}
}

View File

@@ -0,0 +1,255 @@
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using Facebook.Yoga;
#if __IOS__
using CoreGraphics;
using Foundation;
using UIKit;
#endif
namespace Facebook.YogaKit
{
internal static class YogaKitNative
{
static NSString YogaNodeKey = new NSString("YogaNode");
static NSString UsesYogaKey = new NSString("UsesYoga");
static NSString IncludeYogaKey = new NSString("UsesYoga");
public static void UsesYoga(UIView view, bool usesYoga)
{
var value = NSNumber.FromBoolean(usesYoga);
objc_setAssociatedObject(view.Handle, UsesYogaKey.Handle, value.Handle, AssociationPolicy.RETAIN_NONATOMIC);
}
public static bool GetUsesYoga(UIView view)
{
var value = ObjCRuntime.Runtime.GetNSObject(objc_getAssociatedObject(view.Handle, UsesYogaKey.Handle)) as NSNumber;
return value == null ? false : value.BoolValue;
}
public static void IncludeYogaLayout(UIView view, bool includeInLayout)
{
var value = NSNumber.FromBoolean(includeInLayout);
objc_setAssociatedObject(view.Handle, IncludeYogaKey.Handle, value.Handle, AssociationPolicy.RETAIN_NONATOMIC);
}
public static bool GetIncludeYogaLayout(UIView view)
{
var value = ObjCRuntime.Runtime.GetNSObject(objc_getAssociatedObject(view.Handle, IncludeYogaKey.Handle)) as NSNumber;
return value == null ? true : value.BoolValue;
}
public static YogaNode GetYogaNode(UIView view)
{
var value = ObjCRuntime.Runtime.GetNSObject(objc_getAssociatedObject(view.Handle, YogaNodeKey.Handle)) as YGNodeBridge;
if (value == null)
{
value = new YGNodeBridge();
value.SetContext(view);
objc_setAssociatedObject(view.Handle, YogaNodeKey.Handle, value.Handle, AssociationPolicy.RETAIN_NONATOMIC);
}
return value.node;
}
public static CGSize CalculateLayoutWithSize(UIView view, CGSize size)
{
if (!view.GetUsesYoga())
{
System.Diagnostics.Debug.WriteLine("Doesn't use Yoga");
}
AttachNodesFromViewHierachy(view);
var node = GetYogaNode(view);
node.Width = (float)size.Width;
node.Height = (float)size.Height;
node.CalculateLayout();
return new CGSize { Width = node.LayoutWidth, Height = node.LayoutHeight };
}
public static void ApplyLayoutToViewHierarchy(UIView view)
{
if (!view.GetIncludeYogaLayout())
return;
var node = GetYogaNode(view);
CGPoint topLeft = new CGPoint(node.LayoutX, node.LayoutY);
CGPoint bottomRight = new CGPoint(topLeft.X + node.LayoutWidth, topLeft.Y + node.LayoutHeight);
view.Frame = new CGRect(RoundPixelValue(topLeft.X), RoundPixelValue(topLeft.Y), RoundPixelValue(bottomRight.X) - RoundPixelValue(topLeft.X), RoundPixelValue(bottomRight.Y) - RoundPixelValue(topLeft.Y));
bool isLeaf = !view.GetUsesYoga() || view.Subviews.Length == 0;
if (!isLeaf)
{
for (int i = 0; i < view.Subviews.Length; i++)
{
ApplyLayoutToViewHierarchy(view.Subviews[i]);
}
}
}
public static CGSize YogaIntrinsicSize(this UIView view)
{
var constrainedSize = new CGSize
{
Width = float.NaN,
Height = float.NaN
};
return CalculateLayoutWithSize(view, constrainedSize);
}
static YogaSize MeasureView(YogaNode node, float width, YogaMeasureMode widthMode, float height, YogaMeasureMode heightMode)
{
var constrainedWidth = (widthMode == YogaMeasureMode.Undefined) ? nfloat.MaxValue : width;
var constrainedHeight = (heightMode == YogaMeasureMode.Undefined) ? nfloat.MaxValue : height;
UIView view = null;
if (YogaKit.Bridges.ContainsKey(node))
(YogaKit.Bridges[node] as YGNodeBridge).viewRef.TryGetTarget(out view);
var sizeThatFits = view.SizeThatFits(new CGSize(constrainedWidth, constrainedHeight));
var finalWidth = SanitizeMeasurement(constrainedWidth, sizeThatFits.Width, widthMode);
var finalHeight = SanitizeMeasurement(constrainedHeight, sizeThatFits.Height, heightMode);
return MeasureOutput.Make(finalWidth, finalHeight);
}
static float SanitizeMeasurement(nfloat constrainedSize, nfloat measuredSize, YogaMeasureMode measureMode)
{
float result;
if (measureMode == YogaMeasureMode.Exactly)
{
result = (float)constrainedSize;
}
else if (measureMode == YogaMeasureMode.AtMost)
{
result = (float)Math.Min(constrainedSize, measuredSize);
}
else {
result = (float)measuredSize;
}
return result;
}
static double RoundPixelValue(nfloat value)
{
nfloat scale = UIScreen.MainScreen.Scale;
return Math.Round(value * scale) / scale;
}
static void AttachNodesFromViewHierachy(UIView view)
{
var node = GetYogaNode(view);
// Only leaf nodes should have a measure function
if (!view.GetUsesYoga() || view.Subviews.Length == 0)
{
node.SetMeasureFunction(MeasureView);
RemoveAllChildren(node);
}
else
{
node.SetMeasureFunction(null);
// Create a list of all the subviews that we are going to use for layout.
var subviewsToInclude = new List<UIView>();
foreach (var subview in view.Subviews)
{
if (subview.GetIncludeYogaLayout())
{
subviewsToInclude.Add(subview);
}
}
var shouldReconstructChildList = false;
if (node.Count != subviewsToInclude.Count)
{
shouldReconstructChildList = true;
}
else
{
for (int i = 0; i < subviewsToInclude.Count; i++)
{
if (node[i] != GetYogaNode(subviewsToInclude[i]))
{
shouldReconstructChildList = true;
break;
}
}
}
if (shouldReconstructChildList)
{
RemoveAllChildren(node);
for (int i = 0; i < subviewsToInclude.Count; i++)
{
var subView = subviewsToInclude[i];
node.Insert(i, subView.GetYogaNode());
AttachNodesFromViewHierachy(subView);
}
}
}
}
static void RemoveAllChildren(YogaNode node)
{
if (node == null)
return;
while (node.Count > 0)
{
node.Clear();
}
}
[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,
}
}
class YGNodeBridge : NSObject
{
bool disposed;
internal WeakReference<UIView> viewRef;
internal YogaNode node;
public YGNodeBridge()
{
node = new YogaNode();
}
public void SetContext(UIView view)
{
viewRef = new WeakReference<UIView>(view);
YogaKit.Bridges.Add(node, this);
}
protected override void Dispose(bool disposing)
{
if (disposing && !disposed)
{
disposed = true;
YogaKit.Bridges.Remove(node);
viewRef = null;
node = null;
}
base.Dispose(disposing);
}
}
}

View File

@@ -0,0 +1,59 @@
using Foundation;
using UIKit;
namespace Facebook.Yoga.iOS.Test
{
// 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("AppDelegate")]
public class AppDelegate : UIApplicationDelegate
{
// class-level declarations
public override UIWindow Window
{
get;
set;
}
public override bool FinishedLaunching(UIApplication application, NSDictionary launchOptions)
{
// Override point for customization after application launch.
// If not required for your application you can safely delete this method
return true;
}
public override void OnResignActivation(UIApplication application)
{
// Invoked when the application is about to move from active to inactive state.
// This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message)
// or when the user quits the application and it begins the transition to the background state.
// Games should use this method to pause the game.
}
public override void DidEnterBackground(UIApplication application)
{
// Use this method to release shared resources, save user data, invalidate timers and store the application state.
// If your application supports background exection this method is called instead of WillTerminate when the user quits.
}
public override void WillEnterForeground(UIApplication application)
{
// Called as part of the transiton from background to active state.
// Here you can undo many of the changes made on entering the background.
}
public override void OnActivated(UIApplication application)
{
// Restart any tasks that were paused (or not yet started) while the application was inactive.
// If the application was previously in the background, optionally refresh the user interface.
}
public override void WillTerminate(UIApplication application)
{
// Called when the application is about to terminate. Save data, if needed. See also DidEnterBackground.
}
}
}

View File

@@ -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"
}
}

View File

@@ -0,0 +1,6 @@
{
"info" : {
"version" : 1,
"author" : "xcode"
}
}

View 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>

View File

@@ -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>{3B27656A-129D-4779-BDAD-1A088DFDD9C5}</ProjectGuid>
<ProjectTypeGuids>{FEACFBD2-3405-455C-9665-78FE426C6842};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<OutputType>Exe</OutputType>
<RootNamespace>Facebook.Yoga.iOS.Test</RootNamespace>
<AssemblyName>Facebook.Yoga.iOS.Test</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;</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>22979</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;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>{33B1B6BE-F415-4819-A5FB-CFFE2E40AD6E}</Project>
<Name>Facebook.YogaKit.iOS</Name>
</ProjectReference>
<ProjectReference Include="..\Facebook.Yoga.iOS\Facebook.Yoga.iOS.csproj">
<Project>{BE4CBFDA-02E2-4DF0-A81A-CEFB7987A708}</Project>
<Name>Facebook.Yoga.iOS</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath)\Xamarin\iOS\Xamarin.iOS.CSharp.targets" />
</Project>

View 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.Yoga.iOS.Test</string>
<key>CFBundleIdentifier</key>
<string>com.xamarin.facebook-yoga-ios-test</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleVersion</key>
<string>1.0</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>MinimumOSVersion</key>
<string>10.1</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>

View File

@@ -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>

View File

@@ -0,0 +1,15 @@
using UIKit;
namespace Facebook.Yoga.iOS.Test
{
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 "AppDelegate"
// you can specify it here.
UIApplication.Main(args, null, "AppDelegate");
}
}
}

View 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>

View File

@@ -0,0 +1,63 @@
using System;
using CoreGraphics;
using Facebook.YogaKit.iOS;
using Foundation;
using UIKit;
namespace Facebook.Yoga.iOS.Test
{
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.UsesYoga(true);
root.YogaWidth(width);
root.YogaWidth(height);
root.YogaAlignItems(YogaAlign.Center);
root.YogaJustify(YogaJustify.Center);
var child1 = new UIView { BackgroundColor = UIColor.Blue };
child1.YogaWidth(100);
child1.YogaHeight(100);
child1.UsesYoga(true);
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.YogaApplyLayout();
}
public override void DidReceiveMemoryWarning()
{
base.DidReceiveMemoryWarning();
// Release any cached data, images, etc that aren't in use.
}
}
}

View 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.Yoga.iOS.Test
{
[Register("ViewController")]
partial class ViewController
{
void ReleaseDesignerOutlets()
{
}
}
}

View File

@@ -0,0 +1,57 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2012
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Facebook.Yoga.iOS.Test", "Facebook.Yoga.iOS.Test\Facebook.Yoga.iOS.Test.csproj", "{3B27656A-129D-4779-BDAD-1A088DFDD9C5}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Facebook.YogaKit.iOS", "Facebook.YogaKit.iOS\Facebook.YogaKit.iOS.csproj", "{33B1B6BE-F415-4819-A5FB-CFFE2E40AD6E}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Facebook.Yoga.iOS", "Facebook.Yoga.iOS\Facebook.Yoga.iOS.csproj", "{BE4CBFDA-02E2-4DF0-A81A-CEFB7987A708}"
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
{3B27656A-129D-4779-BDAD-1A088DFDD9C5}.Debug|Any CPU.ActiveCfg = Debug|iPhoneSimulator
{3B27656A-129D-4779-BDAD-1A088DFDD9C5}.Debug|Any CPU.Build.0 = Debug|iPhoneSimulator
{3B27656A-129D-4779-BDAD-1A088DFDD9C5}.Release|Any CPU.ActiveCfg = Release|iPhone
{3B27656A-129D-4779-BDAD-1A088DFDD9C5}.Release|Any CPU.Build.0 = Release|iPhone
{3B27656A-129D-4779-BDAD-1A088DFDD9C5}.Debug|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator
{3B27656A-129D-4779-BDAD-1A088DFDD9C5}.Debug|iPhoneSimulator.Build.0 = Debug|iPhoneSimulator
{3B27656A-129D-4779-BDAD-1A088DFDD9C5}.Release|iPhone.ActiveCfg = Release|iPhone
{3B27656A-129D-4779-BDAD-1A088DFDD9C5}.Release|iPhone.Build.0 = Release|iPhone
{3B27656A-129D-4779-BDAD-1A088DFDD9C5}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator
{3B27656A-129D-4779-BDAD-1A088DFDD9C5}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator
{3B27656A-129D-4779-BDAD-1A088DFDD9C5}.Debug|iPhone.ActiveCfg = Debug|iPhone
{3B27656A-129D-4779-BDAD-1A088DFDD9C5}.Debug|iPhone.Build.0 = Debug|iPhone
{33B1B6BE-F415-4819-A5FB-CFFE2E40AD6E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{33B1B6BE-F415-4819-A5FB-CFFE2E40AD6E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{33B1B6BE-F415-4819-A5FB-CFFE2E40AD6E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{33B1B6BE-F415-4819-A5FB-CFFE2E40AD6E}.Release|Any CPU.Build.0 = Release|Any CPU
{33B1B6BE-F415-4819-A5FB-CFFE2E40AD6E}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
{33B1B6BE-F415-4819-A5FB-CFFE2E40AD6E}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
{33B1B6BE-F415-4819-A5FB-CFFE2E40AD6E}.Release|iPhone.ActiveCfg = Release|Any CPU
{33B1B6BE-F415-4819-A5FB-CFFE2E40AD6E}.Release|iPhone.Build.0 = Release|Any CPU
{33B1B6BE-F415-4819-A5FB-CFFE2E40AD6E}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
{33B1B6BE-F415-4819-A5FB-CFFE2E40AD6E}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
{33B1B6BE-F415-4819-A5FB-CFFE2E40AD6E}.Debug|iPhone.ActiveCfg = Debug|Any CPU
{33B1B6BE-F415-4819-A5FB-CFFE2E40AD6E}.Debug|iPhone.Build.0 = Debug|Any CPU
{BE4CBFDA-02E2-4DF0-A81A-CEFB7987A708}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{BE4CBFDA-02E2-4DF0-A81A-CEFB7987A708}.Debug|Any CPU.Build.0 = Debug|Any CPU
{BE4CBFDA-02E2-4DF0-A81A-CEFB7987A708}.Release|Any CPU.ActiveCfg = Release|Any CPU
{BE4CBFDA-02E2-4DF0-A81A-CEFB7987A708}.Release|Any CPU.Build.0 = Release|Any CPU
{BE4CBFDA-02E2-4DF0-A81A-CEFB7987A708}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
{BE4CBFDA-02E2-4DF0-A81A-CEFB7987A708}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
{BE4CBFDA-02E2-4DF0-A81A-CEFB7987A708}.Release|iPhone.ActiveCfg = Release|Any CPU
{BE4CBFDA-02E2-4DF0-A81A-CEFB7987A708}.Release|iPhone.Build.0 = Release|Any CPU
{BE4CBFDA-02E2-4DF0-A81A-CEFB7987A708}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
{BE4CBFDA-02E2-4DF0-A81A-CEFB7987A708}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
{BE4CBFDA-02E2-4DF0-A81A-CEFB7987A708}.Debug|iPhone.ActiveCfg = Debug|Any CPU
{BE4CBFDA-02E2-4DF0-A81A-CEFB7987A708}.Debug|iPhone.Build.0 = Debug|Any CPU
EndGlobalSection
EndGlobal

View File

@@ -0,0 +1,11 @@
using System;
using UIKit;
using Foundation;
using ObjCRuntime;
using CoreGraphics;
namespace Facebook.Yoga.iOS
{
// The build will fail without ApiDefinition.cs
}

View File

@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<CompileDependsOn>CopyInNativeLib;$(CompileDependsOn)</CompileDependsOn>
</PropertyGroup>
<!-- The # and , in this path does not play nice with the binding project logic, so make a copy -->
<Target Name="CopyInNativeLib" Inputs="..\..\..\buck-out\gen\csharp\yoganet-ios\libyoga.a" Outputs="$(ProjectDir)libyoga.a">
<Copy SourceFiles="..\..\..\buck-out\gen\csharp\yoganet-ios\libyoga.a" DestinationFiles="$(ProjectDir)/libyoga.a" />
</Target>
</Project>

View File

@@ -0,0 +1,121 @@
<?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>{BE4CBFDA-02E2-4DF0-A81A-CEFB7987A708}</ProjectGuid>
<ProjectTypeGuids>{8FFB629D-F513-41CE-95D2-7ECE97B6EEEC};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<OutputType>Library</OutputType>
<RootNamespace>Facebook.Yoga.iOS</RootNamespace>
<AssemblyName>Facebook.Yoga.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;</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<Optimize>true</Optimize>
<OutputPath>bin\Release</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="Xamarin.iOS" />
<Reference Include="System.Core" />
</ItemGroup>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="..\..\Facebook.Yoga\MeasureFunction.cs">
<Link>MeasureFunction.cs</Link>
</Compile>
<Compile Include="..\..\Facebook.Yoga\MeasureOutput.cs">
<Link>MeasureOutput.cs</Link>
</Compile>
<Compile Include="..\..\Facebook.Yoga\Native.cs">
<Link>Native.cs</Link>
</Compile>
<Compile Include="..\..\Facebook.Yoga\Spacing.cs">
<Link>Spacing.cs</Link>
</Compile>
<Compile Include="..\..\Facebook.Yoga\YogaAlign.cs">
<Link>YogaAlign.cs</Link>
</Compile>
<Compile Include="..\..\Facebook.Yoga\YogaConstants.cs">
<Link>YogaConstants.cs</Link>
</Compile>
<Compile Include="..\..\Facebook.Yoga\YogaDimension.cs">
<Link>YogaDimension.cs</Link>
</Compile>
<Compile Include="..\..\Facebook.Yoga\YogaDirection.cs">
<Link>YogaDirection.cs</Link>
</Compile>
<Compile Include="..\..\Facebook.Yoga\YogaEdge.cs">
<Link>YogaEdge.cs</Link>
</Compile>
<Compile Include="..\..\Facebook.Yoga\YogaExperimentalFeature.cs">
<Link>YogaExperimentalFeature.cs</Link>
</Compile>
<Compile Include="..\..\Facebook.Yoga\YogaFlexDirection.cs">
<Link>YogaFlexDirection.cs</Link>
</Compile>
<Compile Include="..\..\Facebook.Yoga\YogaJustify.cs">
<Link>YogaJustify.cs</Link>
</Compile>
<Compile Include="..\..\Facebook.Yoga\YogaLogger.cs">
<Link>YogaLogger.cs</Link>
</Compile>
<Compile Include="..\..\Facebook.Yoga\YogaLogLevel.cs">
<Link>YogaLogLevel.cs</Link>
</Compile>
<Compile Include="..\..\Facebook.Yoga\YogaMeasureFunc.cs">
<Link>YogaMeasureFunc.cs</Link>
</Compile>
<Compile Include="..\..\Facebook.Yoga\YogaMeasureMode.cs">
<Link>YogaMeasureMode.cs</Link>
</Compile>
<Compile Include="..\..\Facebook.Yoga\YogaNode.Create.cs">
<Link>YogaNode.Create.cs</Link>
</Compile>
<Compile Include="..\..\Facebook.Yoga\YogaNode.cs">
<Link>YogaNode.cs</Link>
</Compile>
<Compile Include="..\..\Facebook.Yoga\YogaOverflow.cs">
<Link>YogaOverflow.cs</Link>
</Compile>
<Compile Include="..\..\Facebook.Yoga\YogaPositionType.cs">
<Link>YogaPositionType.cs</Link>
</Compile>
<Compile Include="..\..\Facebook.Yoga\YogaPrintOptions.cs">
<Link>YogaPrintOptions.cs</Link>
</Compile>
<Compile Include="..\..\Facebook.Yoga\YogaSize.cs">
<Link>YogaSize.cs</Link>
</Compile>
<Compile Include="..\..\Facebook.Yoga\YogaWrap.cs">
<Link>YogaWrap.cs</Link>
</Compile>
</ItemGroup>
<ItemGroup>
<ObjcBindingApiDefinition Include="ApiDefinition.cs" />
</ItemGroup>
<ItemGroup>
<BundleResource Include="CustomBuildAction.targets" />
</ItemGroup>
<ItemGroup>
<NativeReference Include="libyoga.a">
<Kind>Static</Kind>
<SmartLink>False</SmartLink>
</NativeReference>
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath)\Xamarin\iOS\Xamarin.iOS.ObjCBinding.CSharp.targets" />
<Import Project="CustomBuildAction.targets" />
</Project>

View File

@@ -0,0 +1,67 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2012
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Facebook.Yoga.iOS", "Facebook.Yoga.iOS.csproj", "{128FB32A-C4A1-4363-BF06-0A36E700B7FA}"
EndProject
Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "Facebook.YogaKit.Shared", "..\..\Facebook.YogaKit\Facebook.YogaKit.Shared.shproj", "{A24B3BA6-3143-4FFF-B8B8-1EDF166F5F4A}"
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.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("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Shared", "Shared", "{89A39C6B-6A7B-4458-872B-A0456550CAA6}"
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
{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
{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
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{91C42D32-291D-4B72-90B4-551663D60B8B} = {89A39C6B-6A7B-4458-872B-A0456550CAA6}
{A24B3BA6-3143-4FFF-B8B8-1EDF166F5F4A} = {89A39C6B-6A7B-4458-872B-A0456550CAA6}
EndGlobalSection
EndGlobal

View File

@@ -0,0 +1,34 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using Foundation;
// This attribute allows you to mark your assemblies as “safe to link”.
// When the attribute is present, the linker—if enabled—will process the assembly
// even if youre using the “Link SDK assemblies only” option, which is the default for device builds.
[assembly: LinkerSafe]
// Information about this assembly is defined by the following attributes.
// Change them to the values specific to your project.
[assembly: AssemblyTitle("Facebook.Yoga.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("")]

View File

@@ -0,0 +1,59 @@
using Foundation;
using UIKit;
namespace Facebook.YogaKit.iOS.Sample
{
// 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("AppDelegate")]
public class AppDelegate : UIApplicationDelegate
{
// class-level declarations
public override UIWindow Window
{
get;
set;
}
public override bool FinishedLaunching(UIApplication application, NSDictionary launchOptions)
{
// Override point for customization after application launch.
// If not required for your application you can safely delete this method
return true;
}
public override void OnResignActivation(UIApplication application)
{
// Invoked when the application is about to move from active to inactive state.
// This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message)
// or when the user quits the application and it begins the transition to the background state.
// Games should use this method to pause the game.
}
public override void DidEnterBackground(UIApplication application)
{
// Use this method to release shared resources, save user data, invalidate timers and store the application state.
// If your application supports background exection this method is called instead of WillTerminate when the user quits.
}
public override void WillEnterForeground(UIApplication application)
{
// Called as part of the transiton from background to active state.
// Here you can undo many of the changes made on entering the background.
}
public override void OnActivated(UIApplication application)
{
// Restart any tasks that were paused (or not yet started) while the application was inactive.
// If the application was previously in the background, optionally refresh the user interface.
}
public override void WillTerminate(UIApplication application)
{
// Called when the application is about to terminate. Save data, if needed. See also DidEnterBackground.
}
}
}

View File

@@ -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"
}
}

View File

@@ -0,0 +1,6 @@
{
"info" : {
"version" : 1,
"author" : "xcode"
}
}

View 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>

View File

@@ -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>

View 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>

View File

@@ -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>

View File

@@ -0,0 +1,15 @@
using UIKit;
namespace Facebook.YogaKit.iOS.Sample
{
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 "AppDelegate"
// you can specify it here.
UIApplication.Main(args, null, "AppDelegate");
}
}
}

View 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>

View File

@@ -0,0 +1,60 @@
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.UsesYoga(true);
root.YogaWidth(width);
root.YogaWidth(height);
root.YogaAlignItems(YogaAlign.Center);
root.YogaJustify(YogaJustify.Center);
var child1 = new UIView { BackgroundColor = UIColor.Blue };
child1.YogaWidth(100);
child1.YogaHeight(100);
child1.UsesYoga(true);
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.YogaApplyLayout();
}
public override void DidReceiveMemoryWarning()
{
base.DidReceiveMemoryWarning();
// Release any cached data, images, etc that aren't in use.
}
}
}

View 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()
{
}
}
}

View File

@@ -0,0 +1,67 @@
<?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" />
</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>

View 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("")]

View File

@@ -0,0 +1,180 @@
using System;
using System.Collections.Generic;
using Facebook.Yoga;
#if __IOS__
using NativeView = UIKit.UIView;
#endif
namespace Facebook.YogaKit.iOS
{
public static class YogaKit
{
internal static Dictionary<YogaNode, object> Bridges = new Dictionary<YogaNode, object>();
public static void UsesYoga(this NativeView view, bool usesYoga)
{
YogaKitNative.UsesYoga(view, usesYoga);
}
public static bool GetUsesYoga(this NativeView view)
{
return YogaKitNative.GetUsesYoga(view);
}
public static void IncludeYogaLayout(this NativeView view, bool includeInLayout)
{
YogaKitNative.IncludeYogaLayout(view, includeInLayout);
}
public static bool GetIncludeYogaLayout(this NativeView view)
{
return YogaKitNative.GetIncludeYogaLayout(view);
}
public static void YogaWidth(this NativeView view, nfloat width)
{
var node = GetYogaNode(view);
node.Width = (float)width;
}
public static void YogaHeight(this NativeView view, nfloat height)
{
var node = GetYogaNode(view);
node.Height = (float)height;
}
public static void YogaMinWidth(this NativeView view, float minWidth)
{
var node = GetYogaNode(view);
node.MinWidth = minWidth;
}
public static void YogaMinHeight(this NativeView view, float minHeight)
{
var node = GetYogaNode(view);
node.MinHeight = minHeight;
}
public static void YogaMaxWidth(this NativeView view, float maxWidth)
{
var node = GetYogaNode(view);
node.MaxWidth = maxWidth;
}
public static void YogaMaxHeight(this NativeView view, float maxHeight)
{
var node = GetYogaNode(view);
node.MaxHeight = maxHeight;
}
public static void YogaAlignItems(this NativeView view, YogaAlign align)
{
var node = GetYogaNode(view);
node.AlignItems = align;
}
public static void YogaJustify(this NativeView view, YogaJustify justify)
{
var node = GetYogaNode(view);
node.JustifyContent = justify;
}
public static void YogaAlign(this NativeView view, YogaAlign align)
{
var node = GetYogaNode(view);
node.AlignContent = align;
}
public static void YogaAlignSelf(this NativeView view, YogaAlign align)
{
var node = GetYogaNode(view);
node.AlignSelf = align;
}
public static void YogaDirection(this NativeView view, YogaDirection direction)
{
var node = GetYogaNode(view);
node.StyleDirection = direction;
}
public static void YogaFlexDirection(this NativeView view, YogaFlexDirection direction)
{
var node = GetYogaNode(view);
node.FlexDirection = direction;
}
public static void YogaPositionType(this NativeView view, YogaPositionType position)
{
var node = GetYogaNode(view);
node.PositionType = position;
}
public static void YogaFlexWrap(this NativeView view, YogaWrap wrap)
{
var node = GetYogaNode(view);
node.Wrap = wrap;
}
public static void YogaFlexShrink(this NativeView view, float shrink)
{
var node = GetYogaNode(view);
node.FlexShrink = shrink;
}
public static void YogaFlexGrow(this NativeView view, float grow)
{
var node = GetYogaNode(view);
node.FlexGrow = grow;
}
public static void YogaFlexBasis(this NativeView view, float basis)
{
var node = GetYogaNode(view);
node.FlexBasis = basis;
}
public static void YogaPositionForEdge(this NativeView view, float position, YogaEdge edge)
{
var node = GetYogaNode(view);
node.SetPosition(edge, position);
}
public static void YogaMarginForEdge(this NativeView view, float margin, YogaEdge edge)
{
var node = GetYogaNode(view);
node.SetMargin(edge, margin);
}
public static void YogaPaddingForEdge(this NativeView view, float padding, YogaEdge edge)
{
var node = GetYogaNode(view);
node.SetPadding(edge, padding);
}
public static void YogaAspectRation(this NativeView view, float ratio)
{
var node = GetYogaNode(view);
node.StyleAspectRatio = ratio;
}
#region Layout and Sizing
public static void YogaApplyLayout(this NativeView view)
{
YogaKitNative.CalculateLayoutWithSize(view, view.Bounds.Size);
YogaKitNative.ApplyLayoutToViewHierarchy(view);
}
public static YogaDirection YogaResolvedDirection(this NativeView view)
{
var node = GetYogaNode(view);
return node.LayoutDirection;
}
#endregion
public static YogaNode GetYogaNode(this NativeView view)
{
return YogaKitNative.GetYogaNode(view);
}
}
}

View File

@@ -0,0 +1,253 @@
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using CoreGraphics;
using Facebook.Yoga;
using Foundation;
using UIKit;
namespace Facebook.YogaKit.iOS
{
internal static class YogaKitNative
{
static NSString YogaNodeKey = new NSString("YogaNode");
static NSString UsesYogaKey = new NSString("UsesYoga");
static NSString IncludeYogaKey = new NSString("UsesYoga");
public static void UsesYoga(UIView view, bool usesYoga)
{
var value = NSNumber.FromBoolean(usesYoga);
objc_setAssociatedObject(view.Handle, UsesYogaKey.Handle, value.Handle, AssociationPolicy.RETAIN_NONATOMIC);
}
public static bool GetUsesYoga(UIView view)
{
var value = ObjCRuntime.Runtime.GetNSObject(objc_getAssociatedObject(view.Handle, UsesYogaKey.Handle)) as NSNumber;
return value == null ? false : value.BoolValue;
}
public static void IncludeYogaLayout(UIView view, bool includeInLayout)
{
var value = NSNumber.FromBoolean(includeInLayout);
objc_setAssociatedObject(view.Handle, IncludeYogaKey.Handle, value.Handle, AssociationPolicy.RETAIN_NONATOMIC);
}
public static bool GetIncludeYogaLayout(UIView view)
{
var value = ObjCRuntime.Runtime.GetNSObject(objc_getAssociatedObject(view.Handle, IncludeYogaKey.Handle)) as NSNumber;
return value == null ? true : value.BoolValue;
}
public static YogaNode GetYogaNode(UIView view)
{
var value = ObjCRuntime.Runtime.GetNSObject(objc_getAssociatedObject(view.Handle, YogaNodeKey.Handle)) as YGNodeBridge;
if (value == null)
{
value = new YGNodeBridge();
value.SetContext(view);
objc_setAssociatedObject(view.Handle, YogaNodeKey.Handle, value.Handle, AssociationPolicy.RETAIN_NONATOMIC);
}
return value.node;
}
public static CGSize CalculateLayoutWithSize(UIView view, CGSize size)
{
if (!view.GetUsesYoga())
{
System.Diagnostics.Debug.WriteLine("Doesn't use Yoga");
}
AttachNodesFromViewHierachy(view);
var node = GetYogaNode(view);
node.Width = (float)size.Width;
node.Height = (float)size.Height;
node.CalculateLayout();
return new CGSize { Width = node.LayoutWidth, Height = node.LayoutHeight };
}
public static void ApplyLayoutToViewHierarchy(UIView view)
{
if (!view.GetIncludeYogaLayout())
return;
var node = GetYogaNode(view);
CGPoint topLeft = new CGPoint(node.LayoutX, node.LayoutY);
CGPoint bottomRight = new CGPoint(topLeft.X + node.LayoutWidth, topLeft.Y + node.LayoutHeight);
view.Frame = new CGRect(RoundPixelValue(topLeft.X), RoundPixelValue(topLeft.Y), RoundPixelValue(bottomRight.X) - RoundPixelValue(topLeft.X), RoundPixelValue(bottomRight.Y) - RoundPixelValue(topLeft.Y));
bool isLeaf = !view.GetUsesYoga() || view.Subviews.Length == 0;
if (!isLeaf)
{
for (int i = 0; i < view.Subviews.Length; i++)
{
ApplyLayoutToViewHierarchy(view.Subviews[i]);
}
}
}
public static CGSize YogaIntrinsicSize(this UIView view)
{
var constrainedSize = new CGSize
{
Width = float.NaN,
Height = float.NaN
};
return CalculateLayoutWithSize(view, constrainedSize);
}
static long MeasureView(YogaNode node, float width, YogaMeasureMode widthMode, float height, YogaMeasureMode heightMode)
{
var constrainedWidth = (widthMode == YogaMeasureMode.Undefined) ? nfloat.MaxValue : width;
var constrainedHeight = (heightMode == YogaMeasureMode.Undefined) ? nfloat.MaxValue : height;
UIView view = null;
if (YogaKit.Bridges.ContainsKey(node))
(YogaKit.Bridges[node] as YGNodeBridge).viewRef.TryGetTarget(out view);
var sizeThatFits = view.SizeThatFits(new CGSize(constrainedWidth, constrainedHeight));
var finalWidth = SanitizeMeasurement(constrainedWidth, sizeThatFits.Width, widthMode);
var finalHeight = SanitizeMeasurement(constrainedHeight, sizeThatFits.Height, heightMode);
return MeasureOutput.Make(finalWidth, finalHeight);
}
static float SanitizeMeasurement(nfloat constrainedSize, nfloat measuredSize, YogaMeasureMode measureMode)
{
float result;
if (measureMode == YogaMeasureMode.Exactly)
{
result = (float)constrainedSize;
}
else if (measureMode == YogaMeasureMode.AtMost)
{
result = (float)Math.Min(constrainedSize, measuredSize);
}
else {
result = (float)measuredSize;
}
return result;
}
static double RoundPixelValue(nfloat value)
{
nfloat scale = UIScreen.MainScreen.Scale;
return Math.Round(value * scale) / scale;
}
static void AttachNodesFromViewHierachy(UIView view)
{
var node = GetYogaNode(view);
// Only leaf nodes should have a measure function
if (!view.GetUsesYoga() || view.Subviews.Length == 0)
{
node.SetMeasureFunction(MeasureView);
RemoveAllChildren(node);
}
else
{
node.SetMeasureFunction(null);
// Create a list of all the subviews that we are going to use for layout.
var subviewsToInclude = new List<UIView>();
foreach (var subview in view.Subviews)
{
if (subview.GetIncludeYogaLayout())
{
subviewsToInclude.Add(subview);
}
}
var shouldReconstructChildList = false;
if (node.Count != subviewsToInclude.Count)
{
shouldReconstructChildList = true;
}
else
{
for (int i = 0; i < subviewsToInclude.Count; i++)
{
if (node[i] != GetYogaNode(subviewsToInclude[i]))
{
shouldReconstructChildList = true;
break;
}
}
}
if (shouldReconstructChildList)
{
RemoveAllChildren(node);
for (int i = 0; i < subviewsToInclude.Count; i++)
{
var subView = subviewsToInclude[i];
node.Insert(i, subView.GetYogaNode());
AttachNodesFromViewHierachy(subView);
}
}
}
}
static void RemoveAllChildren(YogaNode node)
{
if (node == null)
return;
while (node.Count > 0)
{
node.Clear();
}
}
[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,
}
}
class YGNodeBridge : NSObject
{
bool disposed;
internal WeakReference<UIView> viewRef;
internal YogaNode node;
public YGNodeBridge()
{
node = new YogaNode();
}
public void SetContext(UIView view)
{
viewRef = new WeakReference<UIView>(view);
YogaKit.Bridges.Add(node, this);
}
protected override void Dispose(bool disposing)
{
if (disposing && !disposed)
{
disposed = true;
YogaKit.Bridges.Remove(node);
viewRef = null;
node = null;
}
base.Dispose(disposing);
}
}
}