Update docs to show new API.

Summary: Need API needs some new docs. I also removed the repo's `.hgignore` and added everything to fbobjc `.hgignore` via `./Tools/generate_hgignore.py` which uses Yoga's `.gitignore`.

Reviewed By: emilsjolander

Differential Revision: D4403967

fbshipit-source-id: f2158e4feb27953d1d9e21c775926e6207220c4a
This commit is contained in:
Dustin Shahidehpour
2017-01-12 10:16:12 -08:00
committed by Facebook Github Bot
parent c4a3e12add
commit adb81e2a1e
6 changed files with 33 additions and 98 deletions

27
docs/_docs/api/yogakit.md Normal file
View File

@@ -0,0 +1,27 @@
---
docid: yogakit
title: YogaKit
layout: docs
permalink: /docs/api/yogakit/
---
> The YogaKit API is still in rapid development. Please use it and [report issues, bugs or feedback](https://github.com/facebook/yoga/issues).
YogaKit is a Objective-C (and Swift-compatible) wrapper for Yoga. It allows iOS Developers to manage the layout of their views using the power of Yoga.
Layout configuration is done via the [YGLayout](https://github.com/facebook/yoga/blob/master/YogaKit/YGLayout.h) object. YogaKit exposes `YGLayout` via a [category](https://developer.apple.com/library/content/documentation/General/Conceptual/DevPedia-CocoaCore/Category.html) on [UIView](https://developer.apple.com/reference/uikit/uiview).
### Lifecycle
As with any `UIView`, instantiate it using `-(instancetype)initWithFrame:(CGRect)frame`. YogaKit uses the frame of the parent view to determine the space that is available for children in layout.
### Children
Yoga relies on `UIView` subviews to build up its internal layout tree. However, a subview can exclude itself from layout by setting the `isIncludedInLayout` property on `YGLayout` to `NO`.
It is also possible to query the number of children **included** in layout via `numberOfChildren`.
### Layout
To apply a layout to a view (and its' subviews) you need to call `[view.yoga applyLayout]`. This will do a layout calculation (if needed) and apply the calculated frames to every view included in the layout.
In the event that you need to another layout pass on a view you can mark it dirty via `[view.yoga markDirty]`.