Skip to content

Commit ee57bf7

Browse files
authored
Add "related info" URLs to examples (#24)
* Added related info URL. * Remove example related info links, we're not using them.
1 parent ce864aa commit ee57bf7

File tree

5 files changed

+21
-2
lines changed

5 files changed

+21
-2
lines changed

example/Podfile.lock

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
PODS:
2-
- CatalogByConvention (2.2.0)
2+
- CatalogByConvention (2.3.1)
33
- CatalogExamples (1.0.0)
44
- CatalogUnitTests (1.0.0):
55
- Resistor
@@ -22,7 +22,7 @@ EXTERNAL SOURCES:
2222
:path: components/Resistor
2323

2424
SPEC CHECKSUMS:
25-
CatalogByConvention: 5df5831e48b8083b18570dcb804f20fd1c90694f
25+
CatalogByConvention: 1df2d770271921f668a99245c7c4c129e78941ee
2626
CatalogExamples: cafe3e4eae3abc948d96beb626657455c1dfb327
2727
CatalogUnitTests: b7a746f12abb31a905654521ee926ea007ab7275
2828
Resistor: 36a9ae98666be3b4f34d8133fad442fa87fdbce2

src/CBCCatalogExample.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,4 +53,7 @@
5353
/** Return a description of the example. */
5454
- (nonnull NSString *)catalogDescription;
5555

56+
/** Return a link to related information or resources. */
57+
- (nonnull NSURL *)catalogRelatedInfo;
58+
5659
@end

src/CBCNodeListViewController.m

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,11 @@ - (NSString *)exampleDescription {
8585
return CBCDescriptionFromClass(_exampleClass);
8686
}
8787

88+
- (NSURL *)exampleRelatedInfo {
89+
NSAssert(_exampleClass != nil, @"This node has no associated example.");
90+
return CBCRelatedInfoFromClass(_exampleClass);
91+
}
92+
8893
- (BOOL)isPrimaryDemo {
8994
return CBCCatalogIsPrimaryDemoFromClass(_exampleClass);
9095
}

src/private/CBCRuntime.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,9 @@ FOUNDATION_EXTERN UIViewController *CBCViewControllerFromClass(Class aClass);
6060
/** Create a description from the provided class. **/
6161
FOUNDATION_EXTERN NSString *CBCDescriptionFromClass(Class aClass);
6262

63+
/** Create a link to related information from the provided class. **/
64+
FOUNDATION_EXTERN NSURL *CBCRelatedInfoFromClass(Class aClass);
65+
6366
#pragma mark Fix View Debugging
6467

6568
/**

src/private/CBCRuntime.m

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,14 @@ BOOL CBCCatalogIsDebugLeaf(Class aClass) {
138138
return nil;
139139
}
140140

141+
NSURL *CBCRelatedInfoFromClass(Class aClass) {
142+
if ([aClass respondsToSelector:@selector(catalogRelatedInfo)]) {
143+
NSURL *catalogRelatedInfo = [aClass catalogRelatedInfo];
144+
return catalogRelatedInfo;
145+
}
146+
return nil;
147+
}
148+
141149
#pragma mark Fix View Debugging
142150

143151
void CBCFixViewDebuggingIfNeeded(void) {

0 commit comments

Comments
 (0)