58 Commits

Author SHA1 Message Date
Garrett Moon
645aa6f24b [ASDisplayNode] Renamed range update callbacks (#2130)
* Renamed range update callbacks

We finally settled on

didEnter/ExitDisplayState
didEnter/ExitPreloadState
didEnter/ExitVisibleState

This change is meant to unify the range update methods to relate to each
other and hopefully be a bit more self explanatory.

* Guarantee interface callbacks happen on main.

* move fetchData / clearFetchedData to default implementations

* Move deprecated methods to new deprecated category

* Don't bring in cocoapod change.

* Nits

* Capetalize
2016-08-26 20:18:38 -07:00
ricky
8c3025bb12 [ASDisplayNode] added asyncTraitCollectionDidChange method (#1831)
Subclasses can override this method to react to a trait collection change
2016-06-30 19:45:29 -07:00
Hannah Troisi
c857e809f4 Clean up header comments (for consistent Facebook licensing info) (#1741)
[Licensing] Clean up header comments (for consistent Facebook licensing info)
2016-06-11 23:31:39 -07:00
Luke Parham
fc5467b110 fixed typo and added backwards compatibility for 'visibilityDidChange' 2016-06-06 02:02:23 -05:00
Luke Parham
e510120031 changed '-visibilityDidChange:' to '-visiblieStateDidChange:' to match the others 2016-06-06 00:56:21 -05:00
Luke Parham
d47059dffe updated load and display did change methods 2016-06-06 00:56:21 -05:00
Luke Parham
4b2aa1fc59 added comments to header and cleaned up interface state did change 2016-06-06 00:56:21 -05:00
Luke Parham
449a2cc517 added callbacks for entering and exiting fetch data and display ranges 2016-06-06 00:56:21 -05:00
Michael Schneider
f3c48805e0 Add better comments for layoutSpecBlock 2016-04-22 11:08:13 -07:00
Michael Schneider
87a37a283e Add a block API to provide an ASLayoutSpec without having to subclass ASDisplayNode 2016-04-20 19:16:54 -07:00
Hannah Troisi
c981aeb09d [ASMapNode] snapshot can be triggered before layout and cause exception (e.g. setAnnotations) 2016-04-14 23:05:35 -07:00
Michael Schneider
b7a92b2947 Add documentation for visibilityDidChange: 2016-03-15 16:30:49 -07:00
Michael Schneider
863b0ca956 Remove the lock for accessing _pendingDisplayNodes and force methods regarding display to the main thread
This should fix a deadlock in ASDisplayNode and it's caused by displayWillStart: and where one thread is recursing down the tree and another thread is recursing up the tree. We remove the lock in _pendingDisplayNodes for the property, but need to guarantee that we only modify the _pendingDisplayNodes state on the main thread.

Furthermore add documentation on what thread displayWillStart and displayDidFinish will be called
2016-03-15 16:30:08 -07:00
Scott Goodson
e3dde87bfd [ASDisplayNode] Add REQUIRES_SUPER to a few ASDisplayNode+Subclasses.h methods that do require it. 2016-03-10 20:55:01 -08:00
Ethan Nagel
26dcad5218 Add a warning if [super layout] is not called (which causes big problems for ASLayout.) 2016-02-24 10:28:22 -08:00
Scott Goodson
2713bdd72e [ASTextNode, ASDisplayNode] Create -calculatedLayoutDidChange and use it in text node.
This allows the change in size for the NSTextContainer to occur off the main thread, whenever that size change
is necessary.  Then the text relayout can occur earlier, during the process of computing ASLayoutSpecs.
2016-01-24 17:14:14 -08:00
Scott Goodson
882d4b336e Merge branch 'master' into pr/664 2015-12-25 14:32:41 -08:00
Scott Goodson
065625f246 Make ASCollectionView always create an ASCollectionNode. Add visibilityDidChange:, interfaceStateDidChange:fromState: 2015-12-22 21:46:46 -08:00
Adlai Holler
7079a9cc79 Merge branch 'master' into update-objc
Conflicts:
	AsyncDisplayKit/ASDisplayNode+Subclasses.h
2015-12-13 10:05:03 -08:00
Adlai Holler
b16a9e294e Merge branch 'master' into update-objc
Conflicts:
	AsyncDisplayKit/ASDisplayNode+Subclasses.h
2015-12-06 12:25:13 -08:00
Scott Goodson
840884272d Introduced ASHierarchyState. Created ASDisplayNode+FrameworkPrivate.h. Fixed deadlock. 2015-12-05 22:20:16 -08:00
Adlai Holler
9579420cd7 Add static constant ASInterfaceStateInHierarchy which we'll return if the node is not in a cell but its view is in a window 2015-12-04 12:47:36 -08:00
Adlai Holler
ab326fc683 touchesCancelled:withEvent: has a nullable touches argument in UIKit for some reason 2015-11-13 12:17:17 -08:00
Adlai Holler
7922895b60 (Re?)add type annotations on touchesBegan:withEvent: et al 2015-11-13 12:11:24 -08:00
Adlai Holler
8bb9d173dc Merge branch 'master' into update-objc
Conflicts:
	AsyncDisplayKit/ASDisplayNode+Subclasses.h
	AsyncDisplayKit/ASMultiplexImageNode.h
	AsyncDisplayKit/ASViewController.h
	AsyncDisplayKit/Details/ASDataController.h
2015-10-05 13:24:16 -07:00
Scott Goodson
61bb4f022e Improved messages for thread affinity and frame transform identity assertions. 2015-10-04 11:15:57 -07:00
Scott Goodson
a58844379c Implementation of Synchronous Concurrency features for AsyncDisplayKit 2.0
This provides internal features on _ASAsyncTransaction and ASDisplayNode to facilitate
implementing public API that allows clients to choose if they would prefer to block
on the completion of unfinished rendering, rather than allow a placeholder state to
become visible.

The internal features are:
-[_ASAsyncTransaction waitUntilComplete]
-[ASDisplayNode recursivelyEnsureDisplay]

Also provided are two such implementations:
-[ASCellNode setNeverShowPlaceholders:], which integrates with both Tables and Collections
-[ASViewController setNeverShowPlaceholders:], which should work with Nav and Tab controllers.

Lastly, on ASDisplayNode, a new property .shouldBypassEnsureDisplay allows individual node types
to exempt themselves from blocking the main thread on their display.

By implementing the feature at the ASCellNode level rather than ASTableView & ASCollectionView,
developers can retain fine-grained control on display characteristics.  For example, certain
cell types may be appropriate to display to the user with placeholders, whereas others may not.

Follow-up work will include unit tests, revisiting names, and the header locations of definitions.
2015-09-27 19:14:36 -07:00
Adlai Holler
441a0e6928 Update types for drawParameters 2015-09-20 22:32:04 -07:00
Adlai Holler
e4dc823c0d hitTest:withEvent: return value should be nullable 2015-09-16 16:21:07 -07:00
Adlai Holler
814f72535c Add nullability annotations for public API 2015-09-16 15:21:35 -07:00
Huy Nguyen
75983ca3e5 Merge branch 'master' into clean_up_layout_spec 2015-07-12 08:17:36 +07:00
Huy Nguyen
e1fd58268c Clean up #468:
- -layoutSpecThatFits: must return an ASLayoutSpec.
- Move ASDisplayNode's -measureWithSizeRange: redeclaration to ASDisplayNode.h.
- Rename ASStackLayoutChild.h to ASStackLayoutDefines.h.
- Rename ASStaticLayoutSpecDimension.h to ASRelativeSize.h.
- Don't import ASLayout.h in other headers to prevent circular inclusions.
- Explain use cases of ASLayout's initializers.
- Clean up ASInternalHelpers.h.
2015-07-10 19:41:17 +07:00
Huy Nguyen
cfac6c992a [appledoc] Fix appledoc warnings. (#553) 2015-07-10 19:02:04 +07:00
Huy Nguyen
51f1ed819f - ASDisplayNode now caches calculated layout requested by layout specs.
- constrainedSizeForCalculatedLayout is of type ASSizeRange.
- calculatedLayout is better explained.
- Since ASLayout is cached and reused, its position property is mutable.
2015-07-06 22:08:01 +07:00
Huy Nguyen
dd29a890df Still support -calculateLayoutThatFits: (and manual layout), for backward compatibility. 2015-06-28 20:31:32 +07:00
Huy Nguyen
f588bceb4d Introduce ASLayoutable and eliminate ASCompositeNode:
- Both ASDisplayNode and ASLayoutNode conforms to this protocol.
- ASDisplayNode can be embeded directly into layout graph.
- Eliminate ASCompositeNode.
- Fix ASStaticSizeDisplayNode not recpect min constrained size.
- Updated tests.
2015-06-26 09:29:16 +07:00
Huy Nguyen
abe98d5b09 Integrate new layout nodes to the framework.
- Introduce ASLayoutNode and its subclasses.
- ASDisplayNode measures its ASLayoutNode and cache the result (ASLayout). Calculated size and position of each subnode can be retrieved from the calculated layout.
- Custom nodes need to override -layoutNodeThatFits:(CGSize) instead of -calculateSizeThatFits:(CGSize).
- Custom nodes do not need to layout its subnodes (in -layout:) anymore. ASDisplayNode can handle the job most of the time, by walking through its layout tree.
- ASCompositeNode is used to embed (display) subnodes to a node's layout. That way, each subnode will also be measured while the parent node is measuring. And the parent node knows where its subnodes are within its layout.
2015-06-25 11:34:35 +07:00
appleguy
b9597ff96b Merge pull request #461 from facebook/memoryMethods
Updating API names for network range and memory culling before ASDK 1.2 tag.
2015-05-21 22:44:44 -10:00
Scott Goodson
e3f0e66cb3 Updating API names for network range and memory culling before ASDK 1.2 tag. 2015-05-21 22:43:38 -10:00
Ian Cloutier
8699ab8ed7 Fix handling of pending nodes and placeholder layer 2015-03-30 18:59:40 -04:00
Ryan Nystrom
599bf42675 Revisions based on feedback 2015-02-26 15:41:32 -08:00
Ryan Nystrom
4fa03a01d1 Functioning Preload range
Refactor how we do ranges so they can be arbitrarily managed. Introduce the concept of a preload range.
2015-02-26 15:41:32 -08:00
Ryan Nystrom
d27c8859c7 Node placeholder API
ASDisplayNodes now have an overidable method -placeholderImage that lets you provide a custom UIImage to display while a node is displaying asyncronously. The default implementation of this method returns nil and thus does nothing. A provided example project also demonstrates using the placeholder API.
2014-12-15 17:23:52 -08:00
Nadine Salter
79e65342b1 Working-range-driven image loading.
Add a `usleep(1.0 * USEC_PER_SEC)` delay to ASBasicImageDownloader and
slowly scroll through the Kittens sample project.  Without this patch,
you'll see that images only start downloading after their purple
placeholders appear onscreen.  With it, images can download and render
before you scroll them onscreen, thanks to the working range.
2014-12-02 19:23:23 -08:00
Nadine Salter
51f3073c33 ASDisplayNode.inWindow -> .inHierarchy.
This is a remnant from before `willAppear` and `didDisappear` were
renamed to better reflect their hierarchy-change status (being added to
the hierarchy != being visible).  May be useful for turians.
2014-12-02 18:06:11 -08:00
Nadine Salter
77412a2612 [appledoc] Fix hierarchy / memory docblocks. 2014-10-20 13:27:59 -07:00
Nadine Salter
47d70d39cd Add REQUIRES_SUPER annotations.
Closes #51.
2014-10-20 13:23:23 -07:00
Nadine Salter
9225309c9a [appledoc] Fix all appledoc warnings. (#65) 2014-10-17 15:41:25 -07:00
Nadine Salter
673c24946b [appledoc] Include subclassing header.
Use `--no-merge-categories` to prevent subclassing-only documentation
from appearing in the general API reference.  Use consistent category
names.
2014-10-17 14:50:27 -07:00
Leo Lou
ccbbdba53e Fix documentation typos 2014-10-16 15:38:08 +08:00