Fix CustomCollectionView-Swift sample#22
Conversation
|
@Adlai-Holler Did this change due to our initializer changes? |
|
@george-gw @maicki Could someone link to the Slack conversation about the issue, and open a GitHub issue for it? I searched around but couldn't find it. |
|
@Adlai-Holler Any thoughts on it based on the issue? Did the initializer changed due to our changes? |
|
Following up with that, this change does not have anything to do with the initializer change @Adlai-Holler did a while back. The reason looking into it bit more actually is: Another resolution would be if we would not move to required init?(coder aDecoder: NSCoder) {
let layout = MosaicCollectionViewLayout()
layout.numberOfColumns = 3;
layout.headerHeight = 44;
_collectionNode = ASCollectionNode(frame: CGRect.zero, collectionViewLayout: layout)
super.init(coder: aDecoder)
layout.delegate = self
_sections.append([]);
var section = 0
for idx in 0 ..< kNumberOfImages {
let name = String(format: "image_%d.jpg", idx)
_sections[section].append(UIImage(named: name)!)
if ((idx + 1) % 5 == 0 && idx < kNumberOfImages - 1) {
section += 1
_sections.append([])
}
}
}
override func viewDidLoad() {
super.viewDidLoad()
_collectionNode.frame = self.view.bounds;
_collectionNode.autoresizingMask = [.flexibleWidth, .flexibleHeight]
_collectionNode.dataSource = self;
_collectionNode.delegate = self;
_collectionNode.backgroundColor = UIColor.white
_collectionNode.registerSupplementaryNode(ofKind: UICollectionElementKindSectionHeader)
_collectionNode.view.isScrollEnabled = true
_collectionNode.view.layoutInspector = _layoutInspector
self.view.addSubnode(_collectionNode!)
} |
There was a problem hiding this comment.
@george-gw Thanks for fixing that. Will merge now.
The sample was crashing, the crash was reported on Slack.
This is a quick fix