Skip to content

Instantly share code, notes, and snippets.

@ermst4r
Created August 17, 2016 18:09
Show Gist options
  • Save ermst4r/fb29c4ec3265ea6192b8d951fd162500 to your computer and use it in GitHub Desktop.
Save ermst4r/fb29c4ec3265ea6192b8d951fd162500 to your computer and use it in GitHub Desktop.
CustomCell.swift
//
// CustomCell.swift
// cheapveilingen
//
// Created by Erwin Nandpersad on 17-07-16.
// Copyright © 2016 Cheapveilingen.nl. All rights reserved.
//
import UIKit
import SocketIOClientSwift
class CustomCell: UITableViewCell {
var indexPath = 0
@IBOutlet var veiling_title: UITextView!
@IBOutlet var photo: UIImageView!
@IBOutlet var veilingSeconds: UILabel!
var timeInterval: Int = 0 {
didSet {
self.veilingSeconds.text = "\(timeInterval)"
callback?(timeInterval)
}
}
var callback : ((Int) -> ())?
func updateUI() {
if self.timeInterval > 0 {
self.timeInterval -= 1
}
}
override func awakeFromNib() {
super.awakeFromNib()
// Initialization code
let notificationCenter = NSNotificationCenter.defaultCenter()
notificationCenter.addObserver(self, selector: #selector(CustomCell.updateUI), name: "CustomCellUpdate", object: nil)
}
deinit {
NSNotificationCenter.defaultCenter().removeObserver(self)
}
override func setSelected(selected: Bool, animated: Bool) {
super.setSelected(selected, animated: animated)
// Configure the view for the selected state
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment