@@ -29,14 +29,14 @@ class ViewController: NSViewController {
2929
3030 let layout = NSCollectionViewFlowLayout ( )
3131 layout. itemSize = NSSize ( width: 300.0 , height: 150.0 )
32- layout. sectionInset = EdgeInsets ( top: 10.0 , left: 20.0 , bottom: 10.0 , right: 20.0 )
32+ layout. sectionInset = NSEdgeInsets ( top: 10.0 , left: 20.0 , bottom: 10.0 , right: 20.0 )
3333 layout. minimumInteritemSpacing = 4.0
3434 layout. minimumLineSpacing = 4.0
3535 collectionView. collectionViewLayout = layout
3636
3737 collectionView. layer? . backgroundColor = NSColor . black. cgColor
38-
39- collectionView . register ( NSNib ( nibNamed : " Cell " , bundle : nil ) , forItemWithIdentifier: " Cell " )
38+ collectionView . register ( NSNib ( nibNamed : NSNib . Name ( rawValue : " Cell " ) , bundle : nil ) ! ,
39+ forItemWithIdentifier: NSUserInterfaceItemIdentifier ( rawValue : " Cell " ) )
4040 }
4141}
4242
@@ -52,11 +52,11 @@ extension ViewController: NSCollectionViewDataSource {
5252
5353 func collectionView( _ collectionView: NSCollectionView , itemForRepresentedObjectAt indexPath: IndexPath ) -> NSCollectionViewItem {
5454
55- let item = collectionView. makeItem ( withIdentifier: " Cell " , for: indexPath)
55+ let item = collectionView. makeItem ( withIdentifier: NSUserInterfaceItemIdentifier ( rawValue : " Cell " ) , for: indexPath)
5656 guard let cell = item as? Cell else { return item }
5757
5858 let value = values [ ( indexPath as NSIndexPath ) . item]
59- cell. imageView? . setImage ( url: value, placeholder: Image ( named: " placeholder " ) )
59+ cell. imageView? . setImage ( url: value, placeholder: Image ( named: NSImage . Name ( rawValue : " placeholder " ) ) )
6060
6161 return cell
6262 }
0 commit comments