Files
Woka_Native_iOS/WOKA/Theme/View/UserNotificationCell.swift
BilalKhanWDI 3754a7f75b - Fixed the blog image issue for fit.
- Finalised more module.
- Made UI for notifications
- Made notification cells
- Added pull to refresh
- Worked on logic for Favourites.
- Getting the logic data, then separating the hindi web series
- Added collection for Webseries hindi , English , Audio book, karaoke, games
- MAde the data model for favourites
2024-06-13 19:54:44 +05:30

52 lines
1.6 KiB
Swift

//
// UserNotificationCell.swift
// WOKA
//
// Created by MacBook Pro on 13/06/24.
//
import UIKit
class UserNotificationCell: UITableViewCell {
@IBOutlet weak var notificationDate: UILabel!
@IBOutlet weak var notificationDesc: UILabel!
override func awakeFromNib() {
super.awakeFromNib()
// Initialization code
}
override func setSelected(_ selected: Bool, animated: Bool) {
super.setSelected(selected, animated: animated)
// Configure the view for the selected state
}
func setData(data : UserNotificationDM){
if let dateStr = data.createdAt, let date = DateFormatterLib.dateMods(dateStr: dateStr, dateCurrentFormat: .yyyy_MM_ddTHH_mm_ss_ssZ, dateReturnFormat: .yyyy_MM_ddTHH_mm_ss_ssZ, stringOrDate: .date).1{
let currentDate = Date()
// Calculate the difference in days
let calendar = Calendar.current
let dateComponents = calendar.dateComponents([.day], from: currentDate, to: date)
if let daysDifference = dateComponents.day {
let datePositive = abs(daysDifference)
if datePositive == 0{
notificationDate.text = "Today"
}else if datePositive == 1{
notificationDate.text = "Yesterday"
}else{
notificationDate.text = datePositive.toString() + " days ago"
}
} else {
notificationDate.text = "0 days ago"
}
}
notificationDesc.text = data.title
}
}