In this case, the user hasn't specified enough about the layout of a node. We default to
0, 0 - but ideally the case should not occur at all. So it's important to help developers
detect these cases and fix them quickly.
An assertion causes developers several problems:
- They can't see important information unless an exception breakpoint is manually added.
- They can't see their layout onscreen and so visually understanding the problem is impossible.
- They can't proceed with testing to trigger other faults in the layout and are blocked fixing one at a time.
A log fixes every one of those problems:
- They can set a breakpoint on the log line very easily if desired.
- They can see their layout display and recognize the 0,0 node even more quickly than the log text information.
- They can see if multiple logs print out, or if the log only occurs for one item in a feed, or certain types --
This helps them debug faster by knowing if the layout is always broken or certain conditions break it.
Since developing with ASLayoutSpecs is an iterative process, it's crucial that we let developers have the
freedom to experiment and test without hitting too many assertions. Fortunately it will be impossible to ignore
these huge logs (full recursive description) and their nodes will be 0, 0 size, so they will get fixed.
* 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.
- 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.
* Check in ASLayout if size is valid for sizing instead of valid for layout
* Return constrainedSize from calculateSizeThatFits:
Remove invalid constrainedSize check within ASNetworkImageNode. Furthermore as ASDisplayNode does not return CGSizeZero anymore we have to give the display nodes we use in tests and are involving a stack spec an intrinsic content size.
* Remove extra constrainedSize handling in ASNetworkImageNode handling
* Change test to use FLT_MAX
* Add internal header for ASLayout and change position to readonly publicly
* Don't copy sublayouts during tree filtering
* Revert "Don't copy sublayouts during tree filtering"
This reverts commit 6b0d54d5ffe5bb3941ec13696c9c45b0098b6ba1.
Profiling showed this area as the most expensive part of ASRangeController propogation of .interfaceState,
when scrolling an ASTableView. This is very much on the critical path for sustained 60FPS in these views.
* Fix
* Add building extra examples to build.sh
* Fix example projects
* Fix CarthageBuildTest
* Export NSArray+Diffing.h to fix life without cocoapods
* Remove set layout style size helper
* Update API to set and get a CGSize / ASRelativeSize from an ASLayoutElementStyle
- Expose ASRelativeSize type
- Add new helper properties to set a size / relative size to ASLayoutElementStyle
- Don't expose the size in ASLayoutElementStyle anymore and move into ASLayoutElementStylePrivate
* Update examples
* Update comments for size helpers
In at least some cases, _pendingDisplayNodes referencing self can cause the
object to live longer than the application needs, while tearing down views.
It also appears there may be a cancellation condition where this state is
not balanced properly, which can cause a reference-cycle leak. This change
safely fixes this problem when tested against a repro case for it.
I'm filing a followup task to make sure all cancellation edge cases have
proper accounting for this codepath, even though the leak is fixed.
* 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.
* [Layout API] Rename ASLayoutable to ASLayoutElement
* arg
* fix wrapperWithLayoutElement
* [Layout API] Rename ASLayoutable to ASLayoutElement
* arg
* address Michael's comments
* Remove ASLayoutValidation files that were deleted on master since this diff was created.
* Initial commit to move [ASLayoutSpec children] from std::map to NSMutableArray
* Add NSFastEnumeration to ASLayoutable
* ASNullLayoutSpec is a Singleton now
* Move ASLayoutSpecPrivate in Private folder
* Move to NSArrayPointer and remove ASNullLayoutSpec
* Revert "Move to NSArrayPointer and remove ASNullLayoutSpec"
This reverts commit 9ab9cf7024b1f6e1984d84fe58af2b84e84cdf94.
* Move to childAtIndex: and setChild:atIndex:
* Deprecate preferredFrameSize
- Remove all support for preferredFrameSize in ASDK
- preferredFrameSize setter calls through and sets the width and height of the node
- preferredFrameSize getter tries to return a CGSize based on the width and height properties otherwise if this is not possible it throws
* Address comments
* Return CGSizeZero for preferredFrameSize unless width and height are ASDimensionUnitPoints
* Better comment for preferredFrameSize and remove lock in calculateSizeThatFits:
* Add style property to ASLayoutable
* Add styles property to further layout specs
* Adjust some examples
* Add `loadStyle` to create the style object in a ASLayoutable
* Revert "Add `loadStyle` to create the style object in a ASLayoutable"
This reverts commit 2b7240f2c7dc993e38cadf290cfdf08482dd70c7.
* Revert "Adjust some examples"
This reverts commit 3254ae0a321e75db3ecfa80adee9d96bde93a33d.
* Revert "Add styles property to further layout specs"
This reverts commit c779dcb876ead27122c1af1300146a6ad36912cb.
* Rename ASLayoutableStyleDeclaration to ASLayoutableStyle
* Add styleClass class property for extensibility support of the ASLayoutable style object
* flexShrink should not be YES by default
* Revise performance measurement naming and structure
- Revises naming from LayoutSpecGeneration to LayoutSpecComputation
- Adds a struct instead of an NSDictionary to retrieve performance metrics
- Includes ASEnvironmentStatePropagateDown in LayoutSpecComputation measurements
* Revise SumScopeTimer to include enable flag
* Make struct a typedef
Scenario: An ASCollectionNode is a subnode of an ASCellNode. A layout transition is started, resulting in
the removal of the ASCollectionNode as a subnode. As it is removed, the hierarchy state is cleared - including
the "range managed" bit - on the ASCollectionNode. However, the deep recursion traverses the layer hierarchy
too, and clears this bit on the ASCellNodes inside the ASCollectionNode. A moment later, the collection performs
its final ASRangeController update to mark its cells as invisible and free memory. Then an assertion is triggered
in ASRangeController, because it is operating on nodes that do not have the "range managed" bit set.
It turns out that ASInterfaceState also propogates in this way, but that behavior is efficient and beneficial in
its current configuration (it assists how multi-dimensional preloading works). However, hierarchy state should
never need to jump discontinuities in the node hierarchy. For now, disabling that case and will revisit
other use cases soon.