-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Assign duration information so it's available in episode list view wi… #105
Conversation
…thout starting playback; dyerc#45
Doughnut/Library/Episode.swift
Outdated
@@ -184,6 +184,11 @@ class Episode: Record { | |||
pubDate = feedItem.pubDate | |||
link = feedItem.link | |||
|
|||
let duration = feedItem.iTunes?.iTunesDuration | |||
if (duration != nil) { | |||
self.duration = Int(duration!) |
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.
Force unwrapping (!
operator) is generally considered as a code smell and should be avoided as possible. A if let
statement can be used instead of if (duration != nil)
to avoid the force unwrapping.
Doughnut/Library/Episode.swift
Outdated
@@ -184,6 +184,11 @@ class Episode: Record { | |||
pubDate = feedItem.pubDate | |||
link = feedItem.link | |||
|
|||
let duration = feedItem.iTunes?.iTunesDuration | |||
if (duration != nil) { |
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.
It's generally recommended to omit the parentheses around if conditionals for Swift code.
Thank you for the comments, I think it should be better now. I didn't address |
Assign duration information so it's available in episode list view without starting playback; #45