import UIKit
import AsyncDisplayKit

extension WallController: ASCollectionViewDataSource {

  public func numberOfSectionsInCollectionView(collectionView: UICollectionView) -> Int {
    return 1
  }

  public func collectionView(collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
    return posts.count
  }

  public func collectionView(collectionView: ASCollectionView!, nodeForItemAtIndexPath indexPath: NSIndexPath!) -> ASCellNode! {
    var CellClass = config.wall.post.CellClass
    var index = indexPath.row

    if let post = post {
      CellClass = indexPath.row > 0
        ? config.wall.comment.CellClass
        : config.wall.post.CellClass
      index = indexPath.row > 0 ? indexPath.row - 1 : 0
    }

    return CellClass(
      post: self.posts[indexPath.row].wallModel,
      index: index,
      width: collectionView.frame.width,
      delegate: self)
  }
}

import UIKit
import AsyncDisplayKit

extension WallController: ASCollectionViewDataSource {

  public func numberOfSectionsInCollectionView(collectionView: UICollectionView) -> Int {
    return 1
  }

  public func collectionView(collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
    return posts.count
  }

  public func collectionView(collectionView: ASCollectionView!, nodeForItemAtIndexPath indexPath: NSIndexPath!) -> ASCellNode! {
    let cellNode: ASCellNode

    if let post = post {
      if indexPath.row > 0 {
        cellNode = CommentCellNode(
          post: posts[indexPath.row].wallModel,
          index: indexPath.row - 1,
          width: collectionView.frame.width,
          delegate: self)
      } else {
        cellNode = PostCellNode(
          post: posts[indexPath.row].wallModel,
          index: 0,
          width: collectionView.frame.width,
          delegate: self)
      }
    } else {
      cellNode = PostCellNode(
        post: posts[indexPath.row].wallModel,
        index: indexPath.row,
        width: collectionView.frame.width,
        delegate: self)
    }

    return cellNode
  }
}

--- 
+++ 
@@ -12,30 +12,20 @@
   }
 
   public func collectionView(collectionView: ASCollectionView!, nodeForItemAtIndexPath indexPath: NSIndexPath!) -> ASCellNode! {
-    let cellNode: ASCellNode
+    var CellClass = config.wall.post.CellClass
+    var index = indexPath.row
 
     if let post = post {
-      if indexPath.row > 0 {
-        cellNode = CommentCellNode(
-          post: posts[indexPath.row].wallModel,
-          index: indexPath.row - 1,
-          width: collectionView.frame.width,
-          delegate: self)
-      } else {
-        cellNode = PostCellNode(
-          post: posts[indexPath.row].wallModel,
-          index: 0,
-          width: collectionView.frame.width,
-          delegate: self)
-      }
-    } else {
-      cellNode = PostCellNode(
-        post: posts[indexPath.row].wallModel,
-        index: indexPath.row,
-        width: collectionView.frame.width,
-        delegate: self)
+      CellClass = indexPath.row > 0
+        ? config.wall.comment.CellClass
+        : config.wall.post.CellClass
+      index = indexPath.row > 0 ? indexPath.row - 1 : 0
     }
 
-    return cellNode
+    return CellClass(
+      post: self.posts[indexPath.row].wallModel,
+      index: index,
+      width: collectionView.frame.width,
+      delegate: self)
   }
 }
Create instance of class from the config in data source
