Skip to content

Commit

Permalink
update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
jwilling committed May 27, 2016
1 parent aab9e56 commit 540b591
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
![](http://jwilling.com/serve/github/jnwcollectionview/title.png)

---

**Important Note:**
> With the release of OS X 10.11, Apple introduced a new version of `NSCollectionView` with an API similar to `UICollectionView`. I recommend using `NSCollectionView` for any new 10.11+ projects. This library remains a resource for projects needing backwards compatibility. This project has been soft-deprecated.
---


`JNWCollectionView` is a modern collection view for the Mac with an extremely flexible API. Cells are dequeued and memory usage is kept at a minimum. The collection view is layer-backed by default, and performance is highly optimized.

Anyone familiar with `UICollectionView` should feel right at home with `JNWCollectionView`. Like `UICollectionView`, `JNWCollectionView` uses the concept of a layout class for determining how items should be displayed onscreen.
Expand Down Expand Up @@ -45,7 +53,7 @@ collectionView.dataSource = self;
`JNWCollectionView` does not automatically pick a layout class. Two layout classes are included (and will be described later). For this example, lets pick the grid layout. However, the layout class is designed to be subclassed so you are not limited to the built-in layouts.

```objc
JNWCollectionViewGridLayout *gridLayout = [[JNWCollectionViewGridLayout alloc] initWithCollectionView:collectionView];
JNWCollectionViewGridLayout *gridLayout = [[JNWCollectionViewGridLayout alloc] init];

// The grid layout has its own delegate, so if we want to implement the delegate methods
// we need to conform to JNWCollectionViewGridLayoutDelegate.
Expand Down Expand Up @@ -91,6 +99,9 @@ You now have a fully-functioning collection view. But that's just scratching the

### What makes this better than NSCollectionView / NSTableView? ###

**Important Note:**
> The following comments about `NSCollectionView` do not apply to the new version of `NSCollectionView` introduced by Apple in 10.11. The downsides mentioned below are no longer relevant.
`NSCollectionView` is sadly neglected. `NSCollectionView` does not attempt to reuse cells at all, meaning it will every single cell, even if it's not onscreen. It cannot handle being layer-backed, and therefore scrolling performance is terrible. It is not very customizable.

`NSTableView` is (still) a well designed class, however it is not perfect. For example, in newer versions of OS X, it forces Auto Layout to be enabled. It is not very easy to customize, and its support for legacy brings a lot of baggage along with the current API. Although scrolling performance is quite good, it can be improved upon.
Expand Down

0 comments on commit 540b591

Please sign in to comment.