diff --git a/_docs/containers-astablenode.md b/_docs/containers-astablenode.md index 8155135d..13b651d0 100755 --- a/_docs/containers-astablenode.md +++ b/_docs/containers-astablenode.md @@ -35,20 +35,39 @@ Consider, again, the ASViewController subclass - PhotoFeedNodeController - from An `ASTableNode` is assigned to be managed by an `ASViewController` in its `initWithNode:` designated initializer method. -```objective-c +
+SwiftObjective-C +
+
 - (instancetype)init
 {
-  _tableNode = [[ASTableNode alloc] initWithStyle:UITableViewStylePlain];
-  self = [super initWithNode:_tableNode];
-  
-  if (self) {
-    _tableNode.dataSource = self;
-    _tableNode.delegate = self;
-  }
-  
-  return self;
+    _tableNode = [[ASTableNode alloc] initWithStyle:UITableViewStylePlain];
+    self = [super initWithNode:_tableNode];
+    
+    if (self) {
+      _tableNode.dataSource = self;
+      _tableNode.delegate = self;
+    }
+    
+    return self;
 }
-```
+  
+ + +
+
##Node Block Thread Safety Warning## @@ -58,21 +77,44 @@ Consider the following `tableView:nodeBlockForRowAtIndexPath:` method from the ` In the example below, you can see how the index is used to access the photo model before creating the node block. -```objective-c +
+SwiftObjective-C +
+
 - (ASCellNodeBlock)tableView:(ASTableView *)tableView nodeBlockForRowAtIndexPath:(NSIndexPath *)indexPath
 {
-  PhotoModel *photoModel = [_photoFeed objectAtIndex:indexPath.row];
-  
-  // this may be executed on a background thread - it is important to make sure it is thread safe
-  ASCellNode *(^ASCellNodeBlock)() = ^ASCellNode *() {
-    PhotoCellNode *cellNode = [[PhotoCellNode alloc] initWithPhotoObject:photoModel];
-    cellNode.delegate = self;
-    return cellNode;
-  };
-  
-  return ASCellNodeBlock;
+    PhotoModel *photoModel = [_photoFeed objectAtIndex:indexPath.row];
+    
+    // this may be executed on a background thread - it is important to make sure it is thread safe
+    ASCellNode *(^ASCellNodeBlock)() = ^ASCellNode *() {
+        PhotoCellNode *cellNode = [[PhotoCellNode alloc] initWithPhoto:photoModel];
+        cellNode.delegate = self;
+        return cellNode;
+    };
+    
+    return ASCellNodeBlock;
 }
-```
+  
+ + +
+
+ ##Accessing the ASTableView## If you've used previous versions of ASDK, you'll notice that `ASTableView` has been removed in favor of `ASTableNode`. diff --git a/_docs/containers-asviewcontroller.md b/_docs/containers-asviewcontroller.md index 09b48bbb..218fdbe6 100755 --- a/_docs/containers-asviewcontroller.md +++ b/_docs/containers-asviewcontroller.md @@ -19,7 +19,10 @@ Consider the following `ASViewController` subclass `PhotoFeedNodeController` fro This table node is assigned to the `ASViewController` in its `initWithNode:` designated initializer method. -```objective-c +
+SwiftObjective-C +
+
 - (instancetype)init
 {
   _tableNode = [[ASTableNode alloc] initWithStyle:UITableViewStylePlain];
@@ -32,7 +35,24 @@ This table node is assigned to the `ASViewController` in its `initWithNode:` des
   
   return self;
 }
-```
+  
+ + +
+
If your app already has a complex view controller hierarchy, it is perfectly fine to have all of them subclass `ASViewController`. That is to say, even if you don't use `ASViewController`'s designated initializer `initiWithNode:`, and only use the `ASViewController` in the manner of a traditional `UIVieWController`, this will give you the additional node support if you choose to adopt it in different areas your application. diff --git a/static/main.css b/static/main.css index 7c403dbd..637ea55c 100755 --- a/static/main.css +++ b/static/main.css @@ -769,4 +769,5 @@ body { .code { padding-left: 20px; padding-bottom: 10px; + overflow: auto; }