Comments (6)
@RuiAAPeres, thanks for the question! The technology you're referring to from the video is called Components. It can be thought of as a declarative, immutable version of the core concepts behind AsyncDisplayKit, but ASDK predates Components by about two years and they are implemented separately. There is no active work to open source Components, but that doesn't mean it won't happen. The team is currently focused on getting it shipped in the main FBiOS app.
The core difference between the two frameworks has to do with imperative vs declarative design. Components is more similar to React; it is declarative and essentially forces single-directional data flow, often with immutable intermediates that are re-created instead of modified as changes require. AsyncDisplayKit is more similar to UIKit; it is imperative and just like UIView, user input can often change state without completely replacing it with a new immutable object.
As with anything, there are pros and cons of each approach. We've found in practice that declarative code tends to be shorter and more concise, but there is a learning curve because it has a very different "feel" than any experienced iOS engineer will be familiar with. More importantly, part of the point of the declarative model is to limit API surface area and the number of ways in which bugs can be introduced (race conditions, etc)—but sacrificing some of this flexibility does have impacts, particularly on how interactive interfaces and animations are implemented. It's possible to implement animations with Components, but it's often more complex to achieve a polished effect than with an imperative design (and in many other cases, it is not technically feasible).
So, they're useful for different situations. Neither one is perfect for the majority of apps. At the highest level, if your app has a lot of repeated structures and layout rules (think the main feed of Facebook for iOS, which is what Components was directly designed for), with little interactivity and animation, then Components is a huge boon for reducing code complexity and sources of bugs. If you have a highly interactive app with parts of the UI that animate into different states to become new parts of the UI, physics, gestures, etc...it will be between difficult and impossible to use the Components strategy exclusively, so a hybrid approach combining both may be possible.
Let me know if you have any other questions on this.
from asyncdisplaykit.
thanks for the answer @appleguy. I actually got another question: how does Components looks like? As in, is it a class that just encapsulate a piece of a UIView
? At first I thought it could potentially encapsulate a CALAyer
but then again you need the interactivity (clicking the like button for example). Could you give a brief description about what a Component is and what's its interaction with UIKit? In the end that "Story", that belongs to a "Feed", need to be showed in a VC's root view, correct?
from asyncdisplaykit.
@RuiAAPeres it will be up to the Components team to decide when to release more information than is in the presentation, but Components was partially inspired by the view /or/ layer-backing capability of ASDisplayNode. It is one of the main optimizations that justifies the "abstraction cost" over using basic UIViews. Currently both systems use layer backing only where touch handling is not needed, but it is very possible in both frameworks to later implement a simple touch forwarding system that can actually eliminate that specific requirement. UIViews will remain important in some capacity because they are the main way to support accessibility and a few other features.
Let me know if you have any other thoughts, and then we'll close this task :)
from asyncdisplaykit.
@appleguy I wanted to know a bit more, specially how a .h/interface would look like, plus how is it layered on (hierarchy speaking: (Something -> View -> Layer, etc)). But I understand you guys want to keep this "private" for the time being. Hopefully, we can see more articles related to how you work on Facebook and how has your experience being doing all this stuff. I think you guys are in a unique position to help the community and I am really thankful for all the things you have released. Speaking of articles, where would be the right place to keep an eye on? facebook.com/engineering?
from asyncdisplaykit.
@RuiAAPeres, you can follow the Facebook Engineering blog at code.facebook.com. Also, you might be interested in Ari's comment on potentially open-sourcing Components in the next few months! =]
from asyncdisplaykit.
Thanks @secretiverhyme for the heads up. 👍
from asyncdisplaykit.
Related Issues (20)
- Custom flow layout did not work in ASCollectionNode ,But work in UICollectionView
- Build failed with XCode Version 9.3 (9E145) HOT 12
- How to reload SupplementaryElement (UICollectionElementKindSectionHeader)
- [ASTableNode] When tableNode is reloading I see several empty rows, but they have the content
- collectionNode always lost several cells and give me some blank cells HOT 1
- Change maximumNumberOfLines from 5 to 0, The text is stretched. HOT 2
- Full screen button doesn't appear on ASVideoPlayerNode HOT 2
- Dictionary Parsing Problem HOT 1
- Expected method to read dictionary element not found on object of type 'id<NSObject>' HOT 3
- I need a error log while playing ASVideoPlayerNode HOT 1
- page control HOT 1
- updateContentSize HOT 1
- ASTableNode will scroll to the top after insert rows
- enableSubtreeRasterization causes ASButtonNode to not receive touch event HOT 1
- ASButtonNode highlighted titles shifts to the right HOT 2
- CollectionNode fetches all content from NSFetchResultsController
- willDisplayNodeContentWithRenderingContext not work HOT 2
- Sometimes `ASPerformMainThreadDeallocation` does not work HOT 2
- ASTextKitContext.mm(line 62) return nil.
- How to get ASCellNode location on ASCollectionNode
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from asyncdisplaykit.