Aging F.R.I.E.N.D.S
๐ต
So no one told you how old they are ?
๐
๐
๐
๐
FRIENDS cast are ? Let's find out !
Ever wondered how old theReemz.Mac.48452.-.VNC.Viewer.2021-12-11.14-37-22_Trim.mp4
App Interface
The app starts with a group of cards each representing a character of the series along with a random age assigned to each character because they are
1) Character Card
The characters related info are stored in a dictionary named (cast) in the following order :
- Character Name
- Character Image
- Character Role
- Character Nickname
- Character Summary Note : age is randomly generated we don't need to store it in the dictionary
var cast = [
("Mr.Heckles","Heckles","Retired - Complaining 24/7","Old Man Heckles,The Weird Man","Mr. Heckles lived in the apartment below Monica and Rachel. He often complained about the apparent noise that the two made, either in person or by tapping on his apartment ceiling with a broom ! "),
("Janice","Janice","OH MY GOD !","Just Janice","She is known for her obnoxious and nasally voice and her trademark cry of \"OH MY GOD!\"")]
Each card will only display 4 details which are (Name , Image , Role , Age), and for the age, it will be a random number between 5 to 85 which will be displayed using (AgeLabel)
- Note : that the age will change each time the app runs because it is random
cell.AgeLabel.text = "Age : \(Int.random(in: 5...85)) Years Old"// random age changing with every run :)
2) Character Info Dialog
On the right-top corner of the card there is an info button which will display an alert dialog viewing more info about the character, which are :
- Character Image
- Character Nickname
- Character Summary
@IBAction func infoButtonPressed(_ sender: UITableViewCell) {
var currentCast = cast[sender.tag]// making use of the tags i assigned at (line 49) to get the corresponding cast member
let alert = UIAlertController(title: "\(currentCast.0) !", message: "\nNickname:\n\(currentCast.3)\n\nAbout:\n\(currentCast.4)" , preferredStyle: UIAlertController.Style.alert)
var imageView = UIImageView(frame: CGRect(x: 60, y: -150, width: 150, height: 150))//adding image at the top of the alert
imageView.image = UIImage(named:currentCast.1)
alert.view.addSubview(imageView)
// add an action (button)
alert.addAction(UIAlertAction(title: "ok", style: UIAlertAction.Style.default, handler: { action in self}))
// show the alert
self.present(alert, animated: true, completion: nil)
}