* Rename ASDN C++ namespace to "AS." Referring to the framework as ASDisplayNode is pretty out-dated and verbose. See CoreAnimation which usees CA for their internal namespace.
More using
* More cases
* Introduce ASCellLayoutMode
* Some smaller improvements
* Improve logic around _superPerformBatchUpdates:completion:
* Add comment about default values for ASCellLayoutModeNone
* Always call _superReloadData:completion: within UICollectionView
* Add initial range test for ASCellLayoutModeNone
* fix SIMULATE_WEB_RESPONSE not imported #449
* Fix to make rangeMode update in right time
* remove uncessary assert
* Fix collection cell editing bug for iOS 9 & 10
* Revert "Fix collection cell editing bug for iOS 9 & 10"
This reverts commit 06e18a10596622ff8a68835c95a23986d7bf61ea.
* Only test when photo library is enabled.
It will fail to build if photo library is disabled cause the test is
depending on it.
* Add ChangeLog.
* set default tuning parameters for collection/table node
* add change log
* Move to framework private.
* Apply to tableNode
* trigger ci
* fix directory
* fix file link
* [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.
* - [ASWrapperCellNode] Introduce a new class allowing more control of UIKit passthrough cells.
A few minor fixes to Collections behavior as well, including a new isSynchronized
API. The difference from processingUpdates is that after Synchronized, all animations
have also completed (or runloop turn if animations disabled, so .collectionViewLayout
can be relied on being fully in sync).
More upstreaming to come after this can land...
* Fix -[ASDataController clearData] to take no action before initial data loading.
* Empty commit to kick CI
* Spacing change to kick CI (since an empty commit doesn't work...)
* Tweak ASDataController changes to handle an edge case in _editingTransactionQueueCount management.
* Avoid excess cyclic calls to onDidFinishProcessingUpdates: by avoiding ASMainSerialQueue.
* Reverting my initial change as it wasn't the right approach, following the real fix before this.
* [ASCollectionView] Fix index space translation of Flow Layout Delegate methods.
This includes a few other cleanups, including overflow of signed integer indices.
* [ASCollectionView] Improve code sharing of UIKit size method calls; ensure delegate invalidation re-fetches supplementary sizes too.
* [ASCollectionView] Final method ordering and doc-comment for new _sizeForUIKitCellWithKind:atIndexPath: method.
* [ASCollectionNode] Add -isProcessingUpdates and -onDidFinishProcessingUpdates: APIs.
Over time, there have actually been a lot of legitimate uses for an API like this.
In fact, I'm not quite sure what has held us back from adding one!
I believe that at least some portion of -wait calls (even if less than 50%) could be
replaced with -onDidFinishProcessingUpdates:, which could potentially improve the
performance of applications using -wait by a significant amount.
Please take a close look at implementation correctness. Although I'm in a bit of a
rush, I'm aiming to make this properly documented and added a basic test -- but it
could certainly use some more detailed testing as a followup.
* [ASCollectionNode] Improvements to the implementation of -isProcessingUpdates and -onDidFinishProcessingUpdates:
* Add lock to ASMainSerialQueue count method.
* [ASTableNode] Implement -isProcessingUpdates and -onDidFinishProcessingUpdates:. Rename -waitUntil to consistent naming.
- Add content offset bridging property to table and collection node
- And use it in `ASCollectionLayout` to avoid measuring unrelated nodes during the first layout.
- Update CHANGELOG and highlight deprecated methods
* [ASCollectionView] Add delegate bridging and index space translation for missing UICollectionViewLayout properties
This is a first attempt at resolving #438.
I know there is already one similar method to do indexPath conversions, and that the #define for
accessing properties on the UICollectionViewFlowLayout should probably be moved somewhere else.
Looking for feedback on the general direction here. In particular, I'm a bit surprised that so much
has changed in how these calls occur, as I believe especially constrainedSizeForNodeAtIndexPath: is
now called with inconsistent index path spaces (but was not before this PR landed in March:
https://github.com/facebookarchive/AsyncDisplayKit/pull/3136/files)
Since the impact of mixing the spaces is fairly serious (can cause crashes), I'm also wondering if
I am misinterpreting some aspects of the code, or if maybe the crashing impact wasn't noticed yet.
* [ASCollectionView] Cleanup and final changes for UIKit passthrough fixes.
* Implement ASCollectionGalleryLayoutDelegate
- It arranges items of the same size into a multi-line stack (say photo gallery or pager). It takes advantage of the fact that its items always have a fixed size to measure as few items as possible while still being able to track their positions at all time. This helps reduce startup/reloadData time, as well as memory footprint.
- It then uses a measure range, which also works as a allocate range, to figure out which items to measure ahead of time. And it guarantees that each item is scheduled to measure only once.
- Lastly, ASCollectionLayoutDelegate has some new methods that allow delegates to hook up and stay ahead of layout attributes requests from the backing view. ASCollectionGalleryLayoutDelegate for example uses these methods to ensure elements that have their layout attributes requested are always ready for consumption, and to measure more elements in the background.
* Handle items that span multiple pages and other improvements in gallery delegate
* Minor fixes
* Fix failing tests
* Fix custom collection example
* Implement missing method in gallery layout delegate
* Fix warnings
* Some improvements
- Collection layout delegates must have a crollable directions property.
- Simplify gallery delegate by not storing unmeasured attributes since calling measure on already measured elements should be cache hits and super fast.
- Abstact some code in gallery delegate to ASCollectionLayoutState+Private and _ASCollectionGalleryLayoutItem.
- Other improvements in gallery delegate
* Fix file licenses
* Move measure range logic to ASCollectionLayout
* Track unmeasured elements
* Remove pending layout in ASCollectionLayout
* Get back pending layout because the timing to latch new data is not ideal
* Add ASCollectionLayoutCache
* Fix file licenses
* Fix xcodeproj
* Add async collection layout to examples/ASCollectionView
* Measure method in ASCollectionLayout to be a class method
* Encourage more immutable states
- Make -calculateLayoutWithContext: to be class methods in ASDataControllerLayoutDelegate and ASCollectionLayoutDelegate.
- Add layout delegate class and layout cache to ASCollectionLayoutContext+Private, to be use by ASCollectionLayout only.
- ASDataController no longer allocates all nodes but lets ASCollectionLayout determine.
- Add scrollableDirections to the layout context since it's often needed by the layout pass. Otherwise users have to wrap it in an info object.
- Update built-in layout delegates and CustomCollectionView example.
- Publish ASHashing. It might be helpful for clients that implement custom collection info objects.
* Remove additionalInfo property in ASCollectionLayoutState
* ASCollectionLayoutState to correctly filter unmeasured elements
* Add ASHashing to umbrella header
* Fix file licenses
* Add ASDispatchAsync and use it in ASCollectionLayout
* Improve code comment in ASCollectionLayoutState
This was originally added for ASCollectionNode and ASTableNode preloading to work
as intended when nested inside of another ASRangeController-powered node. Indeed,
it is still necessary to trigger layout on these UIKit-backed components in order
for their own ASRangeControllers to start preparing content within them.
However, unlike the comment suggests, it is *not* necessary to do this for image
nodes. ASNetworkImageNode has only one .URL, and does not use the .bounds or
.calculatedLayout at all during loading. Even the ASMultiplexImageNode does not
use the .bounds, and the ASMapNode uses .calculatedLayout instead of .bounds.
This change has important performance benefits. In particular, it avoids
layouts that would occur on the main thread, often including text sizing,
and also can result in redundant layout passes (even during a layout pass that
triggers a node to enter the preload range, it may force its own layout early).
It would be great to test this change with Pinterest to confirm its safety, but
based on a full audit of the framework codebase, the only possibility that I
see for a regression is if app implementations of -didEnterPreloadState make
direct use of .bounds instead of .calculatedLayout (which is easy to fix).
* 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
* Make ASCellNode indexPath and supplementaryElementKind atomic
* Update the change log
* Fix licenses
* Be explicit with atomic
* Rename the protocol
* And the file
* 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
* 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
* Add unit test to test trait collection changes occur during updates are handles correctly
* Remove handling code in ASDataController:updateWithChangeSet. Previous test should fail
* Correctly handle trait collection changes that occur mid-updates
- Currently, when there is a new trait collection, we correctly propagate it to all visible elements. However, since the propagating block is executed on main thread immediately without waiting for the background editing queue of ASDataController, not all elements are updated.
- Then to fix that, we updated ASDataController to handle these changes inside updateWithChangeSet. This works, but it doesn’t address the underlying issue.
- We now delegate the propagating task to ASDataController which schedule a block to its main serial queue after waiting for its background editing queue.
Although we may not want to support this property long-term, there are some usages of it
that are difficult to avoid. Specifically because the complexity it adds is both low,
and contained to a small area of the code that would be easy to remove it, it would be
great to support this.
The usage relates to apps that require the Interop protocol, and are architected to expect
a few methods / protocols being implemented on the UICollectionView class itself. It does
not directly override ASCollectionView behaviors. So hypothetically, it would also work
if it were possible to set ASCollectionView's superclass.
Instead, the app is making its own subclass descend from ASCollectionView and use the interop
APIs, even in environments where there are no ASCellNodes ever returned.