我尝试初始化一个 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
最佳答案
要初始化 UICollectionView 使用 init(frame: CGRect, collectionViewLayout: UICollectionViewLayout)
,勾选 Apple Doc:
let collectionView = UICollectionView(frame: CGRect(x: 0, y: 0, width: 100, height: 100), collectionViewLayout: UICollectionViewFlowLayout())
关于swift - 无法在 Xcode Playgrounds 中初始化 UICollectionView,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49295055/