diff --git a/CHANGELOG.md b/CHANGELOG.md index 41169a2..f096442 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,13 @@ +# 2.4.0 + +- Now you can add the method `catalogRelatedInfo` that returns an NSURL to your example, if you wish to link to related information and resources. +- A performance improvement when fetching all viable classes to build the navigation tree. + +## Source changes + +* [Add "related info" URLs to examples (#24)](https://github.com/material-foundation/cocoapods-catalog-by-convention/commit/ee57bf7bb544b105c5d91aaa2ef348d0f663a690) (Adrian Secord) +* [[Runtime] Only select UIViewController subclasses (#22)](https://github.com/material-foundation/cocoapods-catalog-by-convention/commit/ce864aabf505978a3933a93bfcf048f5d41bc071) (Robert Moore) + # 2.3.1 minor bug fix introduced in 2.3.0 that returns wrong boolean values. diff --git a/CatalogByConvention.podspec b/CatalogByConvention.podspec index 3b99b11..7560cc8 100644 --- a/CatalogByConvention.podspec +++ b/CatalogByConvention.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "CatalogByConvention" - s.version = "2.3.1" + s.version = "2.4.0" s.authors = "Google Inc." s.summary = "Tools for building a Catalog by Convention." s.homepage = "https://github.com/material-foundation/cocoapods-catalog-by-convention" diff --git a/example/Podfile.lock b/example/Podfile.lock index e3a52b1..93973d6 100644 --- a/example/Podfile.lock +++ b/example/Podfile.lock @@ -1,5 +1,5 @@ PODS: - - CatalogByConvention (2.2.0) + - CatalogByConvention (2.3.1) - CatalogExamples (1.0.0) - CatalogUnitTests (1.0.0): - Resistor @@ -22,7 +22,7 @@ EXTERNAL SOURCES: :path: components/Resistor SPEC CHECKSUMS: - CatalogByConvention: 5df5831e48b8083b18570dcb804f20fd1c90694f + CatalogByConvention: 1df2d770271921f668a99245c7c4c129e78941ee CatalogExamples: cafe3e4eae3abc948d96beb626657455c1dfb327 CatalogUnitTests: b7a746f12abb31a905654521ee926ea007ab7275 Resistor: 36a9ae98666be3b4f34d8133fad442fa87fdbce2 diff --git a/src/CBCCatalogExample.h b/src/CBCCatalogExample.h index 564c790..31deb60 100644 --- a/src/CBCCatalogExample.h +++ b/src/CBCCatalogExample.h @@ -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 diff --git a/src/CBCNodeListViewController.m b/src/CBCNodeListViewController.m index 76f5afd..e7f5f84 100644 --- a/src/CBCNodeListViewController.m +++ b/src/CBCNodeListViewController.m @@ -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); } diff --git a/src/private/CBCRuntime.h b/src/private/CBCRuntime.h index d7ccdc6..aad0663 100644 --- a/src/private/CBCRuntime.h +++ b/src/private/CBCRuntime.h @@ -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 /** diff --git a/src/private/CBCRuntime.m b/src/private/CBCRuntime.m index 044bfa8..738748a 100644 --- a/src/private/CBCRuntime.m +++ b/src/private/CBCRuntime.m @@ -94,6 +94,9 @@ BOOL CBCCatalogIsDebugLeaf(Class aClass) { if (hasIgnoredPrefix) { continue; } + if (![aClass isSubclassOfClass:[UIViewController class]]) { + continue; + } [classes addObject:aClass]; } @@ -135,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) {