Skip to content

Commit da88115

Browse files
committed
Add convenience method that returns BloggingPromptsAttribution
1 parent 05f456b commit da88115

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

WordPress/Classes/Models/BloggingPrompt+CoreDataClass.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@ public class BloggingPrompt: NSManagedObject {
1717
self.displayAvatarURLs = []
1818
}
1919

20+
var promptAttribution: BloggingPromptsAttribution? {
21+
BloggingPromptsAttribution(rawValue: attribution.lowercased())
22+
}
23+
2024
/// Convenience method to map properties from `RemoteBloggingPrompt`.
2125
///
2226
/// - Parameters:

WordPress/Classes/ViewRelated/Blog/Blog Dashboard/Cards/Prompts/DashboardPromptsCardCell.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -352,8 +352,7 @@ private extension DashboardPromptsCardCell {
352352
promptLabel.text = forExampleDisplay ? Strings.examplePrompt : prompt?.text.stringByDecodingXMLCharacters().trim()
353353
containerStackView.addArrangedSubview(promptTitleView)
354354

355-
if let promptAttribution = prompt?.attribution.lowercased(),
356-
let attribution = BloggingPromptsAttribution(rawValue: promptAttribution) {
355+
if let attribution = prompt?.promptAttribution {
357356
attributionIcon.image = attribution.iconImage
358357
attributionSourceLabel.attributedText = attribution.attributedText
359358
containerStackView.addArrangedSubview(attributionStackView)

0 commit comments

Comments
 (0)