* [ASTextNode2] Provide compiler flag to enable ASTextNode2 for all usages.
The runtime switch is helpful, but is too slow to be shipped in a large
production application where startup time is carefully optimized.
Although this doesn't pass text-related snapshot tests when enabled, it
does allow apps to rely on built-in components like ASButtonNode using
the same text stack as when they are manually creating ASTextNode2
instances.
A simpler approach would be to use a #define ASTextNode ASTextNode2,
but this would create unusual keyword highlighting in code referencing
ASTextNode. However, because it would be less invasive and this is
not on by default, we could do that instead if preferred.
* Update AsyncDisplayKit.h
* [ASTextNode2] Improve naming and documentation of ASTEXTNODE_EXPERIMENT_GLOBAL_ENABLE
* [ASTextNode2] CHANGELOG.md for #410.
* Implement tests for the layout flattening process
* Refactor the flattening algorithm
- Remove flattened flag
- No more self check
- Stop traversing a layout tree branch when hits a displaynode node.
- Reuse as many existing ASLayout objects as possible
* Update changelog
* Ceil position values before comparing
* Explain why sublayout elements must be retained
* Add support for skipping reload if node decides it is compatible with new view model also
* Sort things right
* Put the order back
* No need for redundant expectation
* Fix license header
* Fix comment
* Update OCMock 2.2 -> 3.4
* Clean up and port ASMultiplexImageNodeTests
* Clean up
* Be stricter about order
* Log change
* Update the licenses #important
* Update the license headers more
* [Yoga] Implement ASYogaLayoutSpec, an experimental alternative to full-tree integration.
This approach allows us to avoid any ASDisplayNode.mm integration points.
However, it is not yet proven to be possible to achieve correctness with this approach.
The entry point (to start calculating), and the measurement function inputs, lack
the full expressiveness of ASSizeRange; we need to make sure that workarounds like
using style.minSize are successful in simulating the behavior of a full Yoga tree.
* [Yoga] Fix file comments, move towards <ASLayoutElement> support.
* [Yoga] Important fix for simplified, non-contiguous Yoga integration.
* [Yoga] Complete implementation of manual memory management (__bridge_transfer, YGNodeFree)
* Add ASBatchFetchingDelegate
- In addition to checking remaining leading screens, ASBatchFetching now also calculates a remaining time and consults its delegate if needed.
- The delegate can override the decision of ASBatchFetching, for example based on remaining time and average time of past batch requests.
* Fix up tests
* Update CHANGELOG
* Add experimental text node implementation, based on YYText
* Fix warnings and alert when unimplemented experimental features are used.
* Address feedback from review
* Extend the cthulog
* Update license headers
* Implement ASPageTable
- It is a screen page table that can be used to quickly filter out objects in a certain rect without checking each and every one of them.
- ASCollectionLayoutState generates and keeps a table that maps page to layout attributes within that page.
- ASCollectionLayout (and later, ASCollectionGalleryLayoutDelegate) consults its layout state for `layoutAttributesForElementsInRect:`. This ensures the method can return as quickly as possible, especially on a large data set (I heard some people have galleries with thousands of photos!).
* Address comments
* Handle items that span multiple pages
* Make danger happy
* Make ASCellNode indexPath and supplementaryElementKind atomic
* Update the change log
* Fix licenses
* Be explicit with atomic
* Rename the protocol
* And the file
* Add _ASCollectionReusableView container for ASCollectionNode supplementary nodes with applyLayoutAttributes support
• Adds support for -[ASCellNode applyLayoutAttributes:] to supplementary nodes
* Ensure _ASCollectionReusableView has layoutAttributes if the collection view doesn’t set them
* Use correct layoutAttributes accessor for supplementary elements
* Introduce ASCollectionViewLayout
- `ASCollectionViewLayout` is an async `UICollectionViewLayout` that encapsulates its layout calculation logic into a separate thread-safe object which can be used ahead of time and/or on multiple threads.
- `ASDataController` now can prepare for a new layout resulted from a change set before `ASCollectionView` even knows about it. By the time the change set it ready to be consumed by `ASCollectionView`, its new layout is also ready.
- New `ASCollectionViewLayoutCalculating` protocol that is simple and generic enough that many types of calculators can be built on top. `ASCollectionViewLayoutSpecCalculator` conforms to `ASCollectionViewLayoutCalculating` protocol and can be backed by any layout spec (e.g `ASStackLayoutSpec`, `PIMasonryLayoutSpec`, etc). We can even build a `ASCollectionViewLayoutYogaCalculator` that uses Yoga internally.
- A built-in `ASCollectionViewFlowLayoutCalculator` that is a subclass of `ASCollectionViewLayoutSpecCalculator` and uses a multi-threaded multi-line `ASStackLayoutSpec` internally. The result is a performant and thread-safe flow layout calculator.
- Finally, `ASCollectionViewLayout` can be subclassed to handle a specific type of calculator with optimizations implemented based on the knowledge of such calculator. For example, `ASCollectionViewFlowLayout` can have a highly optimized implementation of `-layoutAttributesForElementsInRect:`.
Protocolize layout calculator providing and consuming
Add flex wrap documentation
Add a `multithreaded` flag to ASStackLayoutSpec that forces it to dispatch even if it's off main
- Update ASCollectionViewFlowLayoutSpecCalculator to use that flag.
Minor change in ASCollectionViewLayout
Implement Mosaic layout calculator
Minor change
Fix project file
Rename and fix project file
Skip fetching constrained size only if a layout calculator is available
Update examples/ASCollectionView
Remove unnecessary change in ASTableView
Address comments
Rename collection view calculator protocols
Minor changes after rebasing with master
Add ASLegacyCollectionLayoutCalculator for backward compatibility
Remove ASCollectionLayoutSpecCalculator
Remove ASLegacyCollectionLayoutCalculator
Introduce ASCollectionLayout
- A wrapper object that contains content size and an element to rect table.
- Collection layout calculators to return this new object instead of an ASLayout.
Before adding a content cache
Finishing hooking up ASCollectionLayoutDataSource to ASCollectionNode
Stash
Finish ASCollectionLayout
Rough impl of ASCollectionFlowLayout
Revert changes in CustomCollectionView example
Move ASRectTable back to Private
* Rename ASCollectionContentAttributes to ASCollectionLayoutState
* Address other comments
* Introduce ASCollectionLayoutDelegate and make ASCollectionLayout private
* Address comments
* API tweaks:
- Replace `-layoutContextWithElementMap:` in ASCollectionLayoutDelegate with `-additionalInfoForLayoutWithElements:`. The returned object is then stored in ASCollectionLayoutContext for later lookups.
- ASCollectionLayoutContext has no public initializer.
- ASDataControllerLayoutDelegate no longer requires a context of type ASCollectionLayoutContext but simply an `id`. This helps decouple ASDataController and ASCollectionLayout.
- Rename `elementMap` to `elements`.
- Rename `visibleMap` to `visibleElements`.
- Other minor changes.
* Rename ASCGSizeHash to ASHashFromCGSize
* Make sure to call super in -[ASCollectionLayout prepareLayout]
* Update example/ASCollectionView to use ASCollectionFlowLayoutDelegate
* Remove unnecessary change
* Need to check availability before use of macros.
* Get rid of PCH and enforce macro definition.
* Remove prefix
* Switch to global warning instead, much better.
* Clean up snapshot test cases:
- Drop 32bit snapshots
- Update iOS 9 snapshots and move some others to the correct directory
- Remove `setUp` overrides in subclasses of `ASLayoutSpecSnapshotTestCase` that set `recordMode` flag. Doing so in multiple places make it difficult to enable/dis
able the flag for all layout spec test cases. It can always be overridden locally if need
to.
- Fix BUCK build
* Fix testThatOnDidLoadThrowsIfCalledOnLoadedOffMain of ASDisplayNodeTests
* Build ASElementMap and use it
* Keep building!
* Clean up
* Restrict ASDataController subclassing
* Clean up more
* More rearranging
* Dear lord it's time for bed
* Make things clearer
* Sadly remove subclassing restriction for ASDataController
* Remove dead initializer
* Refactor ASDataController
Check optional methods in ASDataControllerSource
* Reimplement reloadData
* Refactor new code
- No more new/inserted contexts flag
- Encapsulate code shared between reloadData and updateWithChangeSet
- Remove dataControllerWillDeleteAllData delegate method
- Hierarchy changes no longer needs to conform to NSCopying
- Reword TODOs
* Forgot to call completion block of reloadData :P
* Completion block of -[ASDataController reloadDataWithCompletion:] is nullable
* Data queried from ASCollectionNode and ASTableNode should be in UIKit index space
- This helps to avoid immature node allocation, especially when node virtualization is a thing
- However, this means that -reloadDataInitiallyIfNeeded in ASCollectionNode and ASTableNode must wait until all updates are finished.
* ASDataController shouldn't assume that allocated nodes were also laid out
* Revert "Data queried from ASCollectionNode and ASTableNode should be in UIKit index space"
This reverts commit 7bc977b3808a92f484b297781d0f5b30aa258e17.
* -nodeAtIndexPath: of ASDataController now forces node allocation, with the assumption that clients absolutely need it.
- Revisit this when node virtualization is implemented.
* ASDataController only grab changeSet.completionHandler when needed because it'll be niled out
* Fix ASTableViewTests related to reloadData
* Fix testThatDeletedItemsAreMarkedInvisible in ASCollectionViewTests
* Minor changes in ASCollectionView and ASTableView
* ASCollectionView and ASTableView shouldn't call [super reloadData] before their data controller does anything
* Address comments
* Fuse reloadData into -updateWithChangeSet: of ASDataController
* reloadData shouldn't be called as if it's inside a batch
- It can't be used in conjuntion with other updates.
- Calling it inside a batch update during the initial load can cause data inconsistency thrown by UICollectionView/UITableView
* Refactor ASDataControllerDelegate and ASRangeControllerDelegate
- Replace delegate methods in these protocols with -willUpdateWithChangeSet and -didUpdateWithChangeSet.
- ASRangeController, ASCollectionView and ASTableView are simplified because of this.
* Fix mismatch between sorting orders in ASDataController
* Forgot to call completion handler of reload change sets
* Make sure ASCollectionView is compatible with the behavior of UICollectionView's reloadData
- Since UICollectionView's reloadData doesn't requery data source but defers until the next layout pass, we need to wait until then to update range controller and do batch fetching.
- `-[ASCollectionView waitUntilAllUpdatesAreCommited]` needs to force a layout pass to make sure
everything is ready after it returns.
* testSectionIndexHandling of ASTableViewTests should only check visible nodes. Other nodes will be re-measured later.
* ASTableView is not ready until the first layout pass finished
* Address comments
* Bug fixes
* Fix pager node and deprecate zeroContentInsets flag
* Do it with the visible state callback
* There we are
* Put viewController in node debug description
* [Yoga + AsyncDisplayKit] Initial commit for supporting Yoga-powered layout calculation.
Because this results in ASLayout objects, it preserve support for automaticallyManagesSubnodes
as well as the animated transition system. More work remains to vet performance of the new mode,
and it will remain in +Beta for the forseeable future.
I'm not sure that this should ever be used as the primary ASDK layout system, but it should remain an
option for some apps to experiment with if they require an implementation that more strictly mirrors
W3C standard Flexbox.
* [Yoga] Improve usage of ASHierarchyState to ensure simultaneous yoga layouts can't happen.
* [Yoga] Strictly minimize the impact of the Yoga integration on existing code.
Created new file ASDisplayNode+Yoga.mm, reduced size and number of integration points in core code.
* [Yoga] Figured out how to further reduce ASDisplayNode.mm impact by allocating _yogaNode in property accessor, and changing all accesses to use the property.
This also supports supplementary nodes. It builds off of Adlai's .interop flag but makes necessary
improvements for all of the delegate methods to work in practice with heterogenous cell types.