11public struct StatsTagsAndCategoriesInsight {
22 public let topTagsAndCategories : [ StatsTagAndCategory ]
3+
4+ public init ( topTagsAndCategories: [ StatsTagAndCategory ] ) {
5+ self . topTagsAndCategories = topTagsAndCategories
6+ }
37}
48
59extension StatsTagsAndCategoriesInsight : StatsInsightData {
@@ -34,6 +38,15 @@ public struct StatsTagAndCategory {
3438 public let url : URL ?
3539 public let viewsCount : Int ?
3640 public let children : [ StatsTagAndCategory ]
41+
42+ public init ( name: String , kind: Kind , url: URL ? , viewsCount: Int ? , children: [ StatsTagAndCategory ] ) {
43+ self . name = name
44+ self . kind = kind
45+ self . url = url
46+ self . viewsCount = viewsCount
47+ self . children = children
48+ }
49+
3750}
3851
3952extension StatsTagAndCategory {
@@ -61,7 +74,7 @@ extension StatsTagAndCategory {
6174 let mappedChildren = innerTags. compactMap { StatsTagAndCategory ( singleTag: $0) }
6275 let label = mappedChildren. map { $0. name } . joined ( separator: " , " )
6376
64- self . init ( name: label, kind: . folder, url: " " , viewsCount: views, children: mappedChildren)
77+ self . init ( name: label, kind: . folder, url: nil , viewsCount: views, children: mappedChildren)
6578 }
6679
6780 init ? ( singleTag tag: [ String : AnyObject ] , viewsCount: Int ? = 0 ) {
@@ -84,16 +97,6 @@ extension StatsTagAndCategory {
8497 kind = . category
8598 }
8699
87- self . init ( name: name, kind: kind, url: url, viewsCount: viewsCount, children: [ ] )
100+ self . init ( name: name, kind: kind, url: URL ( string : url) , viewsCount: viewsCount, children: [ ] )
88101 }
89-
90-
91- init ( name: String , kind: Kind , url: String , viewsCount: Int ? , children: [ StatsTagAndCategory ] ) {
92- self . name = name
93- self . kind = kind
94- self . url = URL ( string: url)
95- self . viewsCount = viewsCount
96- self . children = children
97- }
98-
99102}
0 commit comments