-
Notifications
You must be signed in to change notification settings - Fork 776
Removing forced unwrapping #297
Removing forced unwrapping #297
Conversation
00f7721
to
0db0713
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have just added a question, let me know what do you think.
} | ||
|
||
var activeClass: String { | ||
guard let className = metadata.findMetaByProperty("media:active-class") else { | ||
guard let className = metadata.find(byProperty: "media:active-class")?.value else { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't get why use .value
here and not wrap it in the function as it was before.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since metadata is an object it does not make sense a method named findMetaByProperty()
or find(byProperty:)
returns a String
. In the previous implementation there were two methods named findMetaByName
and findMetaByProperty
and they were returning different "contents" that is weird. I guess now these method are more consistent and the developer can choose witch Meta's property is better to use
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah makes sense.
return "epub-media-overlay-active" | ||
} | ||
return className | ||
} | ||
|
||
var playbackActiveClass: String { | ||
guard let className = metadata.findMetaByProperty("media:playback-active-class") else { | ||
guard let className = metadata.find(byProperty: "media:playback-active-class")?.value else { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here and in the others that use .value
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The same as above
} | ||
|
||
var activeClass: String { | ||
guard let className = metadata.findMetaByProperty("media:active-class") else { | ||
guard let className = metadata.find(byProperty: "media:active-class")?.value else { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah makes sense.
No description provided.