Last active
June 12, 2019 09:09
-
-
Save ashour/c7ed0c38ef121d09778b6163d82f8e63 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import UIKit | |
| class TrackDetailsViewController: UIViewController { | |
| // ... | |
| @IBOutlet weak var copyrightLabel: UILabel! | |
| var track: Track? | |
| override func viewDidLoad() { | |
| super.viewDidLoad() | |
| if let track = track { | |
| // ... | |
| copyrightLabel.text = getCopyrightText(artistName: track.artistName) | |
| } | |
| } | |
| func setup(with track: Track) { | |
| self.track = track | |
| } | |
| fileprivate func getCopyrightText(artistName: String) -> String { | |
| let format = NSLocalizedString("copyright", comment: "") | |
| let currentYear = "\(Calendar.current.component(.year, from: Date()))" | |
| return String.localizedStringWithFormat(format, currentYear, artistName) | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment