456 Commits

Author SHA1 Message Date
Adlai Holler
9c82ae9284 Add ASRectTable (#3077) 2017-02-24 16:38:17 -08:00
Adlai Holler
1775bf29f5 ASDataController: Adopt ASElementMap (#3073)
* 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
2017-02-24 13:23:29 -08:00
Adlai Holler
86dd918143 Promote ASIndexedNodeContext -> ASCollectionElement (#3061)
* Remove indexPath field from ASIndexedNodeContext

* Rename ASIndexedNodeContext -> ASCollectionItem

* Name it ASCollectionElement
2017-02-22 16:55:02 -08:00
Huy Nguyen
74c6cca0b6 [ASDataController] Refactor ASDataController (#3017)
* 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
2017-02-22 13:50:07 -08:00
Adlai Holler
fab98b32ef Fix Pager Node Issues (#3028)
* Fix pager node and deprecate zeroContentInsets flag

* Do it with the visible state callback

* There we are

* Put viewController in node debug description
2017-02-14 14:10:51 -08:00
Adlai Holler
bbc1aecf95 Deprecate shouldRasterizeDescendants (#3024)
* Deprecate shouldRasterizeDescendants

* Set superclass right
2017-02-13 13:34:53 -08:00
Peter
6b0454ccf5 Merge commit 'ec59c3161adb37d4b5b908019250dddce1c27d84'
# Conflicts:
#	AsyncDisplayKit/Debug/ASLayoutElementInspectorCell.h
#	AsyncDisplayKit/Debug/ASLayoutElementInspectorCell.m
#	AsyncDisplayKit/Debug/ASLayoutElementInspectorNode.m
#	AsyncDisplayKit/Details/ASFlowLayoutController.h
#	AsyncDisplayKit/Details/ASFlowLayoutController.mm
2017-02-11 17:00:16 +03:00
Michael Schneider
2dca7a0c8d [Debug] Remove not used code around visualizing layout specs (#2991)
* Remove not used code around visualizing layout specs

* This is sad to see but let’s remove the LayoutSpecPlayground for now
2017-02-10 13:09:09 -08:00
appleguy
f91265757e [Yoga] Initial commit for supporting Yoga-powered layout calculation. (#2982)
* [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.
2017-02-09 16:10:29 -08:00
Michael Schneider
f21254593d [Layout] Add extensibility support to ASLayoutElementStyle (#2975)
* Add extensibility support to ASLayoutElementStyle

* Fix some typo
2017-02-07 10:34:09 -08:00
Adlai Holler
86b669dc38 Improve TableLayoutController: Simplify, Fix Crash & Improve Perf (#2969)
* Refactor FlowLayoutController -> TableLayoutController

* Use most conservative row index path
2017-02-05 18:24:15 -08:00
Scott Goodson
f71eba77af [ASCollectionView] Finish support for interoperability with base-class UICollectionViewCells.
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.
2017-02-04 20:40:44 -08:00
Scott Goodson
1e10550951 [Build] Configure Xcode project to reference Precompiled Header. The .podspec changes aren't enough by themselves. 2017-02-04 16:46:37 -08:00
Michael Schneider
12e4e5b048 [Layout] Improve Layout System Abstraction (#2941)
* Improve Layout Abstraction

* Address naming comments

- Rename ASPrimitiveTraitEnvironment to ASTraitEnvironment
- Rename ASPrimitiveTraitCollectionPropagateDown to ASTraitCollectionPropagateDown
- Rename progagateNewPrimitiveTraitCollection: to propagateNewTraitCollection:
2017-02-03 13:04:20 -08:00
Michael Schneider
d42dcfefc1 [ASNodeController] Move ASNodeController to beta header (#2966)
* Move ASNodeController to beta header

* Make it public

* Change ASNodeController+Beta to .mm
2017-02-02 12:51:33 -08:00
Peter
e7b34f5811 Merge commit '404795dc02aa57b167223bfaee7c380907022ca1'
# Conflicts:
#	AsyncDisplayKit.xcodeproj/project.pbxproj
#	AsyncDisplayKit/ASCellNode+Internal.h
#	AsyncDisplayKit/ASCellNode.mm
#	AsyncDisplayKit/ASCollectionNode+Beta.h
#	AsyncDisplayKit/ASCollectionNode.mm
#	AsyncDisplayKit/ASCollectionView.mm
#	AsyncDisplayKit/ASCollectionViewProtocols.h
#	AsyncDisplayKit/ASDisplayNode.mm
#	AsyncDisplayKit/ASMultiplexImageNode.h
#	AsyncDisplayKit/ASMultiplexImageNode.mm
#	AsyncDisplayKit/ASNavigationController.m
#	AsyncDisplayKit/ASNetworkImageNode.mm
#	AsyncDisplayKit/ASPagerFlowLayout.m
#	AsyncDisplayKit/ASPagerNode.m
#	AsyncDisplayKit/ASTabBarController.m
#	AsyncDisplayKit/ASTableNode.h
#	AsyncDisplayKit/ASTableNode.mm
#	AsyncDisplayKit/ASTableView.mm
#	AsyncDisplayKit/ASTableViewProtocols.h
#	AsyncDisplayKit/ASVideoNode.h
#	AsyncDisplayKit/ASVideoNode.mm
#	AsyncDisplayKit/ASVideoPlayerNode.mm
#	AsyncDisplayKit/ASViewController.mm
#	AsyncDisplayKit/Debug/ASLayoutElementInspectorCell.m
#	AsyncDisplayKit/Debug/ASLayoutElementInspectorNode.m
#	AsyncDisplayKit/Details/ASBasicImageDownloader.mm
#	AsyncDisplayKit/Details/ASBatchContext.mm
#	AsyncDisplayKit/Details/ASChangeSetDataController.h
#	AsyncDisplayKit/Details/ASChangeSetDataController.mm
#	AsyncDisplayKit/Details/ASCollectionDataController.mm
#	AsyncDisplayKit/Details/ASCollectionViewLayoutController.mm
#	AsyncDisplayKit/Details/ASCollectionViewLayoutInspector.m
#	AsyncDisplayKit/Details/ASDataController.mm
#	AsyncDisplayKit/Details/ASFlowLayoutController.h
#	AsyncDisplayKit/Details/ASFlowLayoutController.mm
#	AsyncDisplayKit/Details/ASIndexedNodeContext.mm
#	AsyncDisplayKit/Details/ASPhotosFrameworkImageRequest.h
#	AsyncDisplayKit/Details/ASPhotosFrameworkImageRequest.m
#	AsyncDisplayKit/Details/ASRangeController.mm
#	AsyncDisplayKit/Details/ASRangeControllerUpdateRangeProtocol+Beta.h
#	AsyncDisplayKit/Details/ASSectionContext.h
#	AsyncDisplayKit/Private/ASBatchFetching.m
#	AsyncDisplayKit/Private/ASCollectionView+Undeprecated.h
#	AsyncDisplayKit/Private/ASCollectionViewFlowLayoutInspector.h
#	AsyncDisplayKit/Private/ASCollectionViewFlowLayoutInspector.m
#	AsyncDisplayKit/Private/ASDisplayNode+UIViewBridge.mm
#	AsyncDisplayKit/Private/_ASPendingState.mm
#	examples/SocialAppLayout-Inverted/Sample.xcodeproj/xcshareddata/xcschemes/Sample.xcscheme
2017-02-02 11:46:47 +03:00
Peter
f666792f97 no message 2017-02-02 02:59:08 +03:00
Adlai Holler
404795dc02 Remove Support for iOS 7 (#2930)
* Drop support for iOS 7

* Copy reference images

* Update deployment for sample projects

* Update version

* Update "Life Without Cocoapods"
2017-02-01 14:40:37 -08:00
Adlai Holler
d7670780b2 Fix Deleting Sections Issue (#2962)
* Add data source to main project

* Remove the idea of deletingSectionsOfKind – always delete all kinds

* Move comment into assertion
2017-01-31 15:39:10 -08:00
Hannah Troisi
7f7f28385d [ASNodeController] First implementation of node controller class (#2945)
* [ASNodeController] initial commit for node controller class

* create <ASInterfaceState> protocol, -[ASDisplayNode interfaceDelegate], and use these to forward to ASNodeController

* rename ASInterfaceStateDelegate, fix setting in it ASNodeController.mm
2017-01-31 14:27:02 -08:00
Adlai Holler
38aac9d019 IGListKit Support II: Electric Boogaloo (#2942)
* Reimplement IGListKit support in a cleaner way

* Rename and fix some stuff

* Fix supplementaries more

* Update docs

* Update test

* Cleanup minor things

* Tweak it

* Indentation

* Remove irrelevant changes

* Break out cell into its own file

* Fix indentation

* Address feedback
2017-01-30 11:16:59 -08:00
Huy Nguyen
38f1efd448 [ASDataController] Simplify data controller (#2923)
* Start removing ASChangeSetDataController

* Continue removing ASChangeSetDataController

* Remove unnecessary change

* ASDataController is no longer an abstract class, remove its assertion

* Get back beginUpdates and endUpdatesAnimated:completion in ASCollectionNode
2017-01-24 17:41:19 -08:00
Michael Schneider
d9be4783e5 [ASLayout] General Layout Cleanup (#2920)
* Remove duplicate import

* Move `ASLayoutController` related code out of CoreGraphics+ASConvenience

* Further cleanup

* Move private layout files to Privat/Layout

* Move ASLayoutElementStylePrivate into Private/Layout

* Further cleanup

* Move tvOS related files to tvOS folder

* Further cleanup
2017-01-24 11:54:05 -08:00
Huy Nguyen
6736367627 [ASStackLayoutSpec] Refactor baseline alignment algorithm (#2892)
* Add tests for baseline alignments

* Merge baseline alignment algorithm to the main stack algorithm
- Baseline alignment is now part of the main stack algorithm.
- ASStackBaselinePositionedLayout is no longer needed and removed.

* All snapshot test cases of ASStackLayoutSpec are passing now

* Remove baselineRelativeArrangement

* Remove TODO

* Minor fixes in cross size determination step
2017-01-18 11:12:10 -08:00
Peter
81076bdde4 Merge commit '89156ebbc750a2d28b8d4594ccad62ef4c73127e' 2017-01-18 02:13:01 +03:00
Leo Tumwattana
4e80acc6e1 [ASEditableTextNode] Maximum number of lines to display (#2777) (#2867)
* WIP

* Calculate TextKit Height based on max lines to display

* Remove TODO

* Calculate height based on lineFragmentRect

* Fixes issue with calculated width

* Resolve TextKit stack threading issues

* Removes blank lines

* Open brace on next line

* setNeedsLayout in case of changes on live node
2017-01-12 13:47:44 -08:00
Michael Schneider
cdf7f70747 [ASDimension] Simplify header file to focus on the most essential types for app developers. (#2794)
* First round of cleanups for ASDimension.mm/h

* Add ASDimensionDeprecated and ASDimensionInternal to Copy Files build phase
2017-01-10 10:05:15 -08:00
Peter
c0b31e7eba Merge commit '7872cfb5a40c5483c23c810096f69d315d8b54bc'
# Conflicts:
#	AsyncDisplayKit/ASImageNode.mm
2016-12-22 03:21:26 +03:00
appleguy
eeb977e145 [ASDisplayNode] Ensure all subclasses are using base class __instanceLock__ and not re-defining their own. (#2754)
* [ASDisplayNode] Ensure all subclasses are using base class __instanceLock__ and not re-defining their own.

This also moves the @package definition of the instance variable to +FrameworkPrivate instead of Internal.h,
because Internal.h should ideally not be used outside of the ASDisplayNode file setup.  This has greatly reduced
the number of imports of Internal.h.

* [ASDisplayNode] Add ASDisplayNode+FrameworkSubclasses.h to share __instanceLock__ definition.
2016-12-12 19:42:41 -08:00
appleguy
2feabd2832 [ASScrollNode] Support for automaticallyManagesContentSize, adopting the ASLayoutSpec's size as the scrollable contentSize. (#2753)
* [ASScrollNode] Support for automaticallyManagesContentSize, adopting the ASLayoutSpec's size as the scrollable contentSize.

This feature has been desired for a long time, and has turned out to be phenomenally useful and easy to use.

It works well either for a blank ASScrollNode with .layoutSpecBlock set on it, or a subclass of ASScrollNode with a more
traditional layoutSpecThatFits: implementation.  With this approach there is no need to capture the layout size, use
an Absolute layout spec as a wrapper, or set contentSize anywhere in the code and it will update as the layout changes!

There is no automatic management of contentInset, but it would make sense to add this with keyboard listeners in the future.

* [ASScrollNode] Add locking to new properties, adjust how calculateLayout override is done.
2016-12-12 12:03:54 -08:00
Peter
3121ecf636 Merge commit 'd9209e69c25657586b43a72def4c5ac537956e40' into debug-drawrect
# Conflicts:
#	AsyncDisplayKit/ASCollectionNode.mm
#	AsyncDisplayKit/ASDisplayNode.mm
#	AsyncDisplayKit/ASTableNode.mm
#	AsyncDisplayKit/Details/ASCollectionViewFlowLayoutInspector.h
#	AsyncDisplayKit/Details/ASCollectionViewLayoutInspector.h
#	AsyncDisplayKit/Details/ASCollectionViewLayoutInspector.m
2016-12-12 01:02:23 +03:00
Peter
7bf7235e0c no message 2016-12-11 22:59:02 +03: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
Peter
c9487b2d17 Merge commit '67cb789f862fa7572a06159c230612ef3ad414c4'
# Conflicts:
#	AsyncDisplayKit/Details/ASEventLog.h
2016-11-22 21:28:49 +03:00
Garrett Moon
f3fa83610f Undo addinng 📦 2016-11-21 14:52:45 -08:00
Garrett Moon
b3754942f1 Fix build for life without cocoapods 2016-11-21 14:52:26 -08:00
Garrett Moon
000dbc818e [ASCollectionView] Move ASCollectionViewLayoutInspector to its own file 2016-11-21 14:52:12 -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
00968ed984 Undo addinng 📦 2016-11-19 15:53:14 -08:00
Garrett Moon
55ba1c5e45 Fix build for life without cocoapods 2016-11-19 15:42:38 -08:00
Garrett Moon
88d0dff09c [ASCollectionView] Move ASCollectionViewLayoutInspector to its own file 2016-11-19 15:14:03 -08:00
Peter
11db9b6a7b Merge commit 'a568d02c333ac1ffef5dae971964363afec20cd3'
# Conflicts:
#	AsyncDisplayKit/ASDisplayNode.h
#	AsyncDisplayKit/ASDisplayNode.mm
#	AsyncDisplayKit/Private/ASInternalHelpers.m
#	AsyncDisplayKitTests/ASDisplayNodeTests.m
2016-11-17 11:51:43 +03:00
Adlai Holler
a568d02c33 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
2016-11-16 16:46:39 +09:00
Adlai Holler
244ff00152 Fix carthage? 2016-11-16 11:03:55 +09:00
Peter
0a4cd7089f Merge commit '976cbf7c4a5454c03ab4ff2469dc7a6aa163da08' 2016-11-12 17:05:22 +03:00
Peter
e51b1d66e3 Merge commit '6bbc9a3cb04b2c9611a305aa43f65e526f16b1c4' 2016-11-12 17:04:37 +03:00
Adlai Holler
976cbf7c4a Let nodes deallocate naturally, manually trampoline UIKit ivars 2016-11-09 18:02:25 +09:00
appleguy
55b5dff80c [ASLayoutSpec] Initial commit to support visualizing layout specs (with Playground app). (#2554)
* Initial ASLayoutSpecPlayground commit

* Initial exploratory stab at the main challenge of the app - visualizing ASLayoutSpecs

* Halfway through moving debug features out of ASDK framework files and into debug files. Project builds.

* [ASLayoutSpecPlayground] Created new Inspector node, cleaning up internal implementation to start formalizing support for layout spec visualization.

* Workaround for ensuring creation of visualizerNode for ALL layoutspecs

* continued development

* Layout Inspector Work in Progress

* Resizing the playground works in the shrink direction, not for grow.

* added new ASLayoutableInspectorNode features

* Cleaned up examples code.

* Cleaning up  code.

* more code cleanup

* [ASLayoutableInspector] Transition to an ASTableNode-based architecture to support larger numbers of buttons / customizable types.

* [ASLayoutableInspector] Support different layoutable property types to set up buttons that can edit all of them.

* Huy debugging

* Refactored layout inspector code for extensibility.

* Properly lock layoutableContextMap

* Fix context handling in ASDisplayNode:measureWithSizeRange

* Fix ASLayoutSpecPlayground:ViewController:toggleVisualization

* added slider to InspectorCell

* [ASLayoutSpecPlayground] Improvements to propagation of visualize mode, resize handle, minor cleanup.

* Fix to ASEnvironment

* [ASLayoutSpecPlayground] Fix a few minor issues from the merge with latest master.

* Implement layout spec cache

* add pager ndoe

* add more examples

* add more layout examples

* [ASLayoutPlayground] Fix merge issues

* [ASLayoutPlayground] Fix up the example project from the 2.0 API changes.

* [ASLayoutPlayground] Some fixes (#2411)

* [ASLayoutPlayground]: Some fixes
* Fixed crash when tapping descender.
* Fixed setting the item to inspect.
* Fixed button states in inspector node.
* Added sliders for spacingBefore, spacingAfter, ascender.

* [ASLayoutSpecPlayground] Deselect the buttons when editing is over.

* [ASLayoutSpecPlayground] Changed flexGrow/Shrink's values from YES/NO to 1.0/0.0

* [Project] Create new Debug/ directory for advanced tools dedicated to debugging.

* [LayoutSpecPlayground] Rename project without AS in title, to be consistent with LayoutSpecExamples.

* [Bulid] Fix Xcode project to use new Debug subdirectory / group.

* [Bulid] Fix a small merge error.

* [Build] Fix build issue for Framework target.

* [Bulid] Fix podspec to expose InspectorNode header; Remove old-cocoapods emojis from ASDKgram :)

* Move aside ASLayoutSpecPlayground-Swift to match master

* [LayoutSpecPlayground] Cleanup implementation in several files, xcodeproj, etc.

* [ASControlNode] Add comment for new assertion, to be enabled in a separate diff.
2016-11-08 20:16:16 -08:00
Michael Schneider
2e46aa1e89 Move ASEventLog out of the Private folder (#2580) 2016-11-09 10:41:45 +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