Skip to content

Commit

Permalink
Add "related info" URLs to examples (#24)
Browse files Browse the repository at this point in the history
* Added related info URL.

* Remove example related info links, we're not using them.
  • Loading branch information
ajsecord authored Dec 21, 2017
1 parent ce864aa commit ee57bf7
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 2 deletions.
4 changes: 2 additions & 2 deletions example/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
PODS:
- CatalogByConvention (2.2.0)
- CatalogByConvention (2.3.1)
- CatalogExamples (1.0.0)
- CatalogUnitTests (1.0.0):
- Resistor
Expand All @@ -22,7 +22,7 @@ EXTERNAL SOURCES:
:path: components/Resistor

SPEC CHECKSUMS:
CatalogByConvention: 5df5831e48b8083b18570dcb804f20fd1c90694f
CatalogByConvention: 1df2d770271921f668a99245c7c4c129e78941ee
CatalogExamples: cafe3e4eae3abc948d96beb626657455c1dfb327
CatalogUnitTests: b7a746f12abb31a905654521ee926ea007ab7275
Resistor: 36a9ae98666be3b4f34d8133fad442fa87fdbce2
Expand Down
3 changes: 3 additions & 0 deletions src/CBCCatalogExample.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,7 @@
/** Return a description of the example. */
- (nonnull NSString *)catalogDescription;

/** Return a link to related information or resources. */
- (nonnull NSURL *)catalogRelatedInfo;

@end
5 changes: 5 additions & 0 deletions src/CBCNodeListViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,11 @@ - (NSString *)exampleDescription {
return CBCDescriptionFromClass(_exampleClass);
}

- (NSURL *)exampleRelatedInfo {
NSAssert(_exampleClass != nil, @"This node has no associated example.");
return CBCRelatedInfoFromClass(_exampleClass);
}

- (BOOL)isPrimaryDemo {
return CBCCatalogIsPrimaryDemoFromClass(_exampleClass);
}
Expand Down
3 changes: 3 additions & 0 deletions src/private/CBCRuntime.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@ FOUNDATION_EXTERN UIViewController *CBCViewControllerFromClass(Class aClass);
/** Create a description from the provided class. **/
FOUNDATION_EXTERN NSString *CBCDescriptionFromClass(Class aClass);

/** Create a link to related information from the provided class. **/
FOUNDATION_EXTERN NSURL *CBCRelatedInfoFromClass(Class aClass);

#pragma mark Fix View Debugging

/**
Expand Down
8 changes: 8 additions & 0 deletions src/private/CBCRuntime.m
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,14 @@ BOOL CBCCatalogIsDebugLeaf(Class aClass) {
return nil;
}

NSURL *CBCRelatedInfoFromClass(Class aClass) {
if ([aClass respondsToSelector:@selector(catalogRelatedInfo)]) {
NSURL *catalogRelatedInfo = [aClass catalogRelatedInfo];
return catalogRelatedInfo;
}
return nil;
}

#pragma mark Fix View Debugging

void CBCFixViewDebuggingIfNeeded(void) {
Expand Down

0 comments on commit ee57bf7

Please sign in to comment.