Skip to content

Commit 5886bf1

Browse files
committed
Merge branch 'release-candidate' into stable
2 parents 81f26ee + d32136d commit 5886bf1

File tree

8 files changed

+317
-167
lines changed

8 files changed

+317
-167
lines changed

CHANGELOG.md

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,93 @@
1+
# 2.5.0
2+
3+
There is now a new `NSDictionary` property in `CBCNode` called metadata. It is meant to store all the information regarding an example
4+
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.
5+
6+
Before:
7+
```
8+
+ (NSArray *)catalogBreadcrumbs {
9+
return @[ @"Activity Indicator", @"Activity Indicator" ];
10+
}
11+
12+
+ (NSString *)catalogDescription {
13+
return @"Activity Indicator is a visual indication of an app loading content. It can display how "
14+
@"long an operation will take or visualize an unspecified wait time.";
15+
}
16+
17+
+ (BOOL)catalogIsPrimaryDemo {
18+
return YES;
19+
}
20+
21+
+ (BOOL)catalogIsPresentable {
22+
return YES;
23+
}
24+
```
25+
26+
After:
27+
```
28+
+ (NSDictionary *)catalogMetadata {
29+
return @{@"breadcrumbs": @[ @"Activity Indicator", @"Activity Indicator" ],
30+
@"description": @"Activity Indicator is a visual indication of an app loading content. It can display how "
31+
@"long an operation will take or visualize an unspecified wait time.",
32+
@"primaryDemo": @YES,
33+
@"presentable": @YES};
34+
}
35+
```
36+
37+
## Source changes
38+
39+
* [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)
40+
41+
## API changes
42+
43+
#### CBCBreadcrumbs
44+
45+
*new* constant: `CBCBreadcrumbs`
46+
47+
#### CBCNode
48+
49+
*new* property: `metadata` in `CBCNode`
50+
51+
*removed* property: `nodeDescription` in `CBCNode`
52+
53+
*modified* method: `-exampleDescription` in `CBCNode`
54+
55+
| Type of change: | Swift declaration |
56+
|---|---|
57+
| From: | `func exampleDescription() -> String` |
58+
| To: | `func exampleDescription() -> String?` |
59+
60+
*modified* method: `-exampleDescription` in `CBCNode`
61+
62+
| Type of change: | Declaration |
63+
|---|---|
64+
| From: | `- (nonnull NSString *)exampleDescription;` |
65+
| To: | `- (nullable NSString *)exampleDescription;` |
66+
67+
#### CBCRelatedInfo
68+
69+
*new* constant: `CBCRelatedInfo`
70+
71+
#### CBCIsDebug
72+
73+
*new* constant: `CBCIsDebug`
74+
75+
#### CBCIsPresentable
76+
77+
*new* constant: `CBCIsPresentable`
78+
79+
#### CBCIsPrimaryDemo
80+
81+
*new* constant: `CBCIsPrimaryDemo`
82+
83+
#### CBCDescription
84+
85+
*new* constant: `CBCDescription`
86+
87+
#### CBCStoryboardName
88+
89+
*new* constant: `CBCStoryboardName`
90+
191
# 2.4.1
292

393
Add `exampleRelatedInfo` to the CBCNode header for external invocation.

CatalogByConvention.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Pod::Spec.new do |s|
22
s.name = "CatalogByConvention"
3-
s.version = "2.4.1"
3+
s.version = "2.5.0"
44
s.authors = "Google Inc."
55
s.summary = "Tools for building a Catalog by Convention."
66
s.homepage = "https://github.com/material-foundation/cocoapods-catalog-by-convention"

example/Podfile.lock

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,11 @@ EXTERNAL SOURCES:
2222
:path: components/Resistor
2323

2424
SPEC CHECKSUMS:
25-
CatalogByConvention: 1df2d770271921f668a99245c7c4c129e78941ee
26-
CatalogExamples: cafe3e4eae3abc948d96beb626657455c1dfb327
27-
CatalogUnitTests: b7a746f12abb31a905654521ee926ea007ab7275
28-
Resistor: 36a9ae98666be3b4f34d8133fad442fa87fdbce2
25+
CatalogByConvention: f4b95f8905470807a5022eabd1d3d9ce07f6a66f
26+
CatalogExamples: 7a95e6ea7befbd43c5ceb1427a9b161f6d8fc34e
27+
CatalogUnitTests: 2fbf7f2e894dd3777f11573a7a5314adb1e4fad7
28+
Resistor: a17e39cab5f42993c2b3ede22ce3829b707a9ac8
2929

3030
PODFILE CHECKSUM: bb59c09c71f8777bbe79af5ae920e3d58849ab41
3131

32-
COCOAPODS: 1.3.1
32+
COCOAPODS: 1.4.0

src/CBCCatalogExample.h

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,35 +25,47 @@
2525
*/
2626
@protocol CBCCatalogExample <NSObject>
2727

28+
/**
29+
Returns a dictionary with metaata information for the example.
30+
*/
31+
+ (nonnull NSDictionary<NSString *, NSObject *> *)catalogMetadata;
32+
33+
@optional
34+
2835
/** Return a list of breadcrumbs defining the navigation path taken to reach this example. */
29-
+ (nonnull NSArray<NSString *> *)catalogBreadcrumbs;
36+
+ (nonnull NSArray<NSString *> *)catalogBreadcrumbs
37+
__attribute__((deprecated("use catalogMetadata[CBCBreadcrumbs] instead.")));
3038

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

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

4151
/**
4252
Return a BOOL stating whether this example is in debug mode and should appear as the initial view controller.
4353
*/
44-
+ (BOOL)catalogIsDebug;
45-
46-
@optional
54+
+ (BOOL)catalogIsDebug
55+
__attribute__((deprecated("use catalogMetadata[CBCIsDebug] instead.")));
4756

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

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

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

5971
@end

src/CBCNodeListViewController.h

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,21 @@
1616

1717
#import <UIKit/UIKit.h>
1818

19+
/** This key represents a strings array of the breadcrumbs showing the hierarchy of the example */
20+
FOUNDATION_EXTERN NSString *_Nonnull const CBCBreadcrumbs;
21+
/** This key represents a boolean value if the example is for debugging */
22+
FOUNDATION_EXTERN NSString *_Nonnull const CBCIsDebug;
23+
/** This key represents a string for the description for the example */
24+
FOUNDATION_EXTERN NSString *_Nonnull const CBCDescription;
25+
/** This key represents a boolean value if to present the example in the Catalog app or not */
26+
FOUNDATION_EXTERN NSString *_Nonnull const CBCIsPresentable;
27+
/** This key represents a boolean value if the example is the primary demo */
28+
FOUNDATION_EXTERN NSString *_Nonnull const CBCIsPrimaryDemo;
29+
/** This key represents an NSURL value providing related info for the example */
30+
FOUNDATION_EXTERN NSString *_Nonnull const CBCRelatedInfo;
31+
/** This key represents a string value of the storyboard name for the example */
32+
FOUNDATION_EXTERN NSString *_Nonnull const CBCStoryboardName;
33+
1934
@class CBCNode;
2035

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

72-
/** The description for this node. */
73-
@property(nonatomic, copy, nonnull, readonly) NSString *nodeDescription;
74-
7587
/** The children of this node. */
7688
@property(nonatomic, strong, nonnull) NSArray<CBCNode *> *children;
7789

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

98+
/**
99+
This NSDictionary holds all the metadata related to this CBCNode.
100+
If it is an example noe, a primary demo, related info,
101+
if presentable in Catalog, etc.
102+
*/
103+
@property(nonatomic, strong, nonnull) NSDictionary *metadata;
104+
86105
/** Returns YES if this is an example node. */
87106
- (BOOL)isExample;
88107

@@ -111,7 +130,7 @@ FOUNDATION_EXTERN CBCNode *_Nonnull CBCCreatePresentableNavigationTree(void);
111130
112131
Check that isExample returns YES before invoking.
113132
*/
114-
- (nonnull NSString *)exampleDescription;
133+
- (nullable NSString *)exampleDescription;
115134

116135
/** Returns a link to related information for the example. */
117136
- (nullable NSURL *)exampleRelatedInfo;

0 commit comments

Comments
 (0)