2

I tried to initialize a UICollectionView:

import UIKit
import PlaygroundSupport

let collectionView = UICollectionView(frame: CGRect(x: 0, y: 0, width: 100, height: 100))

But all I'm getting is

error: Execution is interrupted, reason: signal SIGBART

1 Answer 1

9

To initialize a UICollectionView use init(frame: CGRect, collectionViewLayout: UICollectionViewLayout), check Apple Doc:

let collectionView = UICollectionView(frame: CGRect(x: 0, y: 0, width: 100, height: 100), collectionViewLayout: UICollectionViewFlowLayout())
Sign up to request clarification or add additional context in comments.

2 Comments

That was simple, how could I missed that! Thanks dude
Without including the collectionViewLayout, this crashed playgrounds so hard for me it showed the homescreen of the simulator running the live view!

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.