I just updated my Xcode and have been trying to learn more about it. This is my code for Collection View Cell. I'm trying to get data from URL but I've been annoyed with this error. I tried all the solutions in here but they have different function structure. Also other solutions didn't work.
import UIKit
class PersonCell: UICollectionViewCell {
@IBOutlet weak var personImage : UIImageView!
func ConfigureCell (imgURL : String)
{
}
func DownloadImage ( url : NSURL)
{
}
func GetDatafromURL (URL : NSURL , completion : @escaping (( _ data : NSData? , _ response : URLResponse? , _ error : NSError?) -> Void))
{
URLSession.shared.dataTask(with: URL) { (data , response , error) in
completion (data , response, error)
}.resume()
}
}
the code that worked in the tutorial video is something like this
func GetDatafromURL (URL : NSURL , completion : (( data : NSData? , response : NSURLResponse? , error : NSError?) -> Void))
{
NSURLSession.sharedSession.dataTaskWithURL( URL) { (data , response , error) in
completion(data : data , responce : response, error : error)
}.resume()