-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Docs: Fix references of ASViewController/ASNavigationController (non-existent) to ASDKViewController/ASDKNavigationController #2072
Merged
garrettmoon
merged 3 commits into
TextureGroup:master
from
JoeFerrucci:joe/docs-update-1
Apr 5, 2023
Merged
Changes from 2 commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
--- | ||
title: ASDKViewController | ||
layout: docs | ||
permalink: /docs/containers-asdkviewcontroller.html | ||
prevPage: asrunloopqueue.html | ||
nextPage: containers-asnodecontroller.html | ||
--- | ||
|
||
`ASDKViewController` is a subclass of `UIViewController` that adds several useful features for hosting `ASDisplayNode` hierarchies. | ||
|
||
An `ASDKViewController` can be used in place of any `UIViewController` - including within a `UINavigationController`, `UITabBarController` and `UISplitViewController` or as a modal view controller. | ||
|
||
Benefits of using an `ASDKViewController`: | ||
<ol> | ||
<li><b>Save Memory</b>. An <code>ASDKViewController</code> that goes off screen will automatically reduce the size of the <a href="intelligent-preloading.html">fetch data</a> and <a href="intelligent-preloading.html">display ranges</a> of any of its children. This is key for memory management in large applications. </li> | ||
<li><b><a href="asvisibility.html"><code>ASVisibility</code></a> Feature</b>. When used in an <code>ASNavigationController</code> or <code>ASTabBarController</code>, these classes know the exact number of user taps it would take to make the view controller visible.</li> | ||
</ol> | ||
|
||
More features will be added over time, so it is a good idea to base your view controllers off of this class. | ||
|
||
## Usage | ||
|
||
A `UIViewController` provides a view of its own. An `ASDKViewController` is assigned a node to manage in its designated initializer `-initWithNode:`. | ||
|
||
Consider the following `ASDKViewController` subclass, `PhotoFeedNodeController`, from the <a href="https://github.com/texturegroup/texture/tree/master/examples/ASDKgram">ASDKgram example project</a> that would like to use a table node as its managed node. | ||
|
||
This table node is assigned to the `ASDKViewController` in its `-initWithNode:` designated initializer method. | ||
|
||
<div class = "highlight-group"> | ||
<span class="language-toggle"><a data-lang="swift" class="swiftButton">Swift</a><a data-lang="objective-c" class = "active objcButton">Objective-C</a></span> | ||
<div class = "code"> | ||
<pre lang="objc" class="objcCode"> | ||
- (instancetype)init | ||
{ | ||
_tableNode = [[ASTableNode alloc] initWithStyle:UITableViewStylePlain]; | ||
self = [super initWithNode:_tableNode]; | ||
|
||
if (self) { | ||
_tableNode.dataSource = self; | ||
_tableNode.delegate = self; | ||
} | ||
|
||
return self; | ||
} | ||
</pre> | ||
|
||
<pre lang="swift" class = "swiftCode hidden"> | ||
init(models: [Model]) { | ||
let tableNode = ASTableNode(style: .plain) | ||
|
||
super.init(node: tableNode) | ||
|
||
self.models = models | ||
|
||
self.tableNode = tableNode | ||
self.tableNode.delegate = self | ||
self.tableNode.dataSource = self | ||
} | ||
</pre> | ||
</div> | ||
</div> | ||
|
||
<br> | ||
<div class = "note"> | ||
<b>Conversion Tip</b>: If your app already has a complex view controller hierarchy, it is perfectly fine to have all of them subclass <code>ASDKViewController</code>. That is to say, even if you don't use <code>ASDKViewController</code>'s designated initializer <code>-initWithNode:</code>, and only use the <code>ASDKViewController</code> in the manner of a traditional <code>UIViewController</code>, this will give you the additional node support if you choose to adopt it in different areas your application. | ||
</div> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ASDKNavigationController
, notASNavigationController
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was just for ASDKViewController but I can update it to change ASDKNavigationController as well. Thanks.