Skip to content

Commit

Permalink
Merge pull request #115 from mikakruschel/master
Browse files Browse the repository at this point in the history
Update example and readme
  • Loading branch information
AvdLee authored Feb 18, 2022
2 parents 99e791c + fc28bed commit b6750fe
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions Example/Diagnostics-Example/CustomSmartInsights.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import Foundation
import Diagnostics

struct SmartInsightsProvider: SmartInsightsProviding {
func smartInsights(for chapter: DiagnosticsChapter) -> [SmartInsightProviding]? {
guard let html = chapter.diagnostics as? HTML else { return nil }
func smartInsights(for chapter: DiagnosticsChapter) -> [SmartInsightProviding] {
guard let html = chapter.diagnostics as? HTML else { return [] }
if html.errorLogs.contains(where: { $0.contains("AppDelegate.ExampleLocalizedError") }) {
return [
SmartInsight(
Expand All @@ -20,6 +20,6 @@ struct SmartInsightsProvider: SmartInsightsProviding {
)
]
}
return nil
return []
}
}
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -219,8 +219,8 @@ It's possible to provide your own custom insights based on the chapters in the r

```swift
struct SmartInsightsProvider: SmartInsightsProviding {
func smartInsights(for chapter: DiagnosticsChapter) -> [SmartInsightProviding]? {
guard let html = chapter.diagnostics as? HTML else { return nil }
func smartInsights(for chapter: DiagnosticsChapter) -> [SmartInsightProviding] {
guard let html = chapter.diagnostics as? HTML else { return [] }
if html.errorLogs.contains(where: { $0.contains("AppDelegate.ExampleLocalizedError") }) {
return [
SmartInsight(
Expand All @@ -229,7 +229,7 @@ struct SmartInsightsProvider: SmartInsightsProviding {
)
]
}
return nil
return []
}
}
```
Expand Down

0 comments on commit b6750fe

Please sign in to comment.