316 Commits

Author SHA1 Message Date
aaronschubert0
b3be451486 [ASTableNode/ASCollectionNode] Inversion (#2891)
* Add inverted property to ASTableNode

* Add inverted property to ASCollectionNode

* Add example

* De-inform data controller and use different CATransform3D

* Add logic to pending state

* Add accessor for inverted property
2017-01-19 18:16:01 -08:00
Adlai Holler
e69a475d2b Minor Collection Simplifications (#2906)
* Minor collection simplifications

* Remove didChangeCollectionViewDataSource call, restrict subclassing ASCollectionViewFlowLayoutInspector
2017-01-19 13:57:03 -08:00
Adlai Holler
98a95a6907 Pin collection cellNode.frame = contentView.bounds (#2884) 2017-01-11 12:47:12 -08:00
Saif Al-Dilaimi
c85aa11dbb Adding section to passthrough properties (#2847)
* added accessoryType to ASCellNode

* Moved the passthrough properties in an own section in ASEditableTextNode

* added documentation and reverted ASEditableCellNode changes

* fixed code signing

* adding seperatorInset property as a passthrough property

* revert changes to project file

* moved setting properties to setNode:

* moved clipsToBounds to setNode
2017-01-09 18:26:51 -08:00
Adlai Holler
d65fe8b5fa Disable UICollectionView prefetching to improve scroll performance (#2861) 2017-01-04 13:30:23 -08:00
Adlai Holler
4a6ba2761b ASDataController: Correctly Handle Nil IndexPath in nodeForIndexPath: Methods (#2856)
* ASDataController: Correctly handle fetching node at nil index path (return nil).

* Be more aggressive, in order to avoid needlessly waiting for updates to complete
2017-01-03 14:45:16 -08:00
Adlai Holler
2ea7d4c1c0 By default, capture the current animation enabledness for collection/table updates (#2827) 2016-12-23 09:46:49 -05:00
Michael Schneider
57cd6a3ba8 [ASPagerNode] Fix content insets are wrong in pager node if root node of ASViewController and transition back (#2736)
* Fix content insets are wrong in pager node if root node of ASViewController and transition back

* Add unit test

* Improve test

* Fix test

* Move tests to ASPagerNodeTests
2016-12-12 16:05:09 -08:00
Adlai Holler
7de2decdcb Allow section-indexpaths in collection & table validation (#2727) 2016-12-07 13:36:15 -08:00
Adlai Holler
45c69ada36 Add some index path validation to avoid production crashes (#2716) 2016-12-05 16:37:44 -08:00
Adlai Holler
9bc58dc024 When not visible, only batch fetch to fill visible area 2016-12-05 15:00:39 -08:00
Adlai Holler
051b738236 Inject data source class name into update validation exceptions, deprecate suppression flag (#2692) 2016-12-01 17:30:36 -08:00
Garrett Moon
ba2268ac99 2611 rename fetch data (#2689)
* Replace fetch data with preload terminology
- Deprecate `-fetchData` and `-clearFetchedData` in favor of `-preload` and `-clearPreloadedData`
- Move `-setNeedsPreload`, `-recursivelyPreload` and `-recursivelyClearPreloadedData` to ASDisplayNode+FrameworkPrivate.h
- Update internal implementation, comments and tests

* Folllow up on #2642:
- Remove -preload and -clearPreloadedData in favor of -didEnterPreloadState and -didExitPreloadState.
- -didEnterPreloadState and -didExitPreloadState call the deprecated -fetchData and -clearFetchedData methods if they are overriden.

* Missed one in a test

* Get rid of behavior change for now.

* Revert more behavior changes, fix tests.

* Don't need these anymore.
2016-12-01 13:41:22 -08:00
Adlai Holler
df497b82c2 Improve Batch Fetching Call Pattern to Reduce Fetch Calls (#2675)
* Test & tweak batch fetching implementation

* Tighten the test

* Stop batch fetching at the end of range controller pass

* Clean up the test

* Still check for batch fetching after each frame when scrolling

* Ensure batch fetching happens for empty collection/table
2016-11-29 13:40:03 -08:00
Adlai Holler
6d01bbeb19 Let nodes deallocate naturally, manually trampoline UIKit ivars
Be more aggressive with main thread punting

Trampoline setting the dataSource/delegate onto the main thread

Short-circuit the supplementary nodes method if no data source

Don't rely on assertions

Mark variable unused to fix release builds

Handle ASCollectionNode/ASTableNode deallocation better

Add some comments about new macro
2016-11-21 00:46:57 +09:00
Garrett Moon
2284914c36 If you override the property, you need to specify __weak (#2631) 2016-11-19 07:42:44 +09:00
Hannah Trosi
6565b8348d collectionView 2016-11-17 16:46:07 +09:00
Michael Schneider
44aa582ceb Fix crash if batch update blocks are nil although method declaration allows nullable (#2599) 2016-11-14 10:15:11 +09:00
Hannah Troisi
edf2b669ae [ASCollectionViewLayoutInspecting] make -scrollableDirections required (#2543)
* [ASCollectionViewLayoutInspecting] make -scrollableDirections a required method

* doh!

* fixed?

* add assert per @appleguy's comment

* use self.layoutInspector, add check at the start of didChangeBounds...
2016-11-09 13:48:16 +09:00
Huy Nguyen
fb6d1830a0 Beter table/collection update history (#2562)
- Introduce thread-safe ASEventLog
- ASCollectionNode and ASTableNode share their event log with their ASDataController. The controller uses it to log change set submitting and finishing events.
- ASCollectionNode and ASTableNode print their data source and delegate in their debug description.
2016-11-08 16:44:49 -08:00
Adlai Holler
a6e2f8e5ab Finish Porting indexPath-Oriented Methods to ASTableNode/ASCollectionNode (#2527)
* Finish porting over the indexPath-oriented properties from table/collection view to node

* Make indexPathForSelectedRow a property
2016-11-01 15:03:46 -07:00
george-gw
d83f058f82 Deprecate indexPath-based Methods on ASTableView/ASCollectionView (#2498)
* Deprecated indexPath methods in ASTableView and ASTableNode and added several indexPath methods to ASTableNode and ASCollectionNode.

* Fixed incorrect doc.
Removed unnecessary __kindof.
2016-10-29 09:50:11 -07:00
Adlai Holler
627d146a5a Add scrollToItem: Method to Node, Handle Section Index Paths (#2462)
* Add scrollToItem: method to node, handle section index paths

* Update ASPagerNode.mm to use the node version

* Add some docs
2016-10-26 12:48:25 -07:00
Garrett Moon
5651606684 [ASCollectionView] layoutInspector can be nil'd at anytime making flags unsafe (#2473)
* Call layoutInspector before checking flags. Thanks @adlai!

* Don't create layout inspector with nil layout.
2016-10-26 11:42:29 -07:00
Adlai Holler
12534ee6fb Handle nil in selectItem/RowAtIndexPath: (#2477) 2016-10-24 20:11:47 -07:00
Adlai Holler
67489492ee Fix Uncalled Collection Delegate Methods (#2433)
* Fix batch fetching

* Fix not calling constrainedSizeForItemAtIndexPath:

* Fix constrainedSizeForItemAtIndexPath: not being called
2016-10-19 11:49:49 -07:00
Michael Schneider
ae9e128214 Layout inspector instance variable should be weak in ASCollectionView (#2405) 2016-10-17 10:51:54 -07:00
Adlai Holler
c2ea7cfeac [Umbrella] ASCollectionView -> ASCollectionNode Migration, Separate Index Spaces (#2372)
* Separate dataSource & UIKit index spaces

Beef up our supplementary node support

Make the API way better

Go nuts

Add a unit test for UICollectionView's handling of reloadData inside batch updates

Wrap indexPathForNode: in a cache

Convert index paths in delegate methods

Go back on table view

Put collection view back

Switch up the API

Move most ASCollectionView API to ASCollectionNode

Move most table logic over to ASTableNode

Do the things

More conversion work

Keep on keepin' on

Get table view delegate API done

More porting

Simplify

Clear the delegate

More cleanup

Move more stuff around

Remove pointless file

Re-add some API

Put back more API

Use the right flag

* Some cleanup

* Remove incorrect comment

* Tweak the API

* Put back a couple methods

* update example projects (note: ASCollectionView deprecation warnings expected)

* change reloadDataWithCompletion:nil --> reloadData

* Clean up rebase

* Make deprecated numberOfItemsInSection methods optional

* Use the right flag

* Address nits

* update ASDKTube, ASDKgram & ASViewController examples
2016-10-14 17:21:16 -07:00
Garrett Moon
1d28639301 [ASCollectionNode] Add scrollableDirections method to ASCollectionViewLayoutInspecting p… (#2381)
* Add scrollableDirections method to ASCollectionViewLayoutInspecting protocol

ASViewController's default method will not always return the correct scrollable
directions in cases where size changes may not have been applied. This allows
us to ignore this issue for a little while longer by allowing the layout
inspector to explicitly vend this.

* Better header, thanks @maicki!
2016-10-14 09:39:28 -07:00
Adlai Holler
60b40d8e1c Revert "Scrollable direction is invalid until a relayout. (#2375)" (#2377)
This reverts commit 9abae013a7c2510ead0ea7bf7cffdba54d7f9e08.
2016-10-13 11:24:57 -07:00
Garrett Moon
9abae013a7 Scrollable direction is invalid until a relayout. (#2375) 2016-10-13 10:51:23 -07:00
Adlai Holler
aece8365dd Adjust layoutAttributes logic to account for new iOS 10 behavior (#2354) 2016-10-06 19:42:36 -07:00
Adlai Holler
bb366d14f0 [ASCellNode] Restore Layout Attributes Fix + iOS 10 Modification (#2335)
* [ASCellNode] Fix applyLayoutAttributes not called, add readonly layoutAttributes property (#2321)

* Clear cell node layout attributes in didEndDisplayingCell: also
2016-10-05 17:31:46 -04:00
Adlai Holler
ba2e12010b [ASCollectionView] Only remeasure all nodes if bounds changed in a fixed dimension (#2343) 2016-10-04 18:12:34 -04:00
Adlai Holler
67045c07b8 Handle nil node blocks gracefully in production (#2338) 2016-10-03 20:06:13 -04:00
Garrett Moon
5205ef6840 [API] Remove old deprecated methods. (#2312)
* Remove old deprecated methods. Will restore ones that were removed recently based on PR.

* Update example to use non-deprecated method.

* Don't remove locking / unlocking, insets or willDisplayNode deprecated methods yet.
2016-10-03 14:57:01 -04:00
Scott Goodson
a25f4a7b85 Revert "[ASCellNode] Fix applyLayoutAttributes not called, add readonly layoutAttributes property (#2321)"
This reverts commit f9ee1dd4b6b4d8a062c5453623bc6fde1840cd91.

This appears to have caused a test failure:
https://travis-ci.org/facebook/AsyncDisplayKit/jobs/164532435
2016-10-02 19:36:06 -07:00
Huy Nguyen
066351bad7 Introduce ASSectionContext and ASSection (#2178)
- Objects conform to ASSectionContext protocol can be provided via ASCollectionDataSource and later retrieved from the collection view. They are guaranteed to be in sync with sections of the collection view. They can be used to store additional data associated with each section, to be used in collection view layout and the like.
- ASSection is an internal object that is the foundation for coming debugging tools.
- Unit tests included.
2016-10-01 14:04:05 -04:00
Adlai Holler
f9ee1dd4b6 [ASCellNode] Fix applyLayoutAttributes not called, add readonly layoutAttributes property (#2321) 2016-09-29 16:41:28 -04:00
Adlai Holler
4326fc90bf Pass the cell node through in willDisplay: table/collection callbacks (#2282) 2016-09-23 19:50:53 -04:00
Michael Schneider
9f1a387ba0 [ASTableView / ASCollectionView] Improve assertion messages if necessary data source methods are not implemented (#2269)
* Improve assertion message if tableView:nodeBlockForRowAtIndexPath: or tableView:nodeForRowAtIndexPath: is not implemented

* Improve assertion message if collectionView:nodeForItemAtIndexPath: or collectionView:nodeBlockForItemAtIndexPath: is not implemented
2016-09-22 13:35:04 -07:00
Adlai Holler
b21742c3c9 [ASCollectionView] Relayout Nodes as Soon as Bounds Changes (#2121)
* Add failing test case for ASCollectionView rotation

* [ASCollectionView] Relayout nodes immediately on bounds change
2016-08-23 14:33:45 -07:00
Adlai Holler
0bd664f9ed Remove numberOfSectionsForSupplementaryNodeOfKind: Method (#2102)
* Add unit test to confirm that supplementary items must be contained within actual sections

* [ASLayoutInspecting] Deprecate collectionView:numberOfSectionsForSupplementaryNodeOfKind:

* Add another test to dig deeper into UICollectionView
2016-08-19 11:18:31 -07:00
Michael Schneider
11215bf97f [Automatic Hierarchy Management] Rename IHM to automatic hierarchy management and move out of beta header (#2066)
* Rename automaticHierarchy to automaticallyManagesSubnodes

* Comment adjustments
2016-08-15 12:06:06 -07:00
Michael Schneider
93be894e0c [ASCollectionView / ASPagerNode] Move constrainedSizeForNodeAtIndexPath from the DataSource to the Delegate (#2065)
* Move constrainedSizeForNodeAtIndexPath from the DataSource to the Delegate in ASCollectionView and ASPagerNode

* Fix ASPagerNode declaration of dataSource and delegate

As ASPagerDataSource does not inherit from ASCollectionDataSource it's not possible to declare it as property.

* Update comment
2016-08-12 15:37:23 -07:00
Hannah Troisi
2afd063b10 [ASRangeController] Debug overlay to show the size and direction of display + fetchData ranges during scrolling. (#2008)
* Rebase ASRangeController diff with master.

* fix Table / CollectionNode debug label names
- now returns class names rather than generic ASTableNode, ASPagerNode
- ASPagerNode will be labeled as ASPagerNodeProxy (not sure how to get around this)

* refactor layout code: use ASDk's own resizeableRoundedCorner... methods

* Fixes and cleanup for manual layout version of range controller debug overlay.

I am working on a layout spec-based version, but it has some issues, so landing this to get the near-term value is probably the best next step.

* Remove .orig and .rej files.

* One last .orig file to remove.

* Final project file cleanup and tweaks to implementation for ASTableNode.

* fix build issues

* fix arrow directions
2016-08-11 11:23:07 -07:00
Adlai Holler
1fbf8ad073 [ASDataController] Cancel if we lose our data source, fix bugs (#1987)
[ASRangeController] We're already on main thread, remove blocks

Make data source read-only, clarify what's asynchronous

[ASDataController] Clean up some interfaces

[ASDataController] A little more cleanup

[ASDataController] Cleanup

[ASDataController] Restore some changes, exit more often

[ASDataController] Use item counts that we already have rather than requerying them

[ASDataController] Revert weakifications

[ASDataController] Add a mechanism to measure how much work we avoided
2016-08-05 15:39:33 -07:00
Adlai Holler
4725035f21 [ASTableView/ASCollectionView] Flush pending updates before selecting/scrolling to item (#2034) 2016-08-04 13:19:14 -07:00
Hannah Troisi
f5b3a282af Fix Pinterest Xcode 7.3.1 Analyzer Warnings (#1988) 2016-07-27 08:23:16 -07:00
Adlai Holler
7ec6f07953 [General] Remove dead code, check optional protocol selector before calling (#1970) 2016-07-22 13:09:28 -07:00