* Add experimental feature of hierarchyDisplayDidFinish being recursive
## Summary
`hierarchyDisplayDidFinish` is currently called when a node's immediate subnodes implement custom CALayer rendering. For example, ASNetworkImageNode and ASTextNode perform this sort of rendering. However, it can be useful -- and less fragile -- if `hierarchyDisplayDidFinish` is propagated further up the node hierarchy. That way, if a feature is refactored such that an extra node appears between the node implementing `hierarchyDisplayDidFinish` and the nodes doing CALayer rendering, we don't lose the callback.
## Test plan
Manually tested using a modified version of the Kittens example. Also ran `build.sh tests`.
* Revert SDK change since it's still Xcode 15
* [ASDisplayNode] Fix a crash in insertSubnode
If a node is already a subnode to a supernode, Inserting it again can lead to a crash.
Here is a simple repro of the crash:
```
ASDisplayNode *subnode = [[ASDisplayNode alloc] init];
ASDisplayNode *supernode = [[ASDisplayNode alloc] init];
[supernode addSubnode:subnode];
// Crash on next line
[supernode insertSubnode:subnode atIndex:1];
```
The issue is that all the checks around subnode array boundaries are done BEFORE `subnode` is removed from its `supernode`. If it happens that the `supernode` is self, then removing the `subnode` causes all our index checks to no longer be valid.
Here is the relevant code:
```
__instanceLock__.lock();
NSUInteger subnodesCount = _subnodes.count;
__instanceLock__.unlock();
////// Here we check our indexes
if (subnodeIndex > subnodesCount || subnodeIndex < 0) {
ASDisplayNodeFailAssert(@"Cannot insert a subnode at index %ld. Count is %ld", (long)subnodeIndex, (long)subnodesCount);
return;
}
…
///////// Here our indexes could invalidate if self subnode’s supernode
[subnode removeFromSupernode];
[oldSubnode removeFromSupernode];
__instanceLock__.lock();
if (_subnodes == nil) {
_subnodes = [[NSMutableArray alloc] init];
}
////// Here would can crash if our index is too big
[_subnodes insertObject:subnode atIndex:subnodeIndex];
_cachedSubnodes = nil;
__instanceLock__.unlock();
```
* add a separate check for this special case
* Update to Xcode 15
## Summary
We want to make Texture build with recent tools like Xcode 15. Part of this is bumping the minimum supported OS to iOS 14.
I only removed the dead code (i.e. code gated on versions older than iOS 14). There are still some warnings about outdated APIs in use, but they are non-trivial changes to fix.
## Test plan
Run all the examples. Run all the unit tests and make them pass.
* Use Xcode 15.3 so we have 17.4 simulators
* Fixing an asset catalog compiler error when building against iPhone SE
* Fix a couple of file extensions for assets
A couple of PNGs were marked as JPGs
* replace destructor for after main execute
* separate ASLoadFrameworkInitializer between constructor and destructor
* AS_EXTERN -> ASDK_EXTERN
* initialSetNeedsDisplayCount should be called once on iOS 15
* Loaded node of contentsScale must be 2.0 on layer backed
* initialSetNeedsDisplayCount must called once
* [Layout] Add RTL support to LayoutSpecs
This is largely a slight update for https://github.com/TextureGroup/Texture/pull/1805. If RTL is enabled, `calculateLayoutLayoutSpec:` will flip the origin of all sublayouts.
The new part of the diff is that ASBatchFetching now supports proper fetching on RTL horizontal scrollViews.
* Fix build and add RTL batch fetching tests
* Renames AS_EXTERN and ASViewController
To ASDK_EXTERN and ASDKViewController.
This is to avoid conflicting with AuthenticationServices in
Xcode 12
* Fix up examples and docs
* Add bit about updating ASViewController rename
traitCollectionDidChange isn't necessarily called on Main, but our self.backgroundColor property access must be done on main once the view is loaded.
I originally opted to use self.backgroundColor rather than _backgroundColor in #1674, but I think we should use the ivar here. This could get out-of-sync if someone modified the UIView's background color instead of updating the node, but I think that's unlikely, so we should be safe to use the ivar here.
* This PR addresses an issue I raised with #1673 where the clipping corner layer doesn't get re-rendered when going from a dark to light user interface style. The fix is to add code in the `-asyncTraitCollectionDidChangeWithPreviousTraitCollection:` method that calls through to `-_updateClipCornerLayerContentsWithRadius:backgroundColor:` if the user interface style changes.
I've also added snapshot tests to verify that using clipping corners with a dynamic background color updates when the user interface style changes.
To preserve dynamic color capabilities for layer-backed
nodes, we need to track backgroundColor as a UIColor. In layer backed nodes we lose the dynamic color logic since we
extract a CGColor from the UIColor applied to ASDisplayNode. With this
change we can respond to changes in UITraitCollection.userInterfaceStyle
for backgroundColor.
- Adding experiment to propagate older trait collections when trait
collections change
- Re-render nodes when user interface style changes (dark mode)
- Snapshot testing examples for dark mode
- Fixes for applying trait collection overrides in XCTest
- Create new define for gating Xcode 11 / iOS 13 features until CI is running it
We rely on the delegate setter to be called to set the flag. However, recent change on iOS 13 causes the setter to not be called at all and thus we had to put up a workaround (https://github.com/TextureGroup/Texture/pull/1609). While the workaround works, the perf benefit of that the flag provides doesn't warranty the extra complexity IMO. So I think we should just remove everything.
It appears that UIKit might be setting the delegate ivar directly which bypasses establishing the `_delegateFlags` ivar on `ASDisplayLayer`. This is critical for things like ASPagerNode, ASCollectionNode that depend on layer delegateFlags to forward bounds changes.
Radar filed: FB6956185
After #1396, some view-backed nodes in our app stop responding to tap events. I tracked it down to [this change](https://github.com/TextureGroup/Texture/pull/1396/files#diff-7fbc7d84a259cbfbee7546a5310dddcfR162) which suggests that the order of execution matters.
This diff attempts to fix the issue by restoring the previous call order where `__enterHierarchy` and `__exitHierarchy` are driven by `_ASDisplayView`'s `-willMoveToWindow:` and `-didMoveToWindow` if the node is view-backed. Layer-backed nodes will still call `__enterHierarchy`/`__exitHierarchy` when they get `kCAOnOrderIn`/`kCAOnOrderOut`.
This maintains the layer-action support introduced in #1396.
* ASSignpost: Add support for the os_signpost API
- Removes support for colored intervals. These weren't really useful and they aren't part of the signpost api.
- Fixes an issue with range controller interval logging.
- Adds an interval for interface orientation changes.
* Rename
* Support Xcode 9
* Commentary
Revert "Ensure ASControlMode properties lock before accessing their ivars (#1476)"
This reverts commit ce1e1956f4.
Revert "Make sure all ASDisplayNode properties have backing ivars for consistency. (#1475)"
This reverts commit d6061f4390.
- Except the unused property `interfaceStateSuspended` is still removed (this is a memory saver).
* Shrink ASDisplayNode from 1088 to 976 bytes, reduction of 11.48%
These objects accumulate in the heap, so reducing their size will allow more to accumulate before memory warnings.
Group the `BOOL`s into a struct. Shrink the various stored `enum`s to fit the size of their contents. Move the ivars around so that the smaller `enum` are near eachother and the bitfield struct.
* Forgot to bit-field-ify placeholderEnable; new small size is 968, old size is 1072 (measured consistentlyl on iPhoneSE simulator). 10.74% reduction.
* Make sure all ASDisplayNodes have backing ivars for consistency.
Found this by enabling #pragma clang diagnostic error "-Wobjc-missing-property-synthesis" for ASDisplayNode. One property is unused, saving 8 bytes of heap space per instance on 64-bit builds. Implement setter/getters for these properties, and add appropriate locking. add the warning as error to the build for this file.
* Remove ASEventLog. We'll focus on ASLog for the future, possibly making it triggerable on a per-node basis
* See ya!
* Hello semicolon
* Remove refs to gone tree methods
* Fix
* Remove irrelevant change, kick CI
* Clean up
* Add layer-action support to nodes, unify hierarchy notifications on it
* Better pending state
* Fix bool
* Skip extra copy
* Never run default actions
* Continue the search
* Rename ASDN C++ namespace to "AS." Referring to the framework as ASDisplayNode is pretty out-dated and verbose. See CoreAnimation which usees CA for their internal namespace.
More using
* More cases
* Optimize ASCATransactionQueue. This queue is very busy, and it runs on the main thread so it's important for it to be fast.
Avoid waking up the run loop for every single node.
Avoid a ton of NSPointerArray overhead that we don't need.
Avoid retain/release traffic on the singleton by using an inline function. I confirmed that in release mode, the static __strong is correctly inlined and no ARC traffic is incurred.
* Comment
* Unlock right
* Remove magic number
* Lock up to yogaRoot during layout to avoid dead lock.
1) lock to root for tree
2) lock self to change parent (& consequently root)
3) Implement ASLocking (tryLock) on ASNodeController
4) add lockPair to try-lock node & controller together
5) lock controllers if they exist in lockToRoot...
Disable some asserts due to lock to root. :(
LL# No commands remaining.
* Add macro so non-Yoga still builds :)
* wut
* Improve separation of code for layout method types
* Address PR comments
- Delegate to layout spec engine if the node is a layout spec node but yoga engine was asked for calculate the layout
- Change ASLayoutType to ASLayoutEngineType
- Improve layout engine fall through code
https://github.com/TextureGroup/Texture/pull/886 enforces that some nodes are loaded before they are sent a visiblity event, but it was not propagating the trait collection before forcing the load.
We are propagating traits in `_setSupernode:` (which was happening after the forced load). I moved the possible forced load to `_setSupernode:`, after propagating traits but before any visibility states are changed.