Skip to content

Commit 89df4c8

Browse files
committed
[ASPagerNode] Update Swift examples.
1 parent fa43ade commit 89df4c8

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

docs/_docs/containers-aspagernode.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ The main dataSource methods are:
2020
</pre>
2121

2222
<pre lang="swift" class = "swiftCode hidden">
23-
func numberOfPagesInPagerNode(pagerNode: ASPagerNode!) -> Int
23+
func numberOfPages(in pagerNode: ASPagerNode) -> Int
2424
</pre>
2525
</div>
2626
</div>
@@ -35,7 +35,7 @@ and
3535
</pre>
3636

3737
<pre lang="swift" class = "swiftCode hidden">
38-
func pagerNode(pagerNode: ASPagerNode!, nodeAtIndex index: Int) -> ASCellNode!
38+
func pagerNode(_ pagerNode: ASPagerNode, nodeAt index: Int) -> ASCellNode
3939
</pre>
4040
</div>
4141
</div>
@@ -50,7 +50,7 @@ or
5050
</pre>
5151

5252
<pre lang="swift" class = "swiftCode hidden">
53-
func pagerNode(pagerNode: ASPagerNode!, nodeBlockAtIndex index: Int) -> ASCellNodeBlock!
53+
func pagerNode(_ pagerNode: ASPagerNode, nodeBlockAt index: Int) -> ASCellNodeBlock
5454
</pre>
5555
</div>
5656
</div>
@@ -86,8 +86,8 @@ In the example below, you can see how the index is used to access the photo mode
8686
</pre>
8787

8888
<pre lang="swift" class = "swiftCode hidden">
89-
func pagerNode(pagerNode: ASPagerNode!, nodeBlockAtIndex index: Int) -> ASCellNodeBlock! {
90-
guard photoFeed.count > index else { return nil }
89+
func pagerNode(_ pagerNode: ASPagerNode, nodeBlockAt index: Int) -> ASCellNodeBlock {
90+
guard photoFeed.count > index else { return { ASCellNode() } }
9191

9292
let photoModel = photoFeed[index]
9393
let cellNodeBlock = { () -> ASCellNode in
@@ -123,8 +123,8 @@ One especially useful pattern is to return an `ASCellNode` that is initialized w
123123
</pre>
124124

125125
<pre lang="swift" class = "swiftCode hidden">
126-
func pagerNode(pagerNode: ASPagerNode!, nodeAtIndex index: Int) -> ASCellNode! {
127-
guard animals.count > index else { return nil }
126+
func pagerNode(_ pagerNode: ASPagerNode, nodeAt index: Int) -> ASCellNode {
127+
guard animals.count > index else { return ASCellNode() }
128128

129129
let animal = animals[index]
130130
let node = ASCellNode(viewControllerBlock: { () -> UIViewController in

0 commit comments

Comments
 (0)