64 Commits

Author SHA1 Message Date
ricky cancro
eae76d26b7 Add expectedSize to ASNetworkImageNode
ASNetworkImageNode defers to ASImageNode to return its calculatedSize. ASImageNode returns the size of its image. There is a good chance that ASNetworkImageNode hasn't downloaded its image yet when calculatedSize is called, so it returns a size of CGSizeZero.

On top of that, it is possible that the size of the image is not actually the size that we wish to display in our node.

I've added an "expectedImageSize" property that can be used to determine the calculatedSize of an ASNetworkImageNode.
2015-07-30 16:50:11 -07:00
Connor Montgomery
ca5e9e7dc3 Add support for configuring on ASEditableTextNode. 2015-07-30 15:19:00 -04:00
Scott Goodson
46bbe479ae Implement warning assertion for supplementary views in ASCollectionView.
Make sure ASTableViewStressTest passes.  It was sometimes testing a scenario UITableView itself doesn't support.
2015-07-25 21:25:40 -07:00
Huy Nguyen
bbadc9a1e9 Update nodes in Kittens example to use new signature of layoutSpecThatFits:.. 2015-07-10 19:46:32 +07:00
Huy Nguyen
9678adaa93 Merge branch 'master' into layout_node 2015-07-06 22:21:32 +07:00
Huy Nguyen
daf3daeb51 Preserve the manual layout code in Kittens example. 2015-07-05 14:36:39 +07:00
Huy Nguyen
33a3412acf Horizontally center the text in Kittens' BlurbNode. 2015-07-05 13:54:47 +07:00
Huy Nguyen
2149d44990 Fix naming convetion:
- "Layout node" is changed to "layout spec".
- Update tests.
- Update Kittens sample.
2015-07-01 18:13:44 +07:00
Scott Goodson
57465c7fd3 Overhaul ASDataController and extensively test ASTableView.
This diff resolves all known consistency issues with ASTableView and ASCollectionView.
It includes significantly more aggressive thrash-testing in ASTableViewStressTest,
which now passes on a variety of device and simulator configurations.  It also updates
the unit tests run on every commit to ensure any regression is caught quickly.

A few of the salient changes in this diff:
- ASTableView now uses Rene's ASCollectionViewLayoutController, and actually uses a
UICollectionViewFlowLayout without any UICollectionView.  This resolves an issue where
ASFlowLayoutController was generating slightly out-of-bounds indicies when programmatically
scrolling past the end of the table content.  Because the custom implementation is likely
faster, I will revisit this later with profiling and possibly returning to the custom impl.
- There is now a second copy of the _nodes array maintained by ASDataController.  It shares
the same node instances, but this does add some overhead to manipulating the arrays. I've
filed a task to follow up with optimization, as there are several great opportunities to
make it faster.  However, I don't believe the overhead is a significant issue, and it does
guarantee correctness in even the toughest app usage scenarios.
- ASDataController no longer supports calling its delegate /before/ edit operations.  No
other class was relying on this behavior, and it would be unusual for an app developer to
use ASDataController directly.  However, it is possible that someone with a custom view
that integrates with ASDataController and ASRangeController could be affected by this.
- Further cleanup of organization, naming, additional comments, reduced code length
wherever possible.  Overall, significantly more accessible to a new reader.
2015-06-28 18:03:45 -07:00
Huy Nguyen
e74823bbee Merge branch 'master' into layout_node 2015-06-28 23:47:09 +07:00
Huy Nguyen
dd29a890df Still support -calculateLayoutThatFits: (and manual layout), for backward compatibility. 2015-06-28 20:31:32 +07:00
Scott Goodson
8fc79b1d4c Update the identifier that AsyncDisplayKit uses to label its internal queues. 2015-06-27 12:07:40 -07:00
Huy Nguyen
95e787b226 Remove stack children type:
- ASLayoutable requires mutable properties that are used when attached to a stack layout.
- Thus, ASLayoutable objects (including ASDisplayNode) can be injected into stack layout directly.
- ASStackLayoutNodeChild no longer needed.
- Tests and Kitten sample updated.
2015-06-26 11:47:42 +07:00
Huy Nguyen
f588bceb4d Introduce ASLayoutable and eliminate ASCompositeNode:
- Both ASDisplayNode and ASLayoutNode conforms to this protocol.
- ASDisplayNode can be embeded directly into layout graph.
- Eliminate ASCompositeNode.
- Fix ASStaticSizeDisplayNode not recpect min constrained size.
- Updated tests.
2015-06-26 09:29:16 +07:00
Huy Nguyen
697b9f4c3c Update Kittens example to work with the improved layout system. 2015-06-25 11:36:02 +07:00
Huy Nguyen
375f99eb66 Update Kittens sample to use new layout system. 2015-06-25 11:34:36 +07:00
appleguy
607367aacf Merge pull request #496 from facebook/DataControllerCrash
Improvements to thread safety during closely spaced edit events.
2015-06-21 21:16:05 -07:00
Scott Goodson
c700618862 Improvements to thread safety during closely spaced edit events.
This applies primarily when beginUpdates / endUpdates is not used.
Due to user interaction-driven edits, like reloads or adding content
at the bottom, sometimes this is unavoidable in app design and thus
critical.

I have a diff in flight to make ASDataController / ASRangeController
robust against very aggressive thrash testing, which will be added
both to the unit test suite and this new example project.
2015-06-21 21:04:09 -07:00
Hannah Troisi
710c51593e Cleaned up Kittens sample app and added comments for clarity.
In particular, the NSValue-boxed CGSize array used as a data model for the kittens
is generated with random sizes, for unclear reasons.  It turns out this is a workaround
to convince PlaceKitten to send us unique images.
2015-06-21 11:36:19 -07:00
Elvis Nuñez
33a496ffbf Fix broken Travis 2015-06-01 20:34:24 +02:00
Elvis Nuñez
dc0d60fced Use the required initializer 2015-05-31 18:44:48 +02:00
Elvis Nuñez
f03dfcb7fd Add indent rules to project 2015-05-31 11:23:50 +02:00
Elvis Nuñez
10a548999b Fix failing Sample 2015-05-31 11:23:33 +02:00
Ben Alpert
a8c484119b Add new kittens after last row
New kittens were being added before the last kitten instead of after it
because we weren't taking into account the first (header) row.
2015-04-03 12:40:53 -07:00
Nadine Salter
9eff356a61 [travis] Shared schemes for all example projects. 2015-03-20 15:36:31 -07:00
Ryan Nystrom
c657411a2e Batch fetch with small data sets 2015-02-26 22:29:13 -08:00
Ryan Nystrom
1f8001a104 ASCollectionView batch API 2015-02-26 22:24:46 -08:00
Ryan Nystrom
09ade3dd00 ASTableView batch API and context object 2015-02-26 22:23:32 -08:00
Ryan Nystrom
4fa03a01d1 Functioning Preload range
Refactor how we do ranges so they can be arbitrarily managed. Introduce the concept of a preload range.
2015-02-26 15:41:32 -08:00
Nadine Salter
8097a6edf1 Merge pull request #323 from facebook/issue-282
Change placeholder boolean to time interval
2015-02-25 20:54:19 -08:00
Ryan Nystrom
5d76d6649f Change placeholder boolean to time interval 2015-02-23 14:01:17 -08:00
Li Tan
831aa47ae0 Address comments 2015-02-11 19:15:08 -08:00
Nadine Salter
6246f077fc Update comment in Kittens example project. 2015-02-03 08:27:21 -08:00
Nadine Salter
bfc828d6e0 Use default placeholder colour in Multiplex demo. 2015-02-03 08:25:07 -08:00
Nadine Salter
6819816bd3 Restore artificial delay in Multiplex demo.
The change to ASBasicImageDownloader regressed the artificial network
delay in the original demo code.  Revert it.
2015-02-03 08:18:57 -08:00
Nadine Salter
f085f06ff3 -[UIView addSubnode:], -[CALayer addSubnode:].
Bring back this convenience API -- it disappeared somewhere along the
line while we were building Paper.  This is totally trivial, but
conveniently won't break if you layer-back a leaf node.

Closes #278.
2015-02-02 19:59:30 -08:00
Nadine Salter
1f1abbdbdf Simple ASEditableTextNode example project. 2015-01-25 16:14:23 -08:00
Ryan Nystrom
ae1349eb16 Start downloading images when multiplex node is displayed
fixes #178
2015-01-07 17:18:00 -08:00
hanton
7a12bf3a20 Fix typo. 2015-01-02 17:16:58 +08:00
Ryan Nystrom
912bc9d460 Fade out placeholders
Added an API to fade out a node's placeholder when it is finished rendering.

fixes #156
2014-12-18 12:53:15 -08:00
Ryan Nystrom
d27c8859c7 Node placeholder API
ASDisplayNodes now have an overidable method -placeholderImage that lets you provide a custom UIImage to display while a node is displaying asyncronously. The default implementation of this method returns nil and thus does nothing. A provided example project also demonstrates using the placeholder API.
2014-12-15 17:23:52 -08:00
Li Tan
8b303710b6 fix unncessary change in editing 2014-12-15 15:57:11 -08:00
Li Tan
f7f5988fcd Support editing in table view and collection view 2014-12-15 13:19:10 -08:00
Nadine Salter
d8c1d71f24 Merge pull request #144 from facebook/issue-107
Support UIViewContentModeCenter with ASImageNode
2014-12-09 11:52:47 -08:00
Ryan Nystrom
647a9409d6 Support UIViewContentModeCenter with ASImageNode 2014-12-05 15:25:55 -08:00
Nadine Salter
eb600b955a Merge pull request #139 from facebook/imagedownloader-ios7
ASBasicImageDownloader iOS 7 support
2014-12-04 12:56:06 -08:00
Ryan Nystrom
c645935631 ASBasicImageDownloader iOS 7 support
On iOS 7, NSURLSessionTask is actually a __NSCFURLSessionTask (private class) and our NSURLSessionTask category to add the associated object asyncdisplaykit_metadata was crashing on iOS 7 stating that there was no method. This commit changes the category to extend NSURLRequest as well as change NSURLSessionTask to NSURLSessionDownloadTask.
2014-12-04 11:25:36 -08:00
Nadine Salter
93ce2b38a2 Make ASNetworkImageNode Just Work.
Use ASBasicImageDownloader by default -- you can now do...

  ASNetworkImageNode *imageNode = [[ASNetworkImageNode alloc] init];
  imageNode.URL = [NSURL URLWithString:@"..."];
  [self.view addSubview:imageNode.view];

...and it'll do the right thing.
2014-12-03 17:31:56 -08:00
Nadine Salter
8ecebcfe70 Convert Kittens sample project to ASNetworkImageNode.
Working-range-driven image loading.

(Note that ASNetworkImageNode and ASMultiplexImageNode haven't yet been
updated to work with the new `-reclaimMemory`-based working range
system, so this doesn't quite behave correctly yet.)
2014-11-21 18:40:18 -08:00
Nadine Salter
3c690bf9e5 ASBasicImageDownloader.
This is a simplistic, NSURLSession-based downloader object that
implements ASImageDownloaderProtocol and can be used with
ASMultiplexImageNode and ASNetworkImageNode.

(Closes #115.  NSURLSession should suffice for most usecases, and this
code should provide a good jumping-off point for a more-complex
implementation.)
2014-11-21 18:40:18 -08:00