Skip to content

Commit

Permalink
Merge branch 'release-candidate' into stable
Browse files Browse the repository at this point in the history
  • Loading branch information
yarneo committed May 24, 2018
2 parents 81f26ee + d32136d commit 5886bf1
Show file tree
Hide file tree
Showing 8 changed files with 317 additions and 167 deletions.
90 changes: 90 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,93 @@
# 2.5.0

There is now a new `NSDictionary` property in `CBCNode` called metadata. It is meant to store all the information regarding an example
rather than using separate methods as previously done. With that said, we offer backwards compatibility and still allow the usage of methods to provide example information.

Before:
```
+ (NSArray *)catalogBreadcrumbs {
return @[ @"Activity Indicator", @"Activity Indicator" ];
}
+ (NSString *)catalogDescription {
return @"Activity Indicator is a visual indication of an app loading content. It can display how "
@"long an operation will take or visualize an unspecified wait time.";
}
+ (BOOL)catalogIsPrimaryDemo {
return YES;
}
+ (BOOL)catalogIsPresentable {
return YES;
}
```

After:
```
+ (NSDictionary *)catalogMetadata {
return @{@"breadcrumbs": @[ @"Activity Indicator", @"Activity Indicator" ],
@"description": @"Activity Indicator is a visual indication of an app loading content. It can display how "
@"long an operation will take or visualize an unspecified wait time.",
@"primaryDemo": @YES,
@"presentable": @YES};
}
```

## Source changes

* [added a new metadata property that will hold all the key/values for that node. Also code refactoring (#27)](https://github.com/material-foundation/cocoapods-catalog-by-convention/commit/6c44e443e98bb87c955663c45c1245921338de1e) (Yarden Eitan)

## API changes

#### CBCBreadcrumbs

*new* constant: `CBCBreadcrumbs`

#### CBCNode

*new* property: `metadata` in `CBCNode`

*removed* property: `nodeDescription` in `CBCNode`

*modified* method: `-exampleDescription` in `CBCNode`

| Type of change: | Swift declaration |
|---|---|
| From: | `func exampleDescription() -> String` |
| To: | `func exampleDescription() -> String?` |

*modified* method: `-exampleDescription` in `CBCNode`

| Type of change: | Declaration |
|---|---|
| From: | `- (nonnull NSString *)exampleDescription;` |
| To: | `- (nullable NSString *)exampleDescription;` |

#### CBCRelatedInfo

*new* constant: `CBCRelatedInfo`

#### CBCIsDebug

*new* constant: `CBCIsDebug`

#### CBCIsPresentable

*new* constant: `CBCIsPresentable`

#### CBCIsPrimaryDemo

*new* constant: `CBCIsPrimaryDemo`

#### CBCDescription

*new* constant: `CBCDescription`

#### CBCStoryboardName

*new* constant: `CBCStoryboardName`

# 2.4.1

Add `exampleRelatedInfo` to the CBCNode header for external invocation.
Expand Down
2 changes: 1 addition & 1 deletion CatalogByConvention.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "CatalogByConvention"
s.version = "2.4.1"
s.version = "2.5.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"
Expand Down
10 changes: 5 additions & 5 deletions example/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ EXTERNAL SOURCES:
:path: components/Resistor

SPEC CHECKSUMS:
CatalogByConvention: 1df2d770271921f668a99245c7c4c129e78941ee
CatalogExamples: cafe3e4eae3abc948d96beb626657455c1dfb327
CatalogUnitTests: b7a746f12abb31a905654521ee926ea007ab7275
Resistor: 36a9ae98666be3b4f34d8133fad442fa87fdbce2
CatalogByConvention: f4b95f8905470807a5022eabd1d3d9ce07f6a66f
CatalogExamples: 7a95e6ea7befbd43c5ceb1427a9b161f6d8fc34e
CatalogUnitTests: 2fbf7f2e894dd3777f11573a7a5314adb1e4fad7
Resistor: a17e39cab5f42993c2b3ede22ce3829b707a9ac8

PODFILE CHECKSUM: bb59c09c71f8777bbe79af5ae920e3d58849ab41

COCOAPODS: 1.3.1
COCOAPODS: 1.4.0
30 changes: 21 additions & 9 deletions src/CBCCatalogExample.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,35 +25,47 @@
*/
@protocol CBCCatalogExample <NSObject>

/**
Returns a dictionary with metaata information for the example.
*/
+ (nonnull NSDictionary<NSString *, NSObject *> *)catalogMetadata;

@optional

/** Return a list of breadcrumbs defining the navigation path taken to reach this example. */
+ (nonnull NSArray<NSString *> *)catalogBreadcrumbs;
+ (nonnull NSArray<NSString *> *)catalogBreadcrumbs
__attribute__((deprecated("use catalogMetadata[CBCBreadcrumbs] instead.")));

/**
Return a BOOL stating whether this example should be treated as the primary demo of the component.
*/
+ (BOOL)catalogIsPrimaryDemo;
+ (BOOL)catalogIsPrimaryDemo
__attribute__((deprecated("use catalogMetadata[CBCIsPrimaryDemo] instead.")));;

/**
Return a BOOL stating whether this example is presentable and should be part of the catalog app.
*/
+ (BOOL)catalogIsPresentable;
+ (BOOL)catalogIsPresentable
__attribute__((deprecated("use catalogMetadata[CBCIsPresentable] instead.")));

/**
Return a BOOL stating whether this example is in debug mode and should appear as the initial view controller.
*/
+ (BOOL)catalogIsDebug;

@optional
+ (BOOL)catalogIsDebug
__attribute__((deprecated("use catalogMetadata[CBCIsDebug] instead.")));

/**
Return the name of a UIStoryboard from which the example's view controller should be instantiated.
*/
- (nonnull NSString *)catalogStoryboardName;
- (nonnull NSString *)catalogStoryboardName
__attribute__((deprecated("use catalogMetadata[CBCStoryboardName] instead.")));

/** Return a description of the example. */
- (nonnull NSString *)catalogDescription;
- (nonnull NSString *)catalogDescription
__attribute__((deprecated("use catalogMetadata[CBCDescription] instead.")));

/** Return a link to related information or resources. */
- (nonnull NSURL *)catalogRelatedInfo;
- (nonnull NSURL *)catalogRelatedInfo
__attribute__((deprecated("use catalogMetadata[CBCRelatedInfo] instead.")));

@end
27 changes: 23 additions & 4 deletions src/CBCNodeListViewController.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,21 @@

#import <UIKit/UIKit.h>

/** This key represents a strings array of the breadcrumbs showing the hierarchy of the example */
FOUNDATION_EXTERN NSString *_Nonnull const CBCBreadcrumbs;
/** This key represents a boolean value if the example is for debugging */
FOUNDATION_EXTERN NSString *_Nonnull const CBCIsDebug;
/** This key represents a string for the description for the example */
FOUNDATION_EXTERN NSString *_Nonnull const CBCDescription;
/** This key represents a boolean value if to present the example in the Catalog app or not */
FOUNDATION_EXTERN NSString *_Nonnull const CBCIsPresentable;
/** This key represents a boolean value if the example is the primary demo */
FOUNDATION_EXTERN NSString *_Nonnull const CBCIsPrimaryDemo;
/** This key represents an NSURL value providing related info for the example */
FOUNDATION_EXTERN NSString *_Nonnull const CBCRelatedInfo;
/** This key represents a string value of the storyboard name for the example */
FOUNDATION_EXTERN NSString *_Nonnull const CBCStoryboardName;

@class CBCNode;

/**
Expand Down Expand Up @@ -69,9 +84,6 @@ FOUNDATION_EXTERN CBCNode *_Nonnull CBCCreatePresentableNavigationTree(void);
/** The title for this node. */
@property(nonatomic, copy, nonnull, readonly) NSString *title;

/** The description for this node. */
@property(nonatomic, copy, nonnull, readonly) NSString *nodeDescription;

/** The children of this node. */
@property(nonatomic, strong, nonnull) NSArray<CBCNode *> *children;

Expand All @@ -83,6 +95,13 @@ FOUNDATION_EXTERN CBCNode *_Nonnull CBCCreatePresentableNavigationTree(void);
*/
@property(nonatomic, strong, nullable) CBCNode *debugLeaf;

/**
This NSDictionary holds all the metadata related to this CBCNode.
If it is an example noe, a primary demo, related info,
if presentable in Catalog, etc.
*/
@property(nonatomic, strong, nonnull) NSDictionary *metadata;

/** Returns YES if this is an example node. */
- (BOOL)isExample;

Expand Down Expand Up @@ -111,7 +130,7 @@ FOUNDATION_EXTERN CBCNode *_Nonnull CBCCreatePresentableNavigationTree(void);
Check that isExample returns YES before invoking.
*/
- (nonnull NSString *)exampleDescription;
- (nullable NSString *)exampleDescription;

/** Returns a link to related information for the example. */
- (nullable NSURL *)exampleRelatedInfo;
Expand Down
Loading

0 comments on commit 5886bf1

Please sign in to comment.