Post

Replies

Boosts

Views

Activity

Reply to Transfer From Parent To Child
Okay this is the code for one of my sliders in a child view. I want the calROA() method from the parent to be avaliable in the cAssMove function. @IBAction func cAssMove(_ sender: Any) {     cAssetsHeight.constant = CGFloat(cAssetsSlider.value)     scaleCA = Int(6.75675675676 * cAssetsSlider.value)     cAssetsNum.text = "\(scaleCA)"     if scaleCA < 316 {       cAssetsLabel.text = ""     } else {       cAssetsLabel.text = "Current \n Assets"     }       }
Sep ’20
Reply to Trying to display on a collectionview cell.
my text labels for example all have UILabel? nil. Part of my func update in the first question.Code 1: ImageControllerclass FetchImage { func fetchItemArtwork(url: URL, completion: @escaping (UIImage?) -&gt; Void) { let task = URLSession.shared.dataTask(with: url) { (data, response, error) in if let data = data, let image = UIImage(data: data) { completion(image) } else { completion(nil) } } task.resume() } }Code 2: CurrentPlayer classimport Foundation struct CurrentPlayer: Codable, Hashable { let photoUrl: URL let firstName: String let lastName: String let positionCategory: String let team: String enum CodingKeys: String, CodingKey { case photoUrl = "PhotoUrl" case firstName = "FirstName" case lastName = "LastName" case positionCategory = "PositionCategory" case team = "Team" } init(from decoder: Decoder) throws { let values = try decoder.container(keyedBy: CodingKeys.self) photoUrl = try values.decode(URL.self, forKey: CodingKeys.photoUrl) firstName = try values.decode(String.self, forKey: CodingKeys.firstName) lastName = try values.decode(String.self, forKey: CodingKeys.lastName) positionCategory = try values.decode(String.self, forKey: CodingKeys.positionCategory) team = try values.decode(String.self, forKey: CodingKeys.team) } }
Mar ’20