我尝试初始化UICollectionView:
import UIKit
import PlaygroundSupport
let collectionView = UICollectionView(frame: CGRect(x: 0, y: 0, width: 100, height: 100))
但我得到的只是
error: Execution is interrupted, reason: signal SIGBART
答案 0 :(得分:4)
要使用init(frame: CGRect, collectionViewLayout: UICollectionViewLayout)
初始化UICollectionView,请检查Apple Doc:
let collectionView = UICollectionView(frame: CGRect(x: 0, y: 0, width: 100, height: 100), collectionViewLayout: UICollectionViewFlowLayout())