Remove “optional” keyword while displaying string - Swift
Clash Royale CLAN TAG#URR8PPP
Remove “optional” keyword while displaying string - Swift
I am working on a movies app and it displays release date as part of the movie details on table view cell. Below is the code:
let date = movieDetail.releaseDate as String
let releaseDateText = NSLocalizedString("release date", comment: "Release date label text")
let tbaText = NSLocalizedString("tba", comment: "TBA text")
releaseDateLabel.text = "(releaseDateText): (String(describing: date != "" ? Date.getMMMddyyyyDateFormat(date) : "(tbaText)" ))"
With this, I do see the date on the screen as Optional("Jan 07,2018"). I just want to display the date without optional keyword and parenthesis. Am not able to figure out what is causing "Optional" keyword to show up.
Part of my app:
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.