Remove “optional” keyword while displaying string - Swift

The name of the pictureThe name of the pictureThe name of the pictureClash 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:
enter image description here









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.

Popular posts from this blog

Firebase Auth - with Email and Password - Check user already registered

Dynamically update html content plain JS

Creating a leaderboard in HTML/JS