ASScrollNode > automaticallyManagesContentSize causes issues with Node sizes
Hi there
Issue
I am having issues with Nodes not showing up in my ASScrollNode when running on a physical device.
This project exists for a while and ran fine on Xcode v11, iOS 13 and before.
This issue does not occur on a Simulator, only on a physical device.
My Specs Xcode Version 12.0.1 (12A7300) Texture 3.0.0
Running on: iOS 14.0.1
My Code
I am instantiating a ASDKViewController<ASScrollNode> and configuring the ASScrollNode:
override init() {
super.init(node: mainNode)
setMainNode()
}
private func setMainNode() {
mainNode.automaticallyManagesSubnodes = true
mainNode.automaticallyRelayoutOnSafeAreaChanges = true
mainNode.automaticallyManagesContentSize = true
if #available(iOS 13.0, *) {
mainNode.view.automaticallyAdjustsScrollIndicatorInsets = false
}
mainNode.backgroundColor = Style.ColorStyle.viewBackground.color
mainNode.layoutSpecBlock = { [weak self] node, size in
guard let strongSelf = self else { return ASLayoutSpec() }
let contentStack = ASStackLayoutSpec(direction: .vertical, spacing: 8, justifyContent: .start, alignItems: .start, children: [strongSelf.myObjectsButton, strongSelf.staticsHeaderNode])
if let statistics = strongSelf.statics {
contentStack.children!.append(contentsOf: statistics.nodes)
}
contentStack.style.preferredLayoutSize.height = .max
contentStack.style.preferredLayoutSize.width = .max
let contentInsets = ASInsetLayoutSpec(insets: UIEdgeInsets(top: 0, left: 16, bottom: 200, right: 16), child: contentStack)
contentInsets.style.preferredLayoutSize = ASLayoutSize(width: .max, height: .max)
let contentBackground = ASBackgroundLayoutSpec(child: contentInsets, background: strongSelf.statisticsBackground)
let finalContent = ASStackLayoutSpec(direction: .vertical, spacing: 8, justifyContent: .start, alignItems: .start, children: [strongSelf.header, contentBackground])
finalContent.style.preferredLayoutSize.width = .max
return ASInsetLayoutSpec(insets: UIEdgeInsets(top: node.safeAreaInsets.top, left: 0, bottom: 0, right: 0), child: finalContent)
}
}
This renders the view fine on a simulator. However, when running on a device, the statistics.nodes don't show.
Playing around with the scroll node, the issue of the 'not showing' nodes resolves when I comment out, or not set:
mainNode.automaticallyManagesContentSize = true
This causes another issue, that my view's contentSize is set to zero, but the nodes do show. Not sure what's going wrong in this version of Texture.
Screenshots of the simulator and device, running the same code:
Simulator screenshot

Device

Posting here because we've seen this issue as well. Seems to happen since iOS 14, and in our case it only happens on optimized builds
We have worked around this for now by forcing Texture to build with no optimizations:
# Podfile
# ...
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
# remove when this issue is fixed: https://github.com/TextureGroup/Texture/issues/1926
if 'Texture' == target.name
config.build_settings['GCC_OPTIMIZATION_LEVEL'] = '0'
end
end
end
end
We have worked around this for now by forcing Texture to build with no optimizations:
# Podfile # ... post_install do |installer| installer.pods_project.targets.each do |target| target.build_configurations.each do |config| # remove when this issue is fixed: https://github.com/TextureGroup/Texture/issues/1926 if 'Texture' == target.name config.build_settings['GCC_OPTIMIZATION_LEVEL'] = '0' end end end end
Great workaround for now, thanks! Optimization shouldn't change the modules behaviour though. iOS 14 bug rather then a Texture bug?
We have worked around this for now by forcing Texture to build with no optimizations:
# Podfile # ... post_install do |installer| installer.pods_project.targets.each do |target| target.build_configurations.each do |config| # remove when this issue is fixed: https://github.com/TextureGroup/Texture/issues/1926 if 'Texture' == target.name config.build_settings['GCC_OPTIMIZATION_LEVEL'] = '0' end end end end
this one save my project
Maybe, I can investigate this issue if I get a small project which reproduces this issue.