42 Commits

Author SHA1 Message Date
Garrett Moon
96a7723d3b
Context is a pretty general name that will cause conflicts with subclasses (#1399) 2019-03-12 15:32:58 -07:00
Adlai Holler
223d6bdca7
Fix header typo (#1402) 2019-03-12 14:34:58 -07:00
Adlai Holler
6e7cdea797
Add extension points for global node behaviors, potentially replacing interface state delegates (#1229)
* Add extension points for global node behaviors via categories and a public ivar

* Update documentation on context ivar
2019-02-14 14:17:03 -08:00
Michael Schneider
d4efe95ec5
Improve separation of code for layout method types (#1305)
* Improve separation of code for layout method types

* Address PR comments

- Delegate to layout spec engine if the node is a layout spec node but yoga engine was asked for calculate the layout
- Change ASLayoutType to ASLayoutEngineType
- Improve layout engine fall through code
2019-01-28 07:41:49 -08:00
Adlai Holler
9bcafefa33
Remove use of NSHashTable for interface state delegates #trivial (#1122)
* Remove use of NSHashTable for interface state delegates #trivial

* Stray line

* One more case

* Add code to let people have more delegates

* Do it more
2018-09-17 14:29:22 -07:00
appleguy
465abb1ded [License] Simplify the Texture license to be pure Apache 2 (removing ASDK-Licenses). (#1077)
* [License] Simplify the Texture license to be pure Apache 2 (removing ASDK-Licenses)

With permission of the Facebook Open Source team, we are simplifying the Texture
license so that clients can rely on the Apache 2 terms that most of Texture is
already covered by. This means that code originally forked from AsyncDisplayKit
will be re-licensed from "BSD 3-clause + PATENTS v2" to Apache 2 without a
PATENTS file.

After getting confirmation that the updates to these core files look good, we'll
propagate this new license header to all files (in this same PR) and get sign-off
from all parties before landing.

* [License] Update all Texture source files to be pure Apache 2.

* Changelog entry for Apache 2 license update.

* Revert "[License] Update all Texture source files to be pure Apache 2."

This reverts commit ffa0fbbba9717d871dd16c4b07539f2f8208fc2b.

* [License] Update all Texture source files to be pure Apache 2, maintaining copyrights.

* [License] Update CONTRIBUTING, README, Podspec & Dangerfile.
2018-08-28 07:39:18 -07:00
Michael Schneider
b1f6030e86 Create and set delegate for clip corner layers within ASDisplayNode (#1029)
* Create and use ASDisplayNodeCornerLayerDelegate

* Return kCFNull for actionForLayer:forKey:
2018-07-18 02:56:37 -07:00
Garrett Moon
a4f78ad3e0
Adds support for having multiple interface state delegates. (#979)
* Adds support for having multiple interface state delegates.

Hopefully in a performant way.

* Switch to respondsToSelector for int del instead of separate object

* Add CHANGELOG

* Make ASDisplayNode+InterfaceState.h public

* Huy's comments

* Don't even bother removing since it's a weak hash table.
2018-06-27 16:52:40 -07:00
Adlai Holler
dbe469a94a
Standardize "extern" decls on AS_EXTERN (#972)
* Standardize "extern" decls on AS_EXTERN

* Rebase & remove from implementation files
2018-06-18 15:53:34 -07:00
Adlai Holler
35d59acd83
Add support for acquiring multiple locks at once (#958)
* Add ASLocking which supports -tryLock and taking multiple locks safely

* Better multi locking

* Assert about lock set capacity
2018-06-05 12:31:30 -07:00
Adlai Holler
cac14e0bce
Standardize Property Declaration Style in Core Classes (#870)
* Audit property attributes for core classes

* Update style guide

* Go crazy

* Update changelog
2018-05-24 14:42:43 -07:00
Yevgen Pogribnyi
7f01b89ddc [ASDisplayNode] Provide safeAreaInsets and layoutMargins bridge (#685)
* [ASDisplayNode] Add safeAreaInsets, layoutMargins and related properties to ASDisplayNode

* Add layoutMargins bridged to the underlying view

* Add safeAreaInsets bridged to the underlying view

* Add fallback calculation of safeAreaInsets for old iOS versions

* Add automaticallyRelayoutOnSafeAreaChanges and automaticallyRelayoutOnLayoutMarginsChanges properties

* Add additionalSafeAreaInsets property to ASViewController for compatibility with old iOS versions

* Provide safeAreaInsets for layer-backed nodes.

This also fixes tests.

* Fix crash when insetsLayoutMarginsFromSafeArea is set from a background thread

* Changes requested at code review:
* Update documentation for layoutMargins and safeAreaInsets properties. Suggest that users set the automaticallyRelayout* flags to ensure that their layout is synchronized to the margin's values.
* Fix accessing ASDisplayNode internal structures without a lock.
* Add shortcut in -[ASDisplayNode _fallbackUpdateSafeAreaOnChildren] to skip a child when possible.
* Add shortcut in ASViewController to avoid fallback safe area insets recalculation in iOS 11. Fix fallback safe area insets recalculation when the additionalSafeAreaInsets are set.
* Add debug check that a view controller's node is never reused without its view controller, so the viewControllerRoot flag value is always consistent.
* Use getters instead of reading ivars directly in -layoutMarginsDidChange and -safeAreaInsetsDidChange.

* Minor change in CHANGELOG

* Minor change in ASDisplayNodeTests.mm
2018-03-27 14:29:17 +01:00
Adlai Holler
0f9b1e6789
Make objects conform to NSLocking (#851)
* Make display node, layout spec, and style conform to NSLocking so that users/subclasses can access their locks

* Update the changelog

* Align slashes

* Put it back, when we're in ASDisplayNode

* Go a little further

* Put back the changes I didn't mean to commit

* Kick the CI

* Fix yoga build

* Put back non-locking change

* Address comments from Scott
2018-03-25 10:46:04 -07:00
Huy Nguyen
b4a269aabf
[ASDisplayNode] Always return the thread-safe cornerRadius property, even in slow CALayer rounding mode (#749)
- Failing to do so will introduce race conditions in which the property was updated on a background thread but main thread has not executed the block that updates the property of the node's layer. During that window, the layer's property is out-of-date and can't be used.
- After this change, ASDisplayNode's cornerRadius is the only source of truth and users must always use it instead of CALayer's.
2018-02-08 17:08:04 +00:00
Erekle
d8cda8d74a [iOS11] Update project settings and fix errors (#676)
* [iOS11] Update project settings and fix errors

* update changelog

* resolve comments
2017-11-30 12:25:06 +00:00
Mustafa Besnili
1e7d46196f Fix "This block and function declaration is not a prototype" warning. (#619) 2017-10-17 14:18:23 +01:00
Alex Hüllmandel
76eccbf269 Added attributed versions of accessibilityLabel, accessibilityHint, accessibilityValue (#554)
* Added attributed versions of accessibilityLabel, accessibilityHint and accessibilityValue

* Follow conventions for property types

* Use curly braces

* Update changelog

* Follow conventions for property types in UIView+ASConvenience.h

* Add compatibility for Xcode 8

* Use isEqualToString instead of pointer comparison

* Only allocate attributed strings once. Use _setAttributedAccessibilityToViewAndProperty only for attributed properties.
2017-09-18 18:07:01 +01:00
appleguy
e330e57668 [ASCornerRounding] Introduce .cornerRoundingType: CALayer, Precomposited, or Clip Corners. (#465)
* [ASCornerRounding] Initial (untested) implementation of ASCornerRounding features.

* [ASCornerRounding] Working version of both clip corners and precomposited corners.

* [ASCornerRounding] Improve factoring and documentation of corner rounding features.

* [ASCornerRounding] Some final fixups.

* Add entry to changelog for .cornerRoundingType
2017-09-18 13:02:51 +01:00
Huy Nguyen
4ba6f451f6 [Cleanup] Remove deprecated APIs (#529)
* Remove preferredFrameSize

* Remove -measure:

* Remove -measureWithSizeRange:

* Remove ASLayoutable

* Remove .name

* Remove deprecated style forwardings

That includes following properties that are declared on ASDisplayNode and ASLayoutSpec: spacingBefore, spacingAfter, flexGrow, flexShrink, flexBasis, alignSelf, ascender, descender, sizeRange and layoutPosition.

* Remove usesImplicitHierarchyManagement

* Remove deprecated range update callbacks:
-visibilityDidChange:
-visibleStateDidChange:
-displayStateDidChange:
-loadStateDidChange:

* Remove -clearFetchedData

* Remove -cancelLayoutTransitionsInProgress

* Remve ASDisplayNode+Deprecated.h

* Remove ASLayoutRangeTypeRender and ASLayoutRangeTypeFetchData

* Remove -[ASTableView clearContents]

* Remove reloadDataImmediately

* Remove ASStaticLayoutSpec

* Remove ASDimensionDeprecated

* Remove optional -pagerNode:constrainedSizeForNodeAtIndex: delegate method in ASPagerDelegate

* Remove suppressesInvalidCollectionUpdateExceptions

* Remove -[ASCollectionViewLayoutInspector initWithCollectionView]

* Remove ASVideoPlayerNode.loadAssetWhenNodeBecomesVisible

* Update CHANGELOG

* Update license of ASLayoutSpecTests.m

* Update examples/PagerNode

* Remove ASEnvironmentTraitCollection

* Remove -ASViewController.nodeConstrainedSize

* More on removing ASLayoutable
2017-09-07 19:25:42 +01:00
Adlai Holler
01c14f0fc2 Invalidate layouts more aggressively when transitioning with animation (#476)
* Be more aggressive at invalidating layouts during transitions, add a debug method, fix some build errors when verbose logging

* Add a changelog entry
2017-07-26 22:27:58 -07:00
appleguy
bc361caf5e [ASDisplayNode] Allow setting stretchable contents on nodes; add bridged properties. (#429)
This makes it much easier to use the ASCoreAnimationExtras method which offers by
far the most efficient way to display a stretchable image.

In the future, we should move that function to UIImage+ASConvenience or another
header where it can be more easily found and enjoyed!
2017-07-09 10:54:39 -07:00
Adlai Holler
8ec4b312cf Overhaul our logging, add activity tracing support. (#399)
* Improve the os_log and os_activity integration

* Address feedback from Scott and Huy
2017-07-03 19:03:26 -07:00
Huy Nguyen
05e9bdd092 Small changes required by the coming layout debugger (#337)
* Small changes required by the layout debugger
- `ASDisplayNode` can be told to not flatten its layout immediately but later on. The unflattened layout is also stored in a separate property. It's needed for inspecting not only display nodes but also layout specs used to compute a layout tree.
- `ASLayout` can be told to always retain its sublayout elements. This is needed especially for layout specs since they are usually not retained after an ASLayout was computed.

* Update CHANGELOG

* Address comments
2017-06-08 10:47:50 -07:00
Michael Schneider
13c467b2f4 Fix internal Linter warnings #trivial (#340)
* Fix internal Linter warnings

* Remove explicit copy for block as let us just use the default one
2017-06-08 10:45:03 -07:00
Michael Schneider
b32e69d64b [Layout] Extract layout implementation code into it's own subcategories (#272)
* Extract layout code into ASDisplayNode categories

* Category renaming and documentation

* Changelog

* Change header
2017-05-15 11:10:59 -07:00
Michael Schneider
8692428481 [ASDisplayNode] Pass drawParameter in rendering context callbacks (#248)
* Pass drawParameter in rendering context callbacks

* Add changelog

* Fix examples
2017-05-08 14:39:40 -07:00
Adlai Holler
80357b1c7c Don't use associated objects for ASDisplayNode.drawingPriority (#239) 2017-05-05 08:22:30 -07:00
Michael Schneider
82b7806473 [Layout] Remove finalLayoutElement (#96)
* Remove finalLayoutElement

* Add changelog

* Remove some documentation
2017-05-03 10:45:01 -07:00
Michael Schneider
b6734faa3b Extract ASLayoutElement and ASLayoutElementStylability into categories #trivial (#131)
* Initial move of code into layout category

* Cleanup

* Some more
2017-05-02 14:38:06 -07:00
Adlai Holler
b1e1bfda20 Improve Our Handling of Subnodes (#223)
* Improve the subnodes/fast enumeration situation

* Increment changlag

* Assert our subnodes match
2017-05-02 13:02:07 -07:00
Adlai Holler
4d5e3ce81e Tighten Rasterization API, Undeprecate It (#82)
* Tamp down the rasterization API, and undeprecate it

* Update license header

* Update chornglorg

* Address comments
2017-05-01 08:26:37 -07:00
appleguy
03a1aa2660 [ASDisplayNode] Implement a std::atomic-based flag system for superb performance (#89)
* [ASDisplayNode] Convert isSynchronous to an Objective-C atomic BOOL.

This reduces lock contention, and should also fix a very rarely seen deadlock.

* [ASDisplayNode] Implement a std::atomic-based flag system for superb performance

Although Objective-C atomics are equally fast, or better that std::atomic when
access through method calls, for the most intense use cases it is best to avoid
method calls entirely.

In ASDisplayNode, we could benefit significantly from avoiding both method calls
(already true today) but also avoid locking the mutex, for both CPU and contention
gains.

There will still be many methods that need locking for transactional
consistency - however, there are currently dozens of accessor methods that could
avoid frequent lock / unlock cycles with use of atomics, and other usages of the
ivars directly where locking could be delayed until after early-return conditions
are checked and passed.
2017-04-29 23:10:59 -07:00
appleguy
09ad3b79b2 [RTL] Bridge the UISemanticContentAttribute property for more convenient RTL support. (#60)
Although apps could handle this before by setting the view's property in didLoad, it's
useful to bridge this property for setting during off-main initialization.

This change also makes RTL fully functional / automatic for Yoga layout users.
2017-04-24 20:08:03 -07:00
Garrett Moon
8013e25524 Update license v2 (#67)
* Fixed license

* Update all licenses

* Update Dangerfile for new license

* Update already updated licenses

* Closer…

* Closer…

* Closer…

* Closer…

* Closer…

* Closer…

* Closer…

* Closer…

* Closer…

* Closer…

* Closer…
2017-04-24 16:59:57 -07:00
Adlai Holler
67387c0978 Build a Tips system (#19) 2017-04-19 19:51:24 -07:00
Huy Nguyen
dcf858eac1 [ASDisplayNode] Trigger a layout pass whenever a node enters preload state (#3263)
* Add a thread-safe layoutIfNeeded implementation to ASDisplayNode

* Trigger a layout pass when a display node enters preload state
- This ensures that all the subnodes have the correct size to preload their content.

* ASCollectionNode to trigger its initial data load when it enters preload state

* Minor change in _ASCollectionViewCell

* Layout sublayouts before dispatch to main for subclass hooks

* Update comments

* Don't wait until updates are committed when the collection node enters display state

* Same deal for table node

* Explain the layout trigger in ASDisplayNode
2017-04-13 16:25:17 -07:00
Christian Selig
3dd2da5b9f Fix incorrect argument label in function comment (#3261) 2017-04-13 18:38:44 +01:00
Adlai Holler
fcbbea51a6 Fix the Initialization Hierarchy (#3207)
* Fix the initializers setup

* Update Swift example

* Remove incorrect comment

* Add one to ASTableNode
2017-03-28 11:48:20 -07:00
Adlai Holler
0de270fdfb Revert "Improve designated initializer usage (#3132)"
This reverts commit eaa875c7f2e08afa8b597c653be6b7c45cfff66d.
2017-03-03 15:31:28 -08:00
Michael Schneider
eaa875c7f2 Improve designated initializer usage (#3132)
* Improve designated initializer usage

* Some more changes

* Add some whitespace

* Fix some warning
2017-03-03 14:49:34 -08:00
Michael Schneider
67baa44fb5 Fix -Wdocumentation warnings (#3113) 2017-03-01 11:25:37 -08:00
Adlai Holler
73ca6ab514 Shuffle & Cleanup Stuff (#3080) 2017-02-26 18:14:13 -08:00