444 Commits

Author SHA1 Message Date
Adlai Holler
61dade6bda Raise deployment target to iOS 9 (#743)
https://github.com/TextureGroup/Texture/pull/743

Manually merged since I forgot to retarget that diff onto master before merge
2018-01-15 15:13:05 -08:00
Adlai Holler
1d105c2056
Add an experimental "no-copy" renderer (#741)
* Add "ASGraphicsContext" to skip copying our rendered images

* Zero the buffer before making a context

* Update license header

* Update dangerfile

* Make it a runtime flag

* Restore GState for good measure

* Free buffer if end without image

* Enable the experiment, and cut out the middle-man

* Fix typo
2018-01-13 19:19:08 -08:00
Adlai Holler
5e73396cde
Enable collection node interactive moves (#735)
* Add support for interactive moves

* Enable drag & drop in collection view example

* Update changelog

* Change the gating logic to match UIKit

* Add a warning when we prevent interactive movement due to async layout
2018-01-09 14:34:32 -08:00
huang-kun
e4b2c05c21 [ASCornerLayoutSpec] New layout spec class for declarative corner element layout. (#657)
* Add new layout spec class with snapshot testing. Update examples and CHANGELOG.md

* Code review updates.

* Open curly bracket in a new line.
2017-11-24 13:45:59 +00:00
Erwin Zhang
cb2e5ddb2d Fix swift sample. (#669) 2017-11-21 13:33:45 +00:00
Derek Argueta
72d33fc88e Update Pinterest CDN URL in example code (#613) 2017-10-12 12:44:30 +01:00
Garrett Moon
4dbb6441d7 Animated WebP support (#605)
* Updating to support animated WebP

* Fix a deadlock with display link

* Fix playhead issue.

* Fix up timing on iOS 10 and above

* Don't redraw the same frame over and over

* Clear out layer contents if we're an animated GIF on exit range

* Clear out cover image on exit of visible range

* Don't set cover image if we're no longer in display range.

* Don't clear out image if we're not an animated image

* Only set image if we're not already animating

* Get rid of changes to podfile

* Add CHANGELOG entry

* Update license

* Update PINRemoteImage

* Remove commented out lines in example
2017-10-09 11:48:32 -07:00
Hannah Troisi
dcaca529b4 [ASDKgram Example] fix crash on startup (#566)
* fix crash on ASDKgram startup

* quicker fix
2017-09-16 10:36:58 -07:00
Huy Nguyen
d4b1f625aa [Gallery layout] Include the caller in properties providing methods (#533)
* Include the caller in ASCollectionGalleryLayoutPropertiesProviding's methods

* Update CHANGELOG.md
2017-09-08 17:05:06 +01:00
Huy Nguyen
4ba6f451f6 [Cleanup] Remove deprecated APIs (#529)
* Remove preferredFrameSize

* Remove -measure:

* Remove -measureWithSizeRange:

* Remove ASLayoutable

* Remove .name

* Remove deprecated style forwardings

That includes following properties that are declared on ASDisplayNode and ASLayoutSpec: spacingBefore, spacingAfter, flexGrow, flexShrink, flexBasis, alignSelf, ascender, descender, sizeRange and layoutPosition.

* Remove usesImplicitHierarchyManagement

* Remove deprecated range update callbacks:
-visibilityDidChange:
-visibleStateDidChange:
-displayStateDidChange:
-loadStateDidChange:

* Remove -clearFetchedData

* Remove -cancelLayoutTransitionsInProgress

* Remve ASDisplayNode+Deprecated.h

* Remove ASLayoutRangeTypeRender and ASLayoutRangeTypeFetchData

* Remove -[ASTableView clearContents]

* Remove reloadDataImmediately

* Remove ASStaticLayoutSpec

* Remove ASDimensionDeprecated

* Remove optional -pagerNode:constrainedSizeForNodeAtIndex: delegate method in ASPagerDelegate

* Remove suppressesInvalidCollectionUpdateExceptions

* Remove -[ASCollectionViewLayoutInspector initWithCollectionView]

* Remove ASVideoPlayerNode.loadAssetWhenNodeBecomesVisible

* Update CHANGELOG

* Update license of ASLayoutSpecTests.m

* Update examples/PagerNode

* Remove ASEnvironmentTraitCollection

* Remove -ASViewController.nodeConstrainedSize

* More on removing ASLayoutable
2017-09-07 19:25:42 +01:00
Huy Nguyen
afeb25a6b4 [examples/ASCollectionView] Register supplementary kinds (#508) 2017-08-14 16:52:45 +01:00
Max Wang
a929950d2c Fix SIMULATE_WEB_RESPONSE not imported (#450)
* fix SIMULATE_WEB_RESPONSE not imported (Reported in #449).

* changes per review

* Update license of ViewController.m
2017-08-14 16:31:52 +01:00
Huy Nguyen
fdc1f0468c Improvements in ASCollectionGalleryLayoutDelegate (#496)
* Improvements in ASCollectionGalleryLayoutDelegate
- It now can handle section inset, as well as interitem and line spacings
- Other small changes

* Fix build failure and update file licenses

* Update CHANGELOG

* Minor change

* Another assertion on scrollable directions of gallery layout delegate
2017-08-08 19:11:40 +01:00
Huy Nguyen
78c133e44c [ASCollectionLayout] Add ASCollectionGalleryLayoutSizeProviding (#451)
* Add ASCollectionGalleryLayoutSizeProviding
- This allows users to return different sizes based on certain conditions, such as the collection node's bounds or grid constants.
- ASPagerNode will also act as a size provider to ensure all pages have an up-to-date size that is its bounds.

* Update CHANGELOG

* ASPagerNode to use gallery layout delegate if told to
2017-07-18 10:08:12 +00:00
Huy Nguyen
3ccc2f0f15 Introduce ASCollectionGalleryLayoutDelegate (#76)
* 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
2017-07-14 18:50:26 +00:00
Huy Nguyen
5d72a76fb9 Integrate Weaver into ASDKGram (#412)
* Integrate Weaver into ASDKGram

* Update the license of app delegate
2017-07-04 12:20:17 +00:00
Adlai Holler
8ec4b312cf Overhaul our logging, add activity tracing support. (#399)
* Improve the os_log and os_activity integration

* Address feedback from Scott and Huy
2017-07-03 19:03:26 -07:00
appleguy
486410d7d6 [Yoga] Minimize number of nodes that have MeasureFunc set on them. (#369)
This has one important benefit: fixing the stretching behavior of spacer nodes.

In addition, it should help efficiency of Yoga and certainly minimize calls
to layoutThatFits:.

Next up for Yoga is a mostly-red diff, deleting the non-Contiguous code branches.
2017-06-18 18:18:12 -07:00
Andrew Yates
46c4359cc1 Updates ASDKGram to use IGListKit 3.0.0 (#367) 2017-06-17 23:01:54 -07:00
appleguy
55928f343d [Yoga] Rewrite YOGA_TREE_CONTIGUOUS mode with improved behavior and cleaner integration (#343)
* [Yoga] Rewrite YOGA_TREE_CONTIGUOUS mode with support for mixing with ASLayoutSpec.

After experimentation with the ASYogaLayoutSpec (or non-contiguous) approach to
integrating Yoga, test results and feedback from the authors of Yoga have shown
that this approach can't be made completely correct,

There are issues with some of the features required to represent Web-style
flexbox; in particular: padding, margins, and border handling have varience.

This diff is a first step towards a truly correct and elegant implementation of
Yoga integration with Texture. In addition to reducing the footprint of
the integration, which is an explicit goal of work at this stage, these changes
already support improved behavior - including mixing between ASLayoutSpecs
even as subnodes of Yoga layout-driven nodes, in addition to above them. Yoga
may be used for any set of nodes.

Because Yoga usage is limited at this time, it's safe to merge this diff and
further improvements will be refinements in this direction.

* [ASDKgram] Add Yoga layout implementation for PhotoCellNode.

* [Yoga] Final fixes for the upgraded implementation of the Contiguous layout mode.

* [Yoga] Add CHANGELOG.md entry and fix for Yoga rounding to screen scale.

* [Yoga] Minor cleanup to remove old comments and generalize utility methods.
2017-06-14 19:36:13 -07:00
Adlai Holler
83111de0cc Add first-pass view model support to collection node. #trivial (#356)
* Add first-pass view model support for collection node. Much more to come!

* Address issues

* Update the gorram license header

* Dear lord
2017-06-12 16:50:33 -07:00
Dima
caa7e2e2ad [Examples] Fixed crash on SocialAppLayout-Inverted + behaviour comments (#304)
* [Examples] Fixed crash on SocialAppLayout-Inverted + behaviour comments

* [Examples] Update license header in SocialAppLayout-Inverted to the correct format

* [Examples] License header typo fixes
2017-05-24 11:51:59 -07:00
César Estébanez Tascón
e6accc7ea6 [Examples] Fix LayoutSpecExamples and LayoutSpecExamples-Swift: image URLs were still pointing to asyncdisplaykit.org (#275)
* Fix Image URLs in LayoutSpecExamples and LayoutSpecExamples-Swift (they were still pointing to asyncdisplaykit.org)

* Update documentation of ASMapNode example to accurately reflect implemented layout

* Fix headers

* More headers fixing
2017-05-16 19:05:55 +01:00
Michael Schneider
299df0aa8c [Examples] Fix a couple of examples due to API changes recently #trivial (#267)
* Fix ASDKGram example

* Fix some more examples

* Convert Swift example to 3.0

* Fix VerticalWithinHorizontalScrolling

* Fix some headers

* Fix some more API changes

* Remove semicolons
2017-05-15 09:48:45 -07:00
Huy Nguyen
7dd83615c1 [example/CustomCollectionView] Implement MosaicCollectionLayoutDelegate (#28)
* Implement MosaicCollectionLayoutDelegate

* Update licenses

* Address comments

* Fix license
2017-05-14 12:03:22 -07:00
Adlai Holler
d4725a51f2 Add Experimental Text Node Implementation (#259)
* 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
2017-05-14 12:02:07 -07:00
Michael Schneider
8692428481 [ASDisplayNode] Pass drawParameter in rendering context callbacks (#248)
* Pass drawParameter in rendering context callbacks

* Add changelog

* Fix examples
2017-05-08 14:39:40 -07:00
Garrett Moon
4cbf278e8d Fixes assertion on startup in social app layout example (#233)
* Fixes assertion on startup found when investigating #220

* Update license in header
2017-05-03 19:05:50 -07:00
George
a4ddc072a4 Fix CustomCollectionView-Swift sample (#22)
* Updated copyright notices

* Fixed crash and removed storyboard
2017-05-03 11:04:00 -07:00
Garrett Moon
fe66bc1a8c Hopefully the last example fix. 2017-04-14 09:37:38 -07:00
Garrett Moon
caace4f98b More example fixes 2017-04-14 09:37:38 -07:00
Garrett Moon
3522c81d5e Update examples 2017-04-14 09:37:38 -07:00
Huy Nguyen
7d365c7d07 Introduce ASCollectionLayout and friends (#3130)
* 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
2017-04-12 11:13:44 +01:00
Adlai Holler
fcbbea51a6 Fix the Initialization Hierarchy (#3207)
* Fix the initializers setup

* Update Swift example

* Remove incorrect comment

* Add one to ASTableNode
2017-03-28 11:48:20 -07:00
Michael Schneider
0e73f4ad5e Fix warnings (#3194) 2017-03-17 07:15:31 -07:00
Michael Schneider
2df392261e [ASVideoPlayerNode] Fixes and improvements (#3135)
* Improvements for ASVideoPlayer, especially around asset handling and API

* Change legacy URL of videos

* Address comments
2017-03-05 19:28:03 +00:00
Adlai Holler
7763356b8a Replace IGListKit Method Macros with Actual Methods (#3094)
* Replace IGListKit macros with methods

* Remove docs in impl

* Update example
2017-02-27 11:08:39 -08:00
Adlai Holler
73ca6ab514 Shuffle & Cleanup Stuff (#3080) 2017-02-26 18:14:13 -08:00
Adlai Holler
2fd487b447 Add collectionNode:nodeBlockForSupplementaryElementOfKind:atIndexPath: (#3078)
* Add optional support for nodeBlockForSupplementaryElementOfKind:

* Update example

* Update harder
2017-02-24 18:47:01 -08:00
Adlai Holler
9c82ae9284 Add ASRectTable (#3077) 2017-02-24 16:38:17 -08:00
Adlai Holler
6ab92dbd3f Prevent Adding View-Backed Nodes to Layer-Backed Hierarchies (#3062)
* Prevent adding view-backed nodes to layer-backed nodes

* Do that in a different diff

* Fix the message

* Update tests

* Fix the fix
2017-02-22 17:48:13 -08:00
Hannah Troisi
ea09ad75ef [Sample] Move example screenshot assets to AsyncDisplayKit/docs repo (#3058)
* move example app screenshot assets to AsyncDisplayKit/docs repo & update links

* Update README.md

* Update README.md

* Update README.md
2017-02-22 10:32:51 -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
Michael Schneider
aecd36a4df [ASViewController] Support optional node (#3021)
* ASViewController can be used without a node
- If a node isn't provided by developers via -initWithNode:, a default one will be created and used internally.
- This allows developers to use ASViewController like a normal UIViewController and as a base class for all view controllers among which some use a node hierarchy and some don't.

* Update ASDKgram to use a shared base ASViewController

* Minor fixes in ASViewController:
- If its node isn't provided by users, don't replace the view controller's view with the default node's view because it might be loaded from a nib.
- Init a vanilla ASDisplayNode if a node isn't provided.

* Some smaller cleanup

* Remove dummy node for ASViewController if it’s used without a node
2017-02-14 13:18:59 -08:00
Adlai Holler
bbc1aecf95 Deprecate shouldRasterizeDescendants (#3024)
* Deprecate shouldRasterizeDescendants

* Set superclass right
2017-02-13 13:34:53 -08:00
Adlai Holler
0badff651a Revert "Route setDelegate: to setAsyncDelegate: (#3007)" (#3023)
This reverts commit 5c8818d107252da8eb6a91cf88237916ec26f5ed.
2017-02-13 10:38:19 -08:00
Adlai Holler
d7ce6b9a04 CatDealsCollectionView: Use the correct method name (#3015) 2017-02-10 13:35:29 -08:00
Adlai Holler
7424b6d7f7 Update examples to use UIControlState (#3013) 2017-02-10 13:35:15 -08: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