Hi everyOne actually I want to add Data of the cell in tableView that when I click on it , data should pass on showOfferController(another view controller) but I dont why my data is nil when passed on showOfferController:
this is my prepareForSegue function :
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
if segue.identifier == "cellToShow" {
let prePag = segue.destination as! ShowOfferController
//print("title : \(title)")
if WelcomeJson.CodingKeys.title.rawValue == titleItem {
prePag.celanderItem = WelcomeJson.CodingKeys.dateOfExpire.rawValue
prePag.itemImage[0] = imageString
prePag.itemAddress = WelcomeJson.CodingKeys.address.rawValue
prePag.itemOffer = WelcomeJson.CodingKeys.offer.rawValue
prePag.itemDefine = WelcomeJson.CodingKeys.about.rawValue
}
}
}
And also this is my DidSelectRow TableView function :
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
performSegue(withIdentifier: "cellToShow", sender: nil)
}
this is my ShowOfferController on main.storyBoard and also my viewController or VC1 that tabelViewCell point to ShowOfferController:
And here my ShowOfferController.swift code :
class ShowOfferController: UIViewController, UIScrollViewDelegate {
#IBOutlet weak var offerScroll: UIScrollView!
#IBOutlet weak var offerPageController: UIPageControl!
#IBOutlet weak var getLabel: UILabel!
#IBOutlet weak var percentLbl: UILabel!
#IBOutlet weak var calendar: UILabel!
#IBOutlet weak var address: UILabel!
let locations = NSTextAttachment()
let calendars = NSTextAttachment()
let precents = NSTextAttachment()
var itemAddress : String = ""
var itemOffer : String = ""
var celanderItem : String = ""
var itemImage : [String] = []
var itemDefine : String = ""
var frame: CGRect = CGRect(x:0, y:0, width:0, height:0)
override func viewDidLoad() {
super.viewDidLoad()
print("item of images is : \(itemImage)")
// Do any additional setup after loading the view.
offerPageController.numberOfPages = itemImage.count
setupImages()
offerScroll.delegate = self
getLabel.text = itemDefine
locations.image = UIImage(systemName: "location.fill")
let locationVaAdress = NSMutableAttributedString(string: ". ")
locationVaAdress.append(NSAttributedString(attachment: locations))
locationVaAdress.append(NSAttributedString(string: " \(itemAddress)"))
address.attributedText = locationVaAdress
calendars.image = UIImage(systemName: "calendar")
let calendarss = NSMutableAttributedString(string: ". ")
calendarss.append(NSAttributedString(attachment: calendars))
calendarss.append(NSAttributedString(string: " \(celanderItem)"))
calendar.attributedText = calendarss
precents.image = UIImage(systemName: "percent")
let percentAndDarsad = NSMutableAttributedString(string: ". ")
percentAndDarsad.append(NSAttributedString(attachment: precents))
percentAndDarsad.append(NSAttributedString(string: " \(itemOffer)"))
percentLbl.attributedText = percentAndDarsad
}
func setupImages() {
for index in 0..<itemImage.count {
// 1.
frame.origin.x = offerScroll.frame.size.width * CGFloat(index)
frame.size = offerScroll.frame.size
let correctScope = itemImage[index].addingPercentEncoding(withAllowedCharacters: .urlPathAllowed)
let unoptionalScope = correctScope!
let imgUrl = URL(string: "http://5.63.13.16:8080/\(unoptionalScope)")!
if let data = try? Data(contentsOf: imgUrl) {
let imgOffer = UIImageView(frame: frame)
imgOffer.image = UIImage(data: data)
self.offerScroll.addSubview(imgOffer)
}
offerScroll.contentSize = CGSize(width: (offerScroll.frame.size.width * CGFloat(itemImage.count)), height: offerScroll.frame.size.height)
offerScroll.delegate = self
}
}
func scrollViewDidEndDecelerating(_ scrollView: UIScrollView) {
let pageNumber = offerScroll.contentOffset.x / offerScroll.frame.size.width
offerPageController.currentPage = Int(pageNumber)
}
so what's your idea ?
You should make (drag) the segue from on top of the table view controller in the storyboard instead of from the row
Related
When the image in the view I created with xib is clicked, I want it to go to the view controller in the storyboard. I tried segue-present and pushviewcontroller() but how can I do it?
Also, the delegate nil in the imageClicked() function is coming.delagate should not be nil
This is xib file:
xib view
import UIKit
protocol BookDetailVideoViewDelegate : class {
func videoOpen(value: Bool)
}
class BookDetailVideoViewController: UIViewController{
weak var delegate : BookDetailVideoViewDelegate?
var book : Book?
var videoUrl = ""
var url: URL?
var index = 0
#IBOutlet weak var bookImageView: UIImageView!
//var book = self.book
#IBOutlet weak var bookImageViewWidthConstraint: NSLayoutConstraint!
override func viewDidLoad() {
super.viewDidLoad()
if #available(iOS 11.0, *) {
self.extendedLayoutIncludesOpaqueBars = true
} else {
self.edgesForExtendedLayout = []
}
self.navigationController?.navigationBar.isTranslucent = false
//self.bookImageViewWidthConstraint.constant = UIScreen.main.bounds.width * 0.35
self.view.layoutIfNeeded()
if let url = self.url {
self.bookImageView.kf.setImage(with: url)
}
self.bookImageView.layer.cornerRadius = 10
bookImageView.isUserInteractionEnabled = true
let gestureRecognizer = UITapGestureRecognizer(target: self, action: #selector(imageClicked))
bookImageView.addGestureRecognizer(gestureRecognizer)
}
override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
}
deinit {
self.url = nil
}
#objc func imageClicked(){
print(delegate as Any)
self.delegate?.videoOpen(value: true)
}
func initializeView(url: URL, index: Int , book: Book) {
self.index = index
self.url = url
self.book = book
}
override func viewDidLayoutSubviews() {
super.viewDidLayoutSubviews()
}
}
The view controller is like this:
import UIKit
import YoutubePlayer_in_WKWebView
class YoutubeVideoViewController: UIViewController , BookDetailVideoViewDelegate, WKYTPlayerViewDelegate {
let myDelegate : BookDetailVideoViewController = BookDetailVideoViewController()
var boolvalue = true
var book : Book?
#IBOutlet weak var playerView: WKYTPlayerView!
override func viewDidLoad() {
super.viewDidLoad()
playerView.delegate = self
myDelegate.delegate = self
let mediakey = book!.mediaKey as String?
playerView.load(withVideoId: mediakey!)
}
func videoOpen(value : Bool) {
guard let ViewC = UIStoryboard(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "YoutubeVideoViewController") as? YoutubeVideoViewController else{return}
ViewC.book = book
ViewC.boolvalue = value
self.present(ViewC, animated: true)
}
}
I am working on an app in which i am using UITableviewCell to display feed data. In Cell i am using multiple UIButtons to perform actions.
The main issue arise when i perform action through buttons the method is not called for the very first time(TableViewCell content is not updated). But when i press button second time it works fine.
Here is my code
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell
{
let cell = tableView.dequeueReusableCell(withIdentifier: "Cell_Reels", for: indexPath) as! Cell_Reels
cell.delegate = self
DispatchQueue.main.asyncAfter(deadline: .now()+0.1) { [self] in
UIView.animate(withDuration: 12.0, delay: 1, options: ([.curveLinear, .repeat]), animations: {() -> Void in
cell.marqueeLabel.center = CGPoint.init(x: 35 - cell.marqueeLabel.bounds.size.width / 2, y: cell.marqueeLabel.center.y)
}, completion: { _ in })
cell.likebutton.tag = indexPath.row
cell.FollowButton.tag = indexPath.row
cell.shareBtn.tag = indexPath.row
cell.shareBtn.addTarget(self, action: #selector(buttonShare), for: .touchUpInside)
let VideoStr = self.videos[indexPath.row]["media"].string ?? ""
self.fullVideoUrl = "\(KeyConstant.KBaseImageURL)\(VideoStr)"
//print("======", self.fullVideoUrl)
cell.configureCell( videoUrl: self.fullVideoUrl)
self.pausePlayeVideos()
cell.totalViews.text = "\(self.videos[indexPath.row]["count_view"].string ?? "") Views"
cell.nameLbl.text = self.videos[indexPath.row]["full_name"].string ?? ""
cell.descLbl.text = self.videos[indexPath.row]["title"].string ?? ""
cell.marqueeLabel.text = self.videos[indexPath.row]["title"].string ?? ""
cell.idLbl.text = self.videos[indexPath.row]["id"].string ?? ""
cell.likedLbl.text = self.videos[indexPath.row]["like_status"].string ?? ""
cell.followedLbl.text = self.videos[indexPath.row]["follow_status"].string ?? ""
self.currentLikesStr = self.videos[indexPath.row]["count_like"].string ?? ""
cell.likesCountLabel.text = "\(self.currentLikesStr) Likes"
self.followedStr = self.videos[indexPath.row]["follow_status"].string ?? ""
print("followedStr ppppppppppppppppppppppppp",followedStr, cell.idLbl.text!)
if self.followedStr == "0"
{
cell.FollowButton .setTitle("Follow", for: UIControl.State.normal)
}
else
{
cell.FollowButton .setTitle("Following", for: UIControl.State.normal)
}
self.likedStr = self.videos[indexPath.row]["like_status"].string ?? ""
print("likedStr -=-==-===-=-=-",likedStr, cell.idLbl.text!)
if likedStr == "0"
{
let selectedImage = UIImage(named: "heart_y2_30x30") as UIImage?
cell.likebutton.setImage(selectedImage, for: UIControl.State.normal)
}
else
{
let selectedImage = UIImage(named: "heart_y_30x30") as UIImage?
cell.likebutton.setImage(selectedImage, for: UIControl.State.normal)
}
cell.CommentsCountLabel.text = "Comments"
}
return cell
}
Button method decleration
func addFollowed(cell: Cell_Reels)
{
followedStr = cell.followedLbl.text!
let idstr = cell.idLbl.text
print(userId, idstr ?? "", followedStr)
let VideoidStr = cell.idLbl.text
print("=====", VideoidStr!)
let deviceid = "12345"
//print(videoId)
WebServiceHelper.sharedInstanceAPI.hitPostAPI(urlString: KeyConstant.APIFollow, params: ["user_id":userId, "device_id": deviceid, "device_type" : "iOS", "video_id":VideoidStr!], completionHandler: { (result: [String:Any], err:Error?) in
//print(result)
DispatchQueue.main.async {
//MBProgress().hideIndicator(view: self.view)
}
if(!(err == nil))
{
return
}
let json = JSON(result)
let statusCode = json["status"].string
//print(json)
if(statusCode == "success")
{
DispatchQueue.main.asyncAfter(deadline: .now()+0.1) { [self] in
self.followedStr = json["follow_status"].string ?? ""
cell.followedLbl.text = "\(self.followedStr)"
print(self.followedStr)
print(";;;;;;;;;;;;;;;;;;", self.followedStr)
if self.followedStr == "0"
{
cell.FollowButton .setTitle("Follow", for: UIControl.State.normal)
self.followedStr = "1"
self.arrayTempData[cell.FollowButton.tag] = 1
}
else
{
cell.FollowButton .setTitle("Following", for: UIControl.State.normal)
self.followedStr = "0"
self.arrayTempData[cell.FollowButton.tag] = 0
}
}
}
})
self.tblInstaReels.reloadData()
self.followedStr = ""
}
This i defined in TableViewCell class
protocol TableViewCellDelegate
{
func addTapped(cell: Cell_Reels, Tlikes : String)
func addFollowed(cell: Cell_Reels)
}
class Cell_Reels: UITableViewCell, ASAutoPlayVideoLayerContainer
{
var delegate: TableViewCellDelegate?
#IBOutlet weak var likedLbl : UILabel!
#IBOutlet weak var followedLbl : UILabel!
#IBOutlet weak var idLbl : UILabel!
#IBOutlet weak var nameLbl : UILabel!
#IBOutlet weak var likesCountLabel : UILabel!
#IBOutlet weak var CommentsCountLabel : UILabel!
#IBOutlet weak var marqueeLabel: UILabel!
#IBOutlet weak var imgReels: UIImageView!
#IBOutlet weak var Bkview: UIView!
#IBOutlet weak var PauseBtn: UIButton!
#IBOutlet weak var descLbl: UILabel!
#IBOutlet weak var shareBtn : UIButton!
#IBOutlet weak var likebutton : UIButton!
#IBOutlet weak var FollowButton : UIButton!
#IBOutlet weak var totalViews : UILabel!
var playerController: ASVideoPlayerController?
var videoLayer: AVPlayerLayer = AVPlayerLayer()
var likestr = ""
private(set) var liked = false
private(set) var followed = false
var VideoId = ""
#IBAction func followed(_ sender: Any)
{
delegate?.addFollowed(cell: self)
}
#IBAction func like(_ sender: Any)
{
delegate?.addTapped(cell: self, Tlikes: self.likedLbl.text!)
}
func likeVideo()
{
print("==========", likestr)
}
var videoURL: String?
{
didSet {
if let videoURL = videoURL
{
ASVideoPlayerController.sharedVideoPlayer.setupVideoFor(url: videoURL)
}
videoLayer.isHidden = videoURL == nil
}
}
override func awakeFromNib()
{
super.awakeFromNib()
imgReels.layer.addSublayer(videoLayer)
selectionStyle = .none
}
func configureCell(videoUrl: String?)
{
self.videoURL = videoUrl
}
override func prepareForReuse()
{
imgReels.imageURL = nil
super.prepareForReuse()
}
override func layoutSubviews()
{
super.layoutSubviews()
let horizontalMargin: CGFloat = 20
let width: CGFloat = bounds.size.width - horizontalMargin * 2
let height: CGFloat = (width * 0.9).rounded(.up)
videoLayer.frame = CGRect(x: 0, y: 0, width: imgReels.layer.frame.width, height: imgReels.layer.frame.height)
}
func visibleVideoHeight() -> CGFloat
{
return imgReels.frame.size.height
let videoFrameInParentSuperView: CGRect? = self.superview?.superview?.convert(imgReels.frame, from: imgReels)
guard let videoFrame = videoFrameInParentSuperView,
let superViewFrame = imgReels?.frame else {
return 0
}
let visibleVideoFrame = videoFrame.intersection(superViewFrame)
return visibleVideoFrame.size.height
}
}
in place of calling a separate method, use the addTarget method.
if you update anything in table view then perform all operations in cellForRowAt else after scrolling it reused the cell and it will create ambiguity
reload the table view in the main thread.
I'm getting an error " Value of type 'SecondViewController' has no member 'bmiValue' "
I'm trying to find out what's wrong with the code
import UIKit
class ViewController: UIViewController {
#IBOutlet weak var heightLabel: UILabel!
#IBOutlet weak var weightLabel: UILabel!
#IBAction func weightSliderChanged(_ sender: UISlider) {
weightLabel.text = String(format: "%.0f", sender.value)
}
#IBAction func heightSliderChanged(_ sender: UISlider) {
heightLabel.text = String(format: "%.2f", sender.value)
}
#IBAction func calculatePressed(_ sender: UIButton) {
let weight = weightSliderValue.value
let height = heightSliderValue.value
let bmi = weight/pow(height, 2)
print(bmi)
let secondVc = SecondViewController() Value of type 'SecondViewController' has no member 'bmiValue'
secondVc.bmiValue = String(format: ".1f", bmi)
self.present(secondVc, animated: true, completion: nil)
}
#IBOutlet weak var weightSliderValue: UISlider!
#IBOutlet weak var heightSliderValue: UISlider!
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
}
}
here is the code for second view controller where I want to display bmi
import UIKit
var bmiValue = 0.0
class SecondViewController : UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
let label = UILabel()
label.text = "Hello"
label.frame = CGRect(x: 0, y: 0, width: 100, height: 50)
view.addSubview(label)
}
}
If you want to pass a value as a String, the var / property you are setting must also be a String:
class SecondViewController : UIViewController {
// if you want to pass a string
var bmiValue: String = "0.0"
override func viewDidLoad() {
super.viewDidLoad()
let label = UILabel()
label.text = "Hello"
label.frame = CGRect(x: 0, y: 0, width: 100, height: 50)
view.addSubview(label)
}
}
Now, in your "main" view controller, you can do this:
let secondVc = SecondViewController()
secondVc.bmiValue = String(format: ".1f", bmi)
self.present(secondVc, animated: true, completion: nil)
I try to pass imageName string data from ViewController to ImageViewController
which also func sliderImageTapped is sending data to CPImageSlider class
// ViewController.swift
import UIKit
let _AUTO_SCROLL_ENABLED : Bool = false
class ViewController: UIViewController, CPSliderDelegate {
var imagesArray = [String]()
var passDataDelegate: PassImageName?
#IBOutlet weak var slider : CPImageSlider!
#IBOutlet weak var autoSwitch : UISwitch!
#IBOutlet weak var arrowSwitch : UISwitch!
#IBOutlet weak var indicatorSwitch : UISwitch!
#IBOutlet weak var sliderSwitch : UISwitch!
#IBOutlet weak var circularSwitch : UISwitch!
override func viewDidLoad() {
super.viewDidLoad()
imagesArray = ["wallpaper1.jpg","wallpaper2.jpg","wallpaper3.jpg","wallpaper4.jpg"]
slider.images = imagesArray
slider.delegate = self
let zoom : CGFloat = 0.8
autoSwitch.transform = CGAffineTransform(scaleX: zoom, y: zoom)
arrowSwitch.transform = CGAffineTransform(scaleX: zoom, y: zoom)
indicatorSwitch.transform = CGAffineTransform(scaleX: zoom, y: zoom)
sliderSwitch.transform = CGAffineTransform(scaleX: zoom, y: zoom)
circularSwitch.transform = CGAffineTransform(scaleX: zoom, y: zoom)
autoSwitch.isOn = slider.autoSrcollEnabled
arrowSwitch.isOn = slider.enableArrowIndicator
indicatorSwitch.isOn = slider.enablePageIndicator
sliderSwitch.isOn = slider.enableSwipe
circularSwitch.isOn = slider.allowCircular
}
func sliderImageTapped(slider: CPImageSlider, imageName: String, index: Int) {
passDataDelegate?.passData(clickedImageName: imageName)
guard let destinationVC = storyboard?.instantiateViewController(withIdentifier: "ImageViewController") as? ImageViewController else {
return
}
present(destinationVC, animated: true, completion: nil )
print("\(index)")
}
}
// ImageViewController.swift
import UIKit
protocol PassImageName {
func passData(clickedImageName:String)
}
class ImageViewController: UIViewController, PassImageName {
#IBOutlet weak var image: UIImageView!
var imageName:String?
func passData(clickedImageName: String) {
imageName = clickedImageName
}
override func viewDidLoad() {
super.viewDidLoad()
image.image = UIImage(named: imageName ?? "wallpaper1.jpg")
}
#IBAction func dismiss(_ sender: UIButton) {
dismiss(animated: true, completion: nil)
}
}
You must initialize passDataDelegate before call the delegate method.
func sliderImageTapped(slider: CPImageSlider, imageName: String, index: Int) {
guard let destinationVC = storyboard?.instantiateViewController(withIdentifier: "ImageViewController") as? ImageViewController else {
return
}
passDataDelegate = destinationVC
passDataDelegate?.passData(clickedImageName: imageName)
present(destinationVC, animated: true, completion: nil )
print("\(index)")
}
I don't understand the point of your delegate, is there something preventing you to just set the imageName after instantiating the ImageViewController ?
func sliderImageTapped(slider: CPImageSlider, imageName: String, index: Int) {
guard let destinationVC = storyboard?.instantiateViewController(withIdentifier: "ImageViewController") as? ImageViewController else {
return
}
destinationVC.imageName = imageName
present(destinationVC, animated: true, completion: nil )
print("\(index)")
}
And then just set your image inside it :
var imageName:String? {
didSet {
image.image = UIImage(named: imageName ?? "wallpaper1.jpg")
}
}
I have a viewcontroller that has a tableview and a button at the bottom. Within each cell is a radio button as a tapGesture. I would like to updated the button with the number of cells selected. If my gesture is in the custom cell and my button is in my viewcontroller how can I get the two to work together?
Custom cell:
class SearchTalentCell: UITableViewCell {
#IBOutlet weak var userProfileImage: UIImageView!
#IBOutlet weak var talentUserName: UILabel!
#IBOutlet weak var selectedImg: UIImageView!
#IBOutlet weak var inviteSentImg: UIImageView!
var prospectRef: FIRDatabaseReference!
var currentTalent: UserType!
func setTalent(talent: UserType) {
currentTalent = talent
currentTalent.userKey = talent.userKey
}
override func awakeFromNib() {
super.awakeFromNib()
let tap = UITapGestureRecognizer(target: self, action: #selector(selectTapped))
tap.numberOfTapsRequired = 1
selectedImg.addGestureRecognizer(tap)
selectedImg.isUserInteractionEnabled = true
}
override func setSelected(_ selected: Bool, animated: Bool) {
super.setSelected(selected, animated: animated)
// Configure the view for the selected state
}
func configureCell(user: UserType, img: UIImage? = nil) {
prospectRef = Cast.REF_PRE_PRODUCTION_CASTING_POSITION.child(ProjectDetailVC.currentProject).child(FIRDataCast.prospect.rawValue).child(CastingDetailVC.positionName).child(user.userKey)
setTalent(talent: user)
self.talentUserName.text = "\(user.firstName) \(user.lastName)"
prospectRef.observeSingleEvent(of: .value, with: { (snapshot) in
if let _ = snapshot.value as? NSNull {
self.inviteSentImg.isHidden = true
} else {
self.inviteSentImg.image = UIImage(named: "inviteSent")
self.inviteSentImg.isHidden = false
}
})
if UserType.selectedTalentForSearch.contains(currentTalent.userKey) {
selectedImg.image = UIImage(named: "radioSelected")
} else {
selectedImg.image = UIImage(named: "radioUnselected")
}
//Image Caching
if img != nil {
self.userProfileImage.image = img
} else {
if let imageURL = user.profileImage {
let ref = FIRStorage.storage().reference(forURL: imageURL)
ref.data(withMaxSize: 2 * 1024 * 1024, completion: { (data, error) in
if error != nil {
print("ZACK: Unable to download image from Firebase Storage")
} else {
print("ZACK: Image downloaded from Firebase Storage")
if let imgData = data {
if let img = UIImage(data: imgData) {
self.userProfileImage.image = img
SearchTalentVC.userProfileImageCache.setObject(img, forKey: imageURL as NSString)
}
}
}
})
}
}
}
#objc func selectTapped(sender: UITapGestureRecognizer) {
if UserType.selectedTalentForSearch.contains(currentTalent.userKey) {
selectedImg.image = UIImage(named: "radioUnselected")
UserType.selectedTalentForSearch = UserType.selectedTalentForSearch.filter{$0 != currentTalent.userKey}
print("Keys: \(UserType.selectedTalentForSearch)")
} else {
selectedImg.image = UIImage(named: "radioSelected")
UserType.selectedTalentForSearch.append(currentTalent.userKey)
print("Keys: \(UserType.selectedTalentForSearch)")
}
}
}
ViewController:
class SearchTalentVC: UIViewController, UITableViewDelegate, UITableViewDataSource {
#IBOutlet weak var tableView: UITableView!
#IBOutlet weak var sendInviteButton: UIButton!
var searchingRole = [Cast]()
var unfilteredTalent = [UserType]()
var filteredTalent = [UserType]()
var selectedTalent = [UserType]()
var matchingTalentUserKeys = [String]()
var isFiltered = false
var selectedCounter = [String]()
var prospectRef: FIRDatabaseReference!
static var userProfileImageCache: NSCache<NSString, UIImage> = NSCache()
let searchController = UISearchController(searchResultsController: nil)
override func viewDidLoad() {
super.viewDidLoad()
searchController.searchResultsUpdater = self
searchController.obscuresBackgroundDuringPresentation = false
searchController.searchBar.placeholder = "Search Talent"
searchController.searchBar.barStyle = .black
navigationItem.searchController = searchController
definesPresentationContext = true
searchController.searchBar.scopeButtonTitles = ["All", "Role Specific"]
searchController.searchBar.tintColor = UIColor.white
searchController.searchBar.delegate = self
searchController.searchResultsUpdater = self
self.sendInviteButton.setTitle("Send Invite to \(UserType.selectedTalentForSearch.count) Prospects", for: .normal)
getTalentProfiles()
}
Thank you for any help!
I'm not sure why you are using the cell selection inside the cell, as opposed to the tableview delegate function func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath)?
If you use didSelectRowAt, you could have an array of selected rows and you can include the selectedRows.count into your button text.
Hope that helps!